** Changed in: rsync (Ubuntu)
       Status: New => Fix Released

** Description changed:

  [ Impact ]
  
-  * Right now, on Noble, the --delete-missing-args command fails on
-    missing directories.
+  * Right now, on Noble, the --delete-missing-args command fails on
+    missing directories.
  
-  * The bug occurs becuase --delete-missing-args uses file mode 0 as
-    a sentinel value for deleted directories. This is registered as
-    an unknown mode to a validation check in recv_file (added by
-    a security patch), which causes rsync to abort.
+  * The bug occurs becuase --delete-missing-args uses file mode 0 as
+    a sentinel value for deleted directories. This is registered as
+    an unknown mode to a validation check in recv_file (added by
+    a security patch), which causes rsync to abort.
  
-  * The fix adds an explicit check for this case, allowing mode 0
-    if (and only if) --delete-missing-args is active.
+  * The fix adds an explicit check for this case, allowing mode 0
+    if (and only if) --delete-missing-args is active.
  
  [ Test Plan ]
  
-  * Run the attached reproducer script. On the buggy version,
-    it exits 2. On the fixed version, it exits 0.
+  * Run the attached reproducer script. On the buggy version,
+    it exits 2. On the fixed version, it exits 0.
  
  [ Where problems could occur ]
  
-  * This patch alters code added in a security patch (specifically,
-    security-202605/0048). As such, there is the possibility of
-    security concerns.
+  * This patch alters code added in a security patch (specifically,
+    security-202605/0048). As such, there is the possibility of
+    security concerns.
  
-  * It is possible that other previously unseen buggy behavior surrounding 
-    --delete-missing-args and/or its choice of mode 0  may be exposed as a
-    result of this fix.
+  * It is possible that other previously unseen buggy behavior surrounding
+    --delete-missing-args and/or its choice of mode 0  may be exposed as a
+    result of this fix.
  
-  * This fix explicitly checks for the offending --delete-missing-args being
-    enabled in conjunction with the sentinel. If mode 0 legitimately appears
-    in other contexts, rsync will still fail.
+  * This fix explicitly checks for the offending --delete-missing-args being
+    enabled in conjunction with the sentinel. If mode 0 legitimately appears
+    in other contexts, rsync will still fail.
+ 
+ [ Other Info ]
+ 
+ The bug was fixed upstream in 3.4.1, which is present in Questing /
+ Resolute.
  
  [ Original Bug Text ]
  
  Summary: rsync --delete-missing-args aborts with "invalid file mode 00
  ... protocol incompatibility (code 2)" when a missing --files-from arg
  is a directory
  
  Package:
  
  ```
  apt policy rsync
  rsync:
    Installed: 3.2.7-1ubuntu1.4
    Candidate: 3.2.7-1ubuntu1.4
    Version table:
   *** 3.2.7-1ubuntu1.4 500
          500 http://azure.archive.ubuntu.com/ubuntu noble-updates/main amd64 
Packages
          500 http://azure.archive.ubuntu.com/ubuntu noble-security/main amd64 
Packages
          100 /var/lib/dpkg/status
       3.2.7-1ubuntu1 500
          500 http://azure.archive.ubuntu.com/ubuntu noble/main amd64 Packages
  ```
  
  Description:
  When a directory listed in --files-from no longer exists on the source side, 
--delete-missing-args is supposed to delete that directory on the destination. 
Instead rsync aborts during file-list processing.
  
  Steps to reproduce:
  Run the following script (also attached). Safe: runs entirely inside a fresh 
mktemp dir, no sudo, self-cleans.
  
  ```
  #!/bin/sh
  # Minimal reproduction of an rsync --delete-missing-args failure.
  #
  # When a directory listed in --files-from is missing on the source side,
  # --delete-missing-args should delete that directory on the destination.
  # Instead rsync aborts with:
  #
  #   invalid file mode 00 for <path> [Receiver]
  #   rsync error: protocol incompatibility (code 2) at flist.c(NNN)
  #
  # Safe: runs entirely inside a fresh mktemp dir, no sudo, self-cleans.
  
  rsync --version | head -1
  echo
  
  work=$(mktemp -d)
  cd "$work" || exit 1
  
  # Source and destination both start out containing dir/sub/file
  mkdir -p src/dir/sub dst/dir/sub
  echo content > src/dir/sub/file
  echo content > dst/dir/sub/file
  
  # Remove the 'sub' directory on the source side (its parent 'dir' remains)
  rm -rf src/dir/sub
  
  # Ask rsync to sync just dir/sub. It is missing on the source, so
  # --delete-missing-args should delete it on the destination.
  printf 'dir/sub\n' > list.txt
  rsync -r --delete --delete-missing-args --files-from=list.txt src/ dst/
  echo "exit code: $?"
  
  cd / && rm -rf "$work"
  ```
  
  Expected:
  rsync deletes dir/sub on the destination and exits 0.
  
  Actual:
  rsync exits 2 with:
    invalid file mode 00 for dir/sub [Receiver]
    rsync error: protocol incompatibility (code 2) at flist.c(NNN)
  
  Additional info:
  Reproduces on rsync 3.2.7 (noble). Does NOT reproduce on rsync 3.4.1 (Ubuntu 
25.04/25.10), so it appears already fixed upstream. Requesting an SRU backport 
of the fix to 24.04 LTS, since 24.04 is supported until 2029 and 
--delete-missing-args is currently unusable for missing directory args.
  
  lsb_release:
  
  ```
  lsb_release -a
  No LSB modules are available.
  Distributor ID:       Ubuntu
  Description:  Ubuntu 24.04.3 LTS
  Release:      24.04
  Codename:     noble
  ```

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2153557

Title:
  rsync --delete-missing-args aborts with "invalid file mode 00 ...
  protocol incompatibility (code 2)" when a missing --files-from arg is
  a directory

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rsync/+bug/2153557/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to