Jordan Russell
2008-May-22 19:58 UTC
"Invalid argument" error when moving sockets to backup dir
Local end (receiving): 3.0.2, 3.0.3pre2 Remote end (sending): 2.6.9 Under 3.0.x, rsync sometimes prints an "Invalid argument" error when moving sockets to the backup directory (--backup-dir): rsync: mknod "/backup/machine/../machine-before-4/var/run/audit_events" failed: Invalid argument (22) The problem appears to be that, at least with sockets, keep_backup() is calling do_mknod() with garbage in the third parameter (dev). When I add some debug output to do_mknod(): printf("mknod pathname=%s, mode=%d, dev=%llu\n", pathname, mode, dev); int mknodres = mknod(pathname, mode, dev); printf("mknod result: %d, errno=%d\n", mknodres, errno); return mknodres; 3.0.2 and 3.0.3pre2 show: mknod pathname=../machine-before-4/var/run/audit_events, mode=49645, dev=89016461384865329 mknod result: -1, errno=22 rsync: mknod "/backup/machine/../machine-before-4/var/run/audit_events" failed: Invalid argument (22) while 2.6.9 shows: mknod pathname=../machine-before-4/var/run/audit_events, mode=49645, dev=0 mknod result: -1, errno=2 mknod pathname=../machine-before-4/var/run/audit_events, mode=49645, dev=0 mknod result: 0, errno=2 and no error messages. -- Jordan Russell
Jordan Russell
2008-May-22 21:41 UTC
"Invalid argument" error when moving sockets to backup dir
Jordan Russell wrote:> Under 3.0.x, rsync sometimes prints an "Invalid argument" error when > moving sockets to the backup directory (--backup-dir):Steps to reproduce (on Fedora 9, with rsync 3.0.2 or 3.0.3pre2): 1. Create a subdirectory named "src" with 13 zero-byte files and a socket: total 8 drwxr-xr-x 2 root root 4096 May 22 16:11 . drwxr-xr-x 3 root root 4096 May 22 16:11 .. -rw-r--r-- 1 root root 0 May 22 15:50 file01 -rw-r--r-- 1 root root 0 May 22 15:50 file02 -rw-r--r-- 1 root root 0 May 22 15:51 file03 -rw-r--r-- 1 root root 0 May 22 15:51 file04 -rw-r--r-- 1 root root 0 May 22 15:52 file05 -rw-r--r-- 1 root root 0 May 22 15:52 file06 -rw-r--r-- 1 root root 0 May 22 15:53 file07 -rw-r--r-- 1 root root 0 May 22 15:53 file08 -rw-r--r-- 1 root root 0 May 22 15:53 file09 -rw-r--r-- 1 root root 0 May 22 15:53 file10 -rw-r--r-- 1 root root 0 May 22 15:54 file11 -rw-r--r-- 1 root root 0 May 22 15:54 file12 -rw-r--r-- 1 root root 0 May 22 15:58 file13 srwxr-xr-x 1 root root 0 May 20 10:19 socket 2. Initially copy "src" to "dest": # rsync -avHx --delete --backup --backup-dir=../backupdir src/ dest sending incremental file list created directory dest ./ file01 file02 file03 file04 file05 file06 file07 file08 file09 file10 file11 file12 file13 socket sent 725 bytes received 265 bytes 1980.00 bytes/sec total size is 0 speedup is 0.00 3. Move "socket" out of "src": # mv src/socket . 4. Run rsync again: # rsync -avHx --delete --backup --backup-dir=../backupdir src/ dest sending incremental file list ./ rsync: mknod "/_test/dest/../backupdir/socket" failed: Invalid argument (22) rsync: stat "/_test/dest/../backupdir/socket" failed: No such file or directory (2) deleting socket sent 187 bytes received 15 bytes 404.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files could not be transferred (code 23) at main.c(1031) [sender=3.0.2] -- Jordan Russell
Wayne Davison
2008-May-22 23:49 UTC
"Invalid argument" error when moving sockets to backup dir
On Thu, May 22, 2008 at 02:57:56PM -0500, Jordan Russell wrote:> Under 3.0.x, rsync sometimes prints an "Invalid argument" error when > moving sockets to the backup directory (--backup-dir):Thanks for pointing this out. I have checked in a fix for this into the git repository. You can see the diff by clicking on the "commitdiff" link in gitweb: http://git.samba.org/?p=rsync.git ..wayne..