You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Bobby Powers (JIRA)" <ji...@apache.org> on 2010/12/04 00:34:14 UTC
[jira] Created: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC works,
but O_CREAT alone fails
[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.
[jira] Updated: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC works,
but O_CREAT alone fails
Posted by "Bobby Powers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bobby Powers updated SSHD-100:
------------------------------
Attachment: 0001-SSHD-100-create-files-when-SSH_FXF_CREAT-is-passed-t.patch
> [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: 0001-SSHD-100-create-files-when-SSH_FXF_CREAT-is-passed-t.patch, 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.
[jira] Commented: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC
works, but O_CREAT alone fails
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966740#action_12966740 ]
Guillaume Nodet commented on SSHD-100:
--------------------------------------
Do you think you could write a patch for that?
> [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.
[jira] Updated: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC works,
but O_CREAT alone fails
Posted by "Bobby Powers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bobby Powers updated SSHD-100:
------------------------------
Attachment: test.c
> [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.
[jira] Resolved: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC
works, but O_CREAT alone fails
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved SSHD-100.
----------------------------------
Resolution: Fixed
Fix Version/s: 0.6.0
Assignee: Guillaume Nodet
Committing to https://svn.apache.org/repos/asf/mina/sshd/trunk ...
M sshd-core/src/main/java/org/apache/sshd/server/SshFile.java
M sshd-core/src/main/java/org/apache/sshd/server/filesystem/NativeSshFile.java
M sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
Committed r1043378
> [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
> Assignee: Guillaume Nodet
> Fix For: 0.6.0
>
> Attachments: 0001-SSHD-100-create-files-when-SSH_FXF_CREAT-is-passed-t.patch, 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.
[jira] Commented: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC
works, but O_CREAT alone fails
Posted by "Bobby Powers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966733#action_12966733 ]
Bobby Powers commented on SSHD-100:
-----------------------------------
Jira ate the debugging output (you might want to edit this message or view source for better indentation):
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
> [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.
[jira] Commented: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC
works, but O_CREAT alone fails
Posted by "Bobby Powers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969045#action_12969045 ]
Bobby Powers commented on SSHD-100:
-----------------------------------
sshfs does (using version 3 of the protocol):
[00018] OPEN
[00019] LSTAT
[00018] HANDLE 49bytes (312083ms)
[00019] STATUS 31bytes (976315ms)
the open succeeds, because line 410 of SftpSubsyem only checks to make sure the SshFile is writable if it doesn't exist before returning a handle. The lstat fails because SftpSubsystem.writeAttrs(Buffer, SshFile, int) calls doesExist() on the SshFile immediately afterwards, finds out it doesn't exist, and throws an IOException.
I think the sensible thing to do is on OPEN, call create() on the SshFile if appropriate. Patch attached.
> [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: 0001-SSHD-100-create-files-when-SSH_FXF_CREAT-is-passed-t.patch, 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.
[jira] Commented: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC
works, but O_CREAT alone fails
Posted by "Bobby Powers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966763#action_12966763 ]
Bobby Powers commented on SSHD-100:
-----------------------------------
I'm willing to take a stab with it monday or tuesday, but since I'm completely unfamiliar with the codebase I'd appreciate any pointers you folks can give.
> [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.
[jira] Commented: (SSHD-100) [sftp] open(2) w/ O_CREAT|O_TRUNC
works, but O_CREAT alone fails
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969290#action_12969290 ]
Guillaume Nodet commented on SSHD-100:
--------------------------------------
Thankx a ton for this patch!
> [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
> Assignee: Guillaume Nodet
> Fix For: 0.6.0
>
> Attachments: 0001-SSHD-100-create-files-when-SSH_FXF_CREAT-is-passed-t.patch, 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.