Does rsync need a --ignore-unreadable-files option?

Allen Supynuk allen.supynuk at gmail.com
Fri Jan 11 08:06:11 MST 2013


> [..] Rsync does
> continue after it encounters a permission denied error.  It just can't
> copy that particular file/directory but it will continue on through
> the tree.

I know it continues, but it gives a non-zero return code (23) that
indicates that errors occurred.
The error code indicates a class of errors that include much more
serious issues.
I am running this in an automated process and cannot ignore such errors.

> The reason for the second error message and the exit 23 is to inform
> you that there was a problem (if you are running with -v the rest of
> the tree can easily scroll the real error off the screen).

I understand. 'rsync' is absolutely doing the right thing in the general case
and this absolutely must be the default behavior.

> When such an error is encountered --delete will stop deleting stuff
> unless you use --ignore-errors but rsync will finish copying what it can.

Sadly, --ignore-errors is not only is too blunt of an instrument, but does not
help, It still gives return code 23:

% (cd /tmp; mkdir dest; touch foo; chmod ugo-r foo; ls -l foo; \
  rsync --ignore-errors foo dest/; \
  echo Return Code: $?; \
  ls -l foo dest/ ; rm -rf dest foo)
--w------- 1 asupynuk users 0 Jan 11 10:00 foo
rsync: send_files failed to open "/tmp/foo": Permission denied (13)
rsync error: some files/attrs were not transferred (see previous
errors) (code 23) at main.c(1060) [sender=3.0.7]
Return Code: 23
--w------- 1 asupynuk users    0 Jan 11 10:00 foo

dest/:
total 0


More information about the rsync mailing list