rsync --delete-missing-args fails with "error: protocol incompatibility"

Bug #1896251 reported by Mikko Rantalainen
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rsync (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Won't Fix
Undecided
Unassigned
Bionic
Fix Released
Low
Lena Voytek
Focal
Fix Released
Low
Lena Voytek

Bug Description

[Impact]

Rsync crashes when using --delete-missing-args on a file with a missing parent folder.

Backporting this fix will allow users to delete missing source args when some files in the list have missing parent folders without interruption.

This is fixed by patching in an upstream commit that allows files with missing parent folders to be handled without aborting.

[Test Plan]

# lxc launch images:ubuntu/focal builder
# lxc exec builder bash
# apt update
# apt dist-upgrade
# apt install -y rsync
# mkdir -p a/1 b/1; echo "/1/2/3" > list
# rsync --dry-run --stats -Pav --delete-missing-args --files-from=list a b

* This should crash with exit code 2 after printing the following:

building file list ...
 0 files...
file has vanished: "/root/a/1/2"
2 files to consider
ABORTING due to invalid path from sender: 1/2/3
rsync error: protocol incompatibility (code 2) at generator.c(1278) [generator=3.1.3]

[Where problems could occur]

Since the remove operation will now continue when files in the list have missing parent folders, other errors and warnings with different behaviors could arise instead.

A warning that may arise the most often in these situations is the following:

warning: some files vanished before they could be transferred (code 24) at main.c(1207) [sender=3.1.3]

This appears at the end of the above test case with the new code. The behavior is expected, but it may cause regressions due to changes in the output of certain use cases.

[Original Description]

Running

   rsync --delete-missing-args --files-from=...

fails with error message like

ABORTING due to invalid path from sender: dir1/dir2/dir3
rsync error: protocol incompatibility (code 2) at generator.c(1271) [generator=3.1.2]

if the listed directories are trying to delete full subtree of files.

According to https://bugzilla.samba.org/show_bug.cgi?id=12569 this has been fixed in version 3.2.2.

See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863334

Could you update the rsync package or backport the fix?

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: rsync 3.1.2-2.1ubuntu1.1
ProcVersionSignature: Ubuntu 5.4.0-47.51~18.04.1-lowlatency 5.4.55
Uname: Linux 5.4.0-47-lowlatency x86_64
ApportVersion: 2.20.9-0ubuntu7.17
Architecture: amd64
CurrentDesktop: MATE
Date: Fri Sep 18 18:27:53 2020
EcryptfsInUse: Yes
InstallationDate: Installed on 2019-01-05 (621 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: rsync
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Mikko Rantalainen (mira) wrote :
Revision history for this message
Mikko Rantalainen (mira) wrote :

I forgot to mention that according to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863334 this issue does not exist in version 3.1.1-3. That should help pinpointing the actual problem if you want to backport the fix instead of upgrading the whole rsync package to latest version.

Revision history for this message
Mikko Rantalainen (mira) wrote :

Minimal test case (run in empty directory):

  mkdir -p a/1 b/1; echo "/1/2/3" > list; rsync --delete-missing-args --files-from=list a b

Example output:

file has vanished: ".../rsync-bug/a/1/2"
ABORTING due to invalid path from sender: 1/2/3
rsync error: protocol incompatibility (code 2) at generator.c(1271) [generator=3.1.2]

Changed in rsync (Ubuntu Bionic):
status: New → Triaged
Changed in rsync (Ubuntu Focal):
status: New → Triaged
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the bug report, Mikko.

I confirmed that this bug happens on both Bionic and Focal, but doesn't happen (or at least doesn't happen in the same way) on Groovy.

Bear in mind that, when running this command using Groovy's rsync, I see:

$ rsync --delete-missing-args --files-from=list a b
file has vanished: "/tmp/rsync-bug/a/1/2"
WARNING: parent dir is absent in the file list: 1/2
default_perms_for_dir: sys_acl_get_file(1/2, ACL_TYPE_DEFAULT): No such file or directory, falling back on umask
rsync warning: some files vanished before they could be transferred (code 24) at main.c(1330) [sender=3.2.3]

This is a different error from the one reported in the bug, and I think it's worth investigating whether it is another bug, or if it's just an expected error this time.

FWIW, the patch needed to be backport in order to fix the initial bug on Bionic/Focal rsync is:

commit af6118d98b3482cbcfc223bf2a0777bc19eccb02
Author: Wayne Davison <email address hidden>
AuthorDate: Sun Apr 26 18:02:17 2020 -0700
Commit: Wayne Davison <email address hidden>
CommitDate: Sun Apr 26 18:10:40 2020 -0700

    Allow a missing parent dir when --delete-missing-args was specified.

tags: added: server-next
Changed in rsync (Ubuntu Xenial):
status: New → Triaged
tags: removed: server-next
Revision history for this message
Paride Legovini (paride) wrote :

Still a valid bug for Bionic and Focal, updating the other tasks.

Changed in rsync (Ubuntu):
status: New → Fix Released
Changed in rsync (Ubuntu Xenial):
status: Triaged → Won't Fix
Changed in rsync (Ubuntu Bionic):
importance: Undecided → Low
Changed in rsync (Ubuntu Focal):
importance: Undecided → Low
Paride Legovini (paride)
tags: added: server-todo
Lena Voytek (lvoytek)
Changed in rsync (Ubuntu Bionic):
assignee: nobody → Lena Voytek (lvoytek)
Changed in rsync (Ubuntu Focal):
assignee: nobody → Lena Voytek (lvoytek)
Lena Voytek (lvoytek)
Changed in rsync (Ubuntu Bionic):
status: Triaged → In Progress
Changed in rsync (Ubuntu Focal):
status: Triaged → In Progress
Lena Voytek (lvoytek)
description: updated
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Mikko, or anyone else affected,

Accepted rsync into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rsync/3.1.3-8ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in rsync (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Changed in rsync (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed-bionic
Revision history for this message
Steve Langasek (vorlon) wrote :

Hello Mikko, or anyone else affected,

Accepted rsync into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rsync/3.1.2-2.1ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (rsync/3.1.2-2.1ubuntu1.2)

All autopkgtests for the newly accepted rsync (3.1.2-2.1ubuntu1.2) for bionic have finished running.
The following regressions have been reported in tests triggered by the package:

lxc/3.0.3-0ubuntu1~18.04.1 (ppc64el)
s3ql/2.26+dfsg-4 (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/bionic/update_excuses.html#rsync

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (rsync/3.1.3-8ubuntu0.1)

All autopkgtests for the newly accepted rsync (3.1.3-8ubuntu0.1) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

dgit/9.10 (arm64, armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#rsync

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Lena Voytek (lvoytek) wrote :

Performing the verification for Focal:

First, reproducing the bug with the current version:

# apt policy rsync
rsync:
  Installed: 3.1.3-8
  Candidate: 3.1.3-8
  Version table:
 *** 3.1.3-8 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

# mkdir -p a/1 b/1; echo "/1/2/3" > list
# rsync --dry-run --stats -Pav --delete-missing-args --files-from=list a b

building file list ...
 0 files...
file has vanished: "/root/a/1/2"
2 files to consider
ABORTING due to invalid path from sender: 1/2/3
rsync error: protocol incompatibility (code 2) at generator.c(1278) [generator=3.1.3]

Next, updating the package to the version available in -proposed, clearing the directory, and making sure that the bug is fixed:

# apt policy rsync
rsync:
  Installed: 3.1.3-8ubuntu0.1
  Candidate: 3.1.3-8ubuntu0.1
  Version table:
 *** 3.1.3-8ubuntu0.1 500
        500 http://archive.ubuntu.com/ubuntu focal-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     3.1.3-8 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

# mkdir -p a/1 b/1; echo "/1/2/3" > list
# rsync --dry-run --stats -Pav --delete-missing-args --files-from=list a b

building file list ...
 0 files...
file has vanished: "/root/a/1/2"
2 files to consider
WARNING: parent dir is absent in the file list: 1/2

Number of files: 2 (reg: 1, dir: 1)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 0
Total file size: 0 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 59
Total bytes received: 68

sent 59 bytes received 68 bytes 254.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
rsync warning: some files vanished before they could be transferred (code 24) at main.c(1207) [sender=3.1.3]

As shown above, there is no longer a crash due to missing parent folders. Therefore, the bug has been fixed for focal and verification is complete.

tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Lena Voytek (lvoytek) wrote :

Performing the verification for Bionic:

First, reproducing the bug with the current version:

# apt policy rsync
rsync:
  Installed: 3.1.2-2.1ubuntu1.1
  Candidate: 3.1.2-2.1ubuntu1.1
  Version table:
 *** 3.1.2-2.1ubuntu1.1 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     3.1.2-2.1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

# mkdir -p a/1 b/1; echo "/1/2/3" > list
# rsync --dry-run --stats -Pav --delete-missing-args --files-from=list a b

file has vanished: "/root/a/1/2"
ABORTING due to invalid path from sender: 1/2/3
rsync error: protocol incompatibility (code 2) at generator.c(1271) [generator=3.1.2]

Next, updating the package to the version available in -proposed, clearing the directory, and making sure that the bug is fixed:

# apt policy rsync
rsync:
  Installed: 3.1.2-2.1ubuntu1.2
  Candidate: 3.1.2-2.1ubuntu1.2
  Version table:
 *** 3.1.2-2.1ubuntu1.2 500
        500 http://archive.ubuntu.com/ubuntu bionic-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     3.1.2-2.1ubuntu1.1 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     3.1.2-2.1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

# mkdir -p a/1 b/1; echo "/1/2/3" > list
# rsync --dry-run --stats -Pav --delete-missing-args --files-from=list a b

file has vanished: "/root/a/1/2"
WARNING: parent dir is absent in the file list: 1/2

Number of files: 2 (reg: 1, dir: 1)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 0
Total file size: 0 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 60
Total bytes received: 68

sent 60 bytes received 68 bytes 256.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
rsync warning: some files vanished before they could be transferred (code 24) at main.c(1196) [sender=3.1.2]

As shown above, there is no longer a crash due to missing parent folders. Therefore, the bug has been fixed for bionic and verification is complete.

tags: added: verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Chris Halse Rogers (raof) wrote : Update Released

The verification of the Stable Release Update for rsync has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rsync - 3.1.3-8ubuntu0.1

---------------
rsync (3.1.3-8ubuntu0.1) focal; urgency=medium

  * d/p/allow-missing-parent-dir-delete-missing-args.patch:
    Fix error caused by files being deleted having a missing parent
    directory. Thanks to Wayne Davison <email address hidden>.
    (LP: #1896251)

 -- Lena Voytek <email address hidden> Thu, 28 Oct 2021 09:36:35 -0700

Changed in rsync (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rsync - 3.1.2-2.1ubuntu1.2

---------------
rsync (3.1.2-2.1ubuntu1.2) bionic; urgency=medium

  * d/p/allow-missing-parent-dir-delete-missing-args.patch:
    Fix error caused by files being deleted having a missing parent
    directory. Thanks to Wayne Davison <email address hidden>.
    (LP: #1896251)

 -- Lena Voytek <email address hidden> Thu, 28 Oct 2021 09:38:50 -0700

Changed in rsync (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.