From 8e1fcb7a71ffd9125d8e2779e1decb4f5bb77915 Mon Sep 17 00:00:00 2001 From: Rodrigo OSORIO Date: Sun, 22 Jun 2025 15:38:49 +0200 Subject: [PATCH 1/3] Expand xattr tests for RsyncProject/rsync#766 When a file have many xattrs that the sum of all attribute names is larger than 1024, rsync will fail. --- testsuite/xattrs.test | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/testsuite/xattrs.test b/testsuite/xattrs.test index d94d5f950..9a7499562 100644 --- a/testsuite/xattrs.test +++ b/testsuite/xattrs.test @@ -80,13 +80,14 @@ echo else >"$fromdir/file2" echo deep >"$fromdir/foo/file3" echo normal >"$fromdir/file4" echo deeper >"$fromdir/foo/bar/file5" +echo longxattrname >"$fromdir/file7" makepath "$chkdir/foo" echo wow >"$chkdir/file1" cp_touch "$fromdir/foo/file3" "$chkdir/foo" dirs='foo foo/bar' -files='file0 file1 file2 foo/file3 file4 foo/bar/file5' +files='file0 file1 file2 foo/file3 file4 foo/bar/file5 file7' uid_gid=`"$TOOLDIR/tls" "$fromdir/foo" | sed 's/^.* \([0-9][0-9]*\)\.\([0-9][0-9]*\) .*/\1:\2/'` @@ -125,6 +126,15 @@ xset user.extra 'remove me' "$chkdir/file1" xset user.foo 'old foo' "$chkdir/foo/file3" xset $RUSR.equal 'this long attribute should remain the same and not need to be transferred' "$chkdir/foo/file3" +# Generate xattr names +SEQ=`seq 1 200` +xset user."`printf -- 'A%0.s' $SEQ`" 'first xattr' file7 +xset user."`printf -- 'B%0.s' $SEQ`" 'second xattr' file7 +xset user."`printf -- 'C%0.s' $SEQ`" 'third xattr' file7 +xset user."`printf -- 'D%0.s' $SEQ`" 'another xattr' file7 +xset user."`printf -- 'E%0.s' $SEQ`" 'final xattr' file7 + + case $0 in *hlink*) ln foo/bar/file5 foo/bar/file6 || test_skipped "Can't create hardlink" From 0c36bf26f19ddcf423aaf9ef1e1892a9699b147b Mon Sep 17 00:00:00 2001 From: Rodrigo OSORIO Date: Sun, 22 Jun 2025 22:18:21 +0200 Subject: [PATCH 2/3] Skip xattr test for cygwin --- testsuite/xattrs.test | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/testsuite/xattrs.test b/testsuite/xattrs.test index 9a7499562..ba168a894 100644 --- a/testsuite/xattrs.test +++ b/testsuite/xattrs.test @@ -10,6 +10,13 @@ lnkdir="$tmpdir/lnk" $RSYNC -VV | grep '"xattrs": true' >/dev/null || test_skipped "Rsync is configured without xattr support" +CYGWIN=0 + +case "$HOST_OS" in +cygwin*) + CYGWIN=1 +esac + case "$HOST_OS" in darwin*) xset() { @@ -80,14 +87,20 @@ echo else >"$fromdir/file2" echo deep >"$fromdir/foo/file3" echo normal >"$fromdir/file4" echo deeper >"$fromdir/foo/bar/file5" -echo longxattrname >"$fromdir/file7" +if [ $CYGWIN -eq 0 ]; then + echo longxattrname >"$fromdir/file7" +fi makepath "$chkdir/foo" echo wow >"$chkdir/file1" cp_touch "$fromdir/foo/file3" "$chkdir/foo" dirs='foo foo/bar' -files='file0 file1 file2 foo/file3 file4 foo/bar/file5 file7' +files='file0 file1 file2 foo/file3 file4 foo/bar/file5' +if [ $CYGWIN -eq 0 ] +then + files="$files file7" +fi uid_gid=`"$TOOLDIR/tls" "$fromdir/foo" | sed 's/^.* \([0-9][0-9]*\)\.\([0-9][0-9]*\) .*/\1:\2/'` @@ -126,6 +139,7 @@ xset user.extra 'remove me' "$chkdir/file1" xset user.foo 'old foo' "$chkdir/foo/file3" xset $RUSR.equal 'this long attribute should remain the same and not need to be transferred' "$chkdir/foo/file3" +if [ $CYGWIN -eq 0 ] ; then # Generate xattr names SEQ=`seq 1 200` xset user."`printf -- 'A%0.s' $SEQ`" 'first xattr' file7 @@ -133,7 +147,7 @@ xset user."`printf -- 'B%0.s' $SEQ`" 'second xattr' file7 xset user."`printf -- 'C%0.s' $SEQ`" 'third xattr' file7 xset user."`printf -- 'D%0.s' $SEQ`" 'another xattr' file7 xset user."`printf -- 'E%0.s' $SEQ`" 'final xattr' file7 - +fi case $0 in *hlink*) From 7a12971fe8cac88cd1ddc14027000307cda8e694 Mon Sep 17 00:00:00 2001 From: Rodrigo OSORIO Date: Sat, 28 Jun 2025 20:36:05 +0200 Subject: [PATCH 3/3] Extend testsuite/xattrs.test First pach to extend xattr buffer makes rsync fail when copy files without xattr such as fifo. Extend the test to ensure new patch work as expected Use checktee instead of checkit because gnu diff fails comparing fifos. --- testsuite/xattrs.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/xattrs.test b/testsuite/xattrs.test index ba168a894..772510d39 100644 --- a/testsuite/xattrs.test +++ b/testsuite/xattrs.test @@ -259,5 +259,10 @@ checkit "$RSYNC -aiiX $XFILT . ../to" "$chkdir" "$todir" cd "$todir" xls file1 file2 | diff $diffopt "$scratchdir/xattrs.txt" - +cd "$fromdir" +rm -rf "$todir" +mkfifo fifo1 +checktee "$RSYNC -avX --specials $XFILT $dashH --super . '$chkdir/'" "$fromdir" "$chkdir" + # The script would have aborted on error, so getting here means we've won. exit 0