Bug 7424 - Extend -x to make use of information in /proc/mounts (when available)
Extend -x to make use of information in /proc/mounts (when available)
Status: ASSIGNED
Product: rsync
Classification: Unclassified
Component: core
3.1.0
x64 Linux
: P3 enhancement
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-12 14:30 UTC by dotCOMmie
Modified: 2011-07-04 23:30 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dotCOMmie 2010-05-12 14:30:32 UTC
When rsyncing a directory with a sshfs mount point causes rsync to exit with code 23. If sshfs is mounted as unprivileged user and rsync is started as the same user then there are no problems. However if rsync is run as root it gets a Permission denied while reading mount point. In an attempt to force rsync to skip this mount used -x option but did not help.

Not quite sure if this is a problem of sshfs/fuse or rsync.

/tmp/rsyncTest$ mkdir source
/tmp/rsyncTest$ echo "hello World" >> source/1
/tmp/rsyncTest$ mkdir source/sshfsMount
/tmp/rsyncTest$ sshfs anotherMachine:/some/dir source/sshfsMount/
/tmp/rsyncTest$ su -
/tmp/rsyncTest# cd /tmp/rsyncTest
/tmp/rsyncTest# rsync -avz source destination
sending incremental file list
rsync: readlink_stat("/tmp/rsyncTest/source/sshfsMount") failed: Permission denied (13)
created directory destination
source/
source/1

sent 131 bytes  received 35 bytes  332.00 bytes/sec
total size is 12  speedup is 0.07
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1060) [sender=3.0.7]
/tmp/rsyncTest# echo $?
23
/tmp/rsyncTest# rsync -avzx source destination
sending incremental file list
rsync: readlink_stat("/tmp/rsyncTest/source/sshfsMount") failed: Permission denied (13)

sent 76 bytes  received 13 bytes  178.00 bytes/sec
total size is 12  speedup is 0.13
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1060) [sender=3.0.7]
/tmp/rsyncTest# echo $?
23
$ rsync --version
rsync  version 3.0.7  protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.
Comment 1 roland 2010-08-22 05:58:56 UTC
did you try "--ignore-errors" or "--force" to check if this makes a difference ?

be warned that this may be dangerous becaus because of this option files on the receiving side may be deleted.

-x should not help here, you should better have a look at --exclude  and also google for ' +rsync +"failed: Permissiondenied" ' as this happens with other fuse filesystems. see http://forum.ubuntuusers.de/topic/rsync-hat-problem-mit-.gvfs-verzeichnis/?highlight=mod#post-1419788 for example
Comment 2 Kevin Korb 2011-02-28 18:43:04 UTC
Perhaps you want the allow_other mount option on the sshfs mount point?  Otherwise sshfs/fuse will not allow other users on the system to access the data in the mount regardless of permissions.  This is important because sshfs/fuse doesn't support file ownership/group/permissions in the traditional UNIX style.
Comment 3 Wayne Davison 2011-07-04 23:30:54 UTC
Rsync has to stat a directory in order to be able to discover that it is on a different device.  If a user is unable to stat the directory (which, as Kevin indicates, is not possible if the fuse mount is only allowing one user to stat the dir), then you'll see the stat error.  Your only option is to exclude the directory.

See the support/mnt-excl script for a way to generate a list of mount-point exclusions relative to a given source directory.

Perhaps rsync should be extended to try to gather absolute mount-point information via something like /proc/mounts (when -x is used) which would allow it to use a combination of a list of mounts and the checking of mount-point device numbers when deciding if a directory is a mount point or not.  I'll transform this bug into an enhancement request for that.