Public bug reported:

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
```

** Affects: rsync (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "rsync_minimal_repro.sh"
   
https://bugs.launchpad.net/bugs/2153557/+attachment/5972241/+files/rsync_minimal_repro.sh

** Description changed:

  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
+   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
-   rsync --version | head -1
-   echo
-   work=$(mktemp -d)
-   cd "$work" || exit 1
-   mkdir -p src/dir/sub dst/dir/sub
-   echo content > src/dir/sub/file
-   echo content > dst/dir/sub/file
-   rm -rf src/dir/sub
-   echo "=== case A: --files-from entry WITHOUT trailing slash ==="
-   printf 'dir/sub\n' > list.txt
-   rsync -r --delete --delete-missing-args --files-from=list.txt src/ dst/
-   echo "exit code: $?"
-   echo
-   mkdir -p dst/dir/sub
-   echo content > dst/dir/sub/file
-   echo "=== case B: --files-from entry WITH trailing slash ==="
-   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"
+ ```
+ #!/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)
+   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
  ```

** Attachment removed: "rsync_minimal_repro.sh"
   
https://bugs.launchpad.net/ubuntu/+source/rsync/+bug/2153557/+attachment/5972241/+files/rsync_minimal_repro.sh

-- 
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