Rename and hard links

0 votes
asked Mar 19, 2012 by sarevok (250 points)
edited Jun 11, 2012

Hello!

We have developed some specific FUSE-based file system which we want to present using your SFTP library. The problem is the fact that we can not implement hard links in our file system. I found that Rename method from Sftp class requires hard links and does not work with our file system. In the SFTP library we were using previously there was a different implementation of rename method which was working with our file system without problems.

Is it possible for you to add alternate implementation of rename which does not need hard links?

Applies to: Rebex SFTP

2 Answers

0 votes
answered Mar 19, 2012 by Lukas Pokorny (124,570 points)
edited Mar 21, 2012

Hello,

Rebex SFTP implementes the client side of SFTP/SSH protocols and Sftp object's Rename method simply sends an SSH_FXP_RENAME command to the server and waits for response, as defined by the SFTP protocol. The SSH_FXP_RENAME command itself has 3 arguments - request ID, oldpath and newpath. This means that Rebex SFTP doesn't utilize or require any hard links. However, those are actually used by many SFTP servers such as OpenSSH that implement SSH_FXP_RENAME as defined by the protocol - see this and this. There is a protocol extension method in OpenSSH 4.8 (and later) called "posix-rename@openssh.com" that performs POSIX atomic rename(). This seems to be exactly what you need. We will look into the possibility of adding support for this (should be rather simple) and let you know!

commented Mar 20, 2012 by sarevok (250 points)
edited Mar 20, 2012

It is exactly as you wrote. We need a SFTP library which can call POSIX rename method. If you could implement it, then your library will offer all the functionality which we need. Maybe except the xattr implementation, but we are not sure if we really need it.

commented Mar 21, 2012 by Lukas Pokorny (124,570 points)
edited Mar 21, 2012

I just sent you a link to the current build with POSIX rename support, please give it a try. This feature will be added to the next release of Rebex SFTP.

+2 votes
answered Jun 11, 2012 by Jan Sotola (17,670 points)
edited Jun 11, 2012

Since Version 2012 R2, the Rebex SFTP component supports the POSIX rename ('posix-rename@openssh.com' extension).

Set the new SftpSettings.UsePosixRename property to true to enable this feature in your application.

...