https://bugzilla.samba.org/show_bug.cgi?id=2116
Summary: rsync ignores write error
Product: rsync
Version: 2.6.3
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P3
Component: core
AssignedTo: wayned@samba.org
ReportedBy: jim@meyering.net
QAContact: rsync-qa@samba.org
rsync-2.6.3 can fail to report a write error.
Here's a demonstration, writing to a full partition:
You can reproduce it like this:
$ echo foo > in
$ strace -f -o log rsync in /full/tmp
$ grep 'write.*ENOSP' log
4787 write(1, "foo\n", 4) = -1 ENOSPC (No space left
on device)
$ rsync --version|head -n1
rsync version 2.6.3 protocol version 28
The cause seems to be this unchecked flush_write_file call:
Index: receiver.c
==================================================================RCS file:
/cvsroot/rsync/receiver.c,v
retrieving revision 1.110
diff -u -p -r1.110 receiver.c
--- receiver.c 27 Nov 2004 17:56:58 -0000 1.110
+++ receiver.c 2 Dec 2004 16:40:23 -0000
@@ -289,7 +289,8 @@ static int receive_data(int f_in, char *
offset += len;
}
- flush_write_file(fd);
+ if (flush_write_file(fd) < 0)
+ goto report_write_error;
#ifdef HAVE_FTRUNCATE
if (inplace && fd != -1)
The above patch is relative to the latest CVS sources on the trunk.
With the above knee-jerk patch, I do get the write error I want,
but also some other probably undesirable diagnostics:
$ ./rsync in /full/tmp
rsync: write failed on "/full/tmp/in": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(307)
rsync: connection unexpectedly closed (25 bytes received so far) [generator]
rsync error: error in rsync protocol data stream (code 12) at io.c(362)
rsync: connection unexpectedly closed (32 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(362)
[Exit 12]
--
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.