#1064836 rsync: Escape code %P treated literally in --out-format spec

Package:
rsync
Source:
rsync
Description:
fast, versatile, remote (and local) file-copying tool
Submitter:
Date:
2024-02-26 13:18:06 UTC
Severity:
normal
#1064836#5
Date:
2024-02-26 13:16:10 UTC
From:
To:
The following simplified command was used to backup a whole drive:

  $ rsync -vahHAXS --out-format='%i %n%L %P' --delete --relative --numeric-ids --prune-empty-dirs --dry-run\
    --exclude '/proc/'\
    --exclude '/dev/'\
    --exclude '/sys/'\
    --exclude '/run/'\
    --exclude '/mnt/'\
    --exclude '/tmp/'\
    / /mnt/backup/

The --out-format supplied above is essentially the same as the -i
option but with “ %P” appended, which is documented in the rsyncd.conf
manpage as follows:

  %P the module path

This term “module” is non-intuitive and the first occurance of the
word in the rsync manpage is unexplained (which should be fixed.. the
first use of a term like that should be explained on the spot). It’s
explained further down on the manpage. In any case, I just wanted to
see what %P would show because there seems to be no mechanism to print
the filename on the *receiving* destination side (%f is the long form
of the sender side, and %n is a short form [apparently on the sender
side though this is not specified and thus should be clarified]). I
ultimately need to troubleshoot a problem of files being dumped one
directory level higher than expected on the receiving side. The output
looks like this:

===8<----------------------------------------
…
…
===8<----------------------------------------

So %P is being printed literally.

In summary, these are the bugs:

  * --out-format='%i %n%L %P' results in %P being printed literally.
  * “module” is mentioned on the rsync man page before it’s defined.
  * %n on the rsyncd.conf manpage omits sender/receiver.
  * Neither manpage states how to print the full *receiving* side filename.