Return-Path: Delivered-To: apmail-mina-dev-archive@www.apache.org Received: (qmail 82275 invoked from network); 3 Dec 2010 23:34:39 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Dec 2010 23:34:39 -0000 Received: (qmail 35968 invoked by uid 500); 3 Dec 2010 23:34:38 -0000 Delivered-To: apmail-mina-dev-archive@mina.apache.org Received: (qmail 35929 invoked by uid 500); 3 Dec 2010 23:34:38 -0000 Mailing-List: contact dev-help@mina.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mina.apache.org Delivered-To: mailing list dev@mina.apache.org Received: (qmail 35921 invoked by uid 99); 3 Dec 2010 23:34:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Dec 2010 23:34:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Dec 2010 23:34:36 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oB3NYE43004549 for ; Fri, 3 Dec 2010 23:34:14 GMT Message-ID: <28312588.103381291419254293.JavaMail.jira@thor> Date: Fri, 3 Dec 2010 18:34:14 -0500 (EST) From: "Bobby Powers (JIRA)" To: dev@mina.apache.org Subject: [jira] Created: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC works, but O_CREAT alone fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [sftp] open(2) w/ O_CREAT|O_TRUNC works, but O_CREAT alone fails ---------------------------------------------------------------- Key: SSHD-100 URL: https://issues.apache.org/jira/browse/SSHD-100 Project: MINA SSHD Issue Type: Bug Reporter: Bobby Powers Attachments: test.c Hi folks, I've mounted an sftp directory using sshfs like so: # sshfs -d -p 9022 bpowers@$SERVER_NAME:/bpowers /home/bpowers/Desktop/wintest The following sequences of commands shows the problem: root@bpowers-laptop:/home/bpowers/Desktop/wintest/test# rm -f bar root@bpowers-laptop:/home/bpowers/Desktop/wintest/test# touch bar touch: cannot touch `bar': No such file or directory root@bpowers-laptop:/home/bpowers/Desktop/wintest/test# echo "foo" > bar root@bpowers-laptop:/home/bpowers/Desktop/wintest/test# cat bar foo root@bpowers-laptop:/home/bpowers/Desktop/wintest/test# rm bar root@bpowers-laptop:/home/bpowers/Desktop/wintest/test# touch bar touch: cannot touch `bar': No such file or directory ... I've reduced it to a simple test case. Running the attached program gives me the following: root@bpowers-laptop:/home/bpowers/Desktop/wintest/test# /home/bpowers/creat_test /home/bpowers/Desktop/wintest/test/abc2: No such file or directory /home/bpowers/Desktop/wintest/test/abc3: worked. The difference is in the flags passed to open(2), and the consequence of this is that I cannot use cp or rsync to create any files over sftp (although they will update existing files). see attachment for the source of creat_test, which can be compiled with: $ gcc -o creat_test test.c and $ man 2 open for a description of the flags. Debugging output from sshfs shows the following: unique: 39, opcode: LOOKUP (1), nodeid: 1, insize: 45 LOOKUP /test getattr /test      NODEID: 2      unique: 39, success, outsize: 144 unique: 40, opcode: LOOKUP (1), nodeid: 2, insize: 45 LOOKUP /test/abc2 getattr /test/abc2      unique: 40, error: -2 (No such file or directory), outsize: 16 unique: 41, opcode: CREATE (35), nodeid: 2, insize: 61 create flags: 0x8041 /test/abc2 0100644 umask=0022      unique: 41, error: -2 (No such file or directory), outsize: 16 unique: 42, opcode: LOOKUP (1), nodeid: 2, insize: 45 LOOKUP /test/abc3 getattr /test/abc3      unique: 42, error: -2 (No such file or directory), outsize: 16 unique: 43, opcode: CREATE (35), nodeid: 2, insize: 61 create flags: 0x8241 /test/abc3 0100644 umask=0022      create[25271456] flags: 0x8241 /test/abc3 fgetattr[25271456] /test/abc3      NODEID: 4      unique: 43, success, outsize: 160 unique: 44, opcode: FLUSH (25), nodeid: 4, insize: 64 flush[25271456]      unique: 44, success, outsize: 16 unique: 45, opcode: RELEASE (18), nodeid: 4, insize: 64 release[25271456] flags: 0x8001      unique: 45, success, outsize: 16 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.