Bug 1447 - sftp-server rename fails when EXDEV is returned
Summary: sftp-server rename fails when EXDEV is returned
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp-server (show other bugs)
Version: 4.7p1
Hardware: All Linux
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords: patch
Depends on:
Blocks: V_5_1
  Show dependency treegraph
 
Reported: 2008-03-06 03:30 AEDT by Mike Garrison
Modified: 2008-07-22 12:21 AEST (History)
1 user (show)

See Also:


Attachments
fix rename (428 bytes, patch)
2008-03-06 03:30 AEDT, Mike Garrison
no flags Details | Diff
fix rename if EXDEV is returned (429 bytes, patch)
2008-03-06 03:32 AEDT, Mike Garrison
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Garrison 2008-03-06 03:30:22 AEDT
Created attachment 1459 [details]
fix rename

One of the complaints we've commonly gotten from users is that modern versions of OpenSSH do not allow users to rename files in AFS across directories. Since OpenAFS only allows hardlinks in the parent directory, you can rename in the same directory but not across  
directory boundaries.

This is the same behavior when you try to rename across regular partition boundaries, as a hardlink will fail with EXDEV. This patch fails over to doing a racy rename if EXDEV is returned.
Comment 1 Mike Garrison 2008-03-06 03:32:39 AEDT
Created attachment 1460 [details]
fix rename if EXDEV is returned

Helps if I make sure the patch is actually correct. Oops.
Comment 2 Mike Garrison 2008-05-30 00:53:01 AEST
Greetings,

I haven't heard anything regarding this patch. Is the patch okay? Is there something more that needs to be done?
Comment 3 Darren Tucker 2008-06-13 09:25:29 AEST
Under what circumstances does rename(2) work across filesystems?  According to the rename(2) man page on my fedora box:

  EXDEV  oldpath and newpath are not  on  the  same  mounted  filesystem.
         (Linux  permits  a  filesystem to be mounted at multiple points,
         but rename(2) does not work across different mount points,  even
         if the same filesystem is mounted on both.)
Comment 4 Mike Garrison 2008-06-19 05:17:36 AEST
(In reply to comment #3)

In OpenAFS, the ACL information is stored in the directory, which is why EXDEV is returned when you try to hardlink across directories. However, doing a rename works fine. 

Older versions (eg, 3.8) handled this fine, it was only when the if () blocks checking to see if errno was EOPNOTSUPP or LINK_OPNOTSUPP_ERRNO did this stop working.
Comment 5 Darren Tucker 2008-07-04 14:11:58 AEST
Patch applied (with an #ifdef, since not all platforms have EXDEV) and will be in 5.1.  Thanks.
Comment 6 Damien Miller 2008-07-22 12:21:29 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1