#793684 rsnapshot incorrectly merges per-backup rsync_short_args

#793684#5
Date:
2015-07-26 15:00:05 UTC
From:
To:
Hi.

rsnapshot from Jessie incorrectly merges per-backup '+rsync_short_args=' rsync
short options. Version from Wheezy works fine.

How to reproduce:
1. Build 1.3.1-4..
    $ git clone git://anonscm.debian.org/collab-maint/rsnapshot.git
    $ git checkout debian/1.3.1-4

    $ quilt push -a
    Applying patch debian/patches/01_rsnapshot_conf.diff
    patching file rsnapshot.conf.default.in
    patching file rsnapshot-program.pl
    patching file rsnapshot-program.pl

    Applying patch debian/patches/03_pod_missing_back.diff
    patching file rsnapshot-program.pl

    Applying patch debian/patches/05_backup_pgsql.diff
    patching file utils/backup_pgsql.sh

    Applying patch debian/patches/06_fix_random_file_verify.diff
    patching file utils/random_file_verify.sh

    Applying patch debian/patches/08_manpage_hourly_to_daily.diff
    patching file rsnapshot-program.pl

    Applying patch debian/patches/09_strip_backtick.diff
    patching file rsnapshot-program.pl

    Applying patch debian/patches/10_space_destdir.diff
    patching file rsnapshot-program.pl

    Applying patch debian/patches/11_lvm_snapshots.diff
    patching file rsnapshot.conf.default.in
    Hunk #2 succeeded at 202 (offset 6 lines).
    Hunk #3 succeeded at 235 (offset 6 lines).
    patching file configure.ac

    Applying patch debian/patches/12_include_conf_with_arguments.diff
    patching file rsnapshot-program.pl

    Applying patch debian/patches/13_print_warn.diff
    patching file rsnapshot-program.pl

    Now at patch debian/patches/13_print_warn.diff

    $ ./configure
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make sets $(MAKE)... (cached) yes
    checking for a BSD-compatible install... /usr/bin/install -c
    checking for perl... /usr/bin/perl
    checking for rsync... /usr/bin/rsync
    checking for cp... /bin/cp
    checking for rm... /bin/rm
    checking for ssh... /usr/bin/ssh
    checking for logger... /usr/bin/logger
    checking for du... /usr/bin/du
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating rsnapshot
    config.status: creating rsnapshot-diff
    config.status: creating rsnapshot.conf.default
    config.status: creating t/support/etc/configtest.conf
    config.status: creating t/support/etc/rsync.conf
    config.status: creating t/support/etc/gnu_cp.conf
    config.status: creating t/support/etc/relative_delete_bugfix.conf
    config.status: creating t/configtest.t
    config.status: creating t/rsync.t
    config.status: creating t/gnu_cp.t
    config.status: creating t/relative_delete_bugfix.t

    Now type  "make test"    to run the regression test suite.
    Then type "make install" to install the program.

    After rsnapshot is installed, don't forget to copy
    /usr/local/etc/rsnapshot.conf.default to /usr/local/etc/rsnapshot.conf

    $ make
    cd . && /bin/bash /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/missing --run aclocal-1.9
    /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/missing: line 52: aclocal-1.9: command not found
    WARNING: `aclocal-1.9' is missing on your system.  You should only need it if
	     you modified `acinclude.m4' or `configure.ac'.  You might want
	     to install the `Automake' and `Perl' packages.  Grab them from
	     any GNU archive site.
     cd . && /bin/bash /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/missing --run automake-1.9 --gnu
    /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/missing: line 52: automake-1.9: command not found
    WARNING: `automake-1.9' is missing on your system.  You should only need it if
	     you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
	     You might want to install the `Automake' and `Perl' packages.
	     Grab them from any GNU archive site.
    cd . && /bin/bash /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/missing --run autoconf
    /bin/bash ./config.status --recheck
    running /bin/bash ./configure   --no-create --no-recursion
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make sets $(MAKE)... (cached) yes
    checking for perl... /usr/bin/perl
    checking for rsync... /usr/bin/rsync
    checking for cp... /bin/cp
    checking for rm... /bin/rm
    checking for ssh... /usr/bin/ssh
    checking for lvcreate... no
    checking for lvremove... no
    checking for mount... /bin/mount
    checking for umount... /bin/umount
    checking for logger... /usr/bin/logger
    checking for du... /usr/bin/du
    configure: creating ./config.status

    Now type  "make test"    to run the regression test suite.
    Then type "make install" to install the program.

    After rsnapshot is installed, don't forget to copy
    /usr/local/etc/rsnapshot.conf.default to /usr/local/etc/rsnapshot.conf

     /bin/bash ./config.status
    config.status: creating Makefile
    config.status: WARNING:  'Makefile.in' seems to ignore the --datarootdir setting
    config.status: creating rsnapshot
    config.status: creating rsnapshot-diff
    config.status: creating rsnapshot.conf.default
    config.status: creating t/support/etc/configtest.conf
    config.status: creating t/support/etc/rsync.conf
    config.status: creating t/support/etc/gnu_cp.conf
    config.status: creating t/support/etc/relative_delete_bugfix.conf
    config.status: creating t/configtest.t
    config.status: creating t/rsync.t
    config.status: creating t/gnu_cp.t
    config.status: creating t/relative_delete_bugfix.t
    /usr/bin/pod2man -c '' -n 'rsnapshot' -r '' rsnapshot > rsnapshot.1
    /usr/bin/pod2man -c '' -n 'rsnapshot-diff' -r '' rsnapshot-diff > rsnapshot-diff.1

2. Use this config:

    $ diff -u rsnapshot.conf.default ../rsn.conf
    --- rsnapshot.conf.default      2015-07-26 17:51:23.755035239 +0300
    +++ ../rsn.conf 2015-07-26 17:41:13.611405185 +0300
    @@ -24,7 +24,7 @@

     # All snapshots will be stored under this root directory.
     #
    -snapshot_root  /var/cache/rsnapshot/
    +snapshot_root  /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/

     # If no_create_root is enabled, rsnapshot will not automatically create the
     # snapshot_root directory. This is particularly useful if you are backing
    @@ -111,7 +111,7 @@
     # 4     Extra Verbose   Show extra verbose information
     # 5     Debug mode      Everything
     #
    -verbose                2
    +verbose                3

     # Same as "verbose" above, but controls the amount of data sent to the
     # logfile, if one is being used. The default is 3.
    @@ -128,7 +128,7 @@
     # If you enable this, make sure the lockfile directory is not world
     # writable. Otherwise anyone can prevent the program from running.
     #
    -lockfile       /var/run/rsnapshot.pid
    +#lockfile      /var/run/rsnapshot.pid

     # By default, rsnapshot check lockfile, check if PID is running
     # and if not, consider lockfile as stale, then start
    @@ -227,9 +227,10 @@
     ###############################

     # LOCALHOST
    -backup /home/          localhost/
    -backup /etc/           localhost/
    -backup /usr/local/     localhost/
    +#backup        /home/          localhost/
    +#backup        /etc/           localhost/
    +#backup        /usr/local/     localhost/
    +backup /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/      localhost/      +rsync_short_args=-mv
     #backup        /var/log/rsnapshot              localhost/
     #backup        /etc/passwd     localhost/
     #backup        /home/foo/My Documents/         localhost/

3. Then run.

    $ perl ./rsnapshot-program.pl -c ../rsn.conf hourly
    /bin/rm -rf /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.5/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.4/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.5/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.3/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.4/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.2/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.3/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.1/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.2/
    /bin/cp -al /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.0 \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.1
    /usr/bin/rsync -a -mv --delete --numeric-ids --relative --delete-excluded \
	--exclude=bkp /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.0/localhost/
    rsync: -a -mv: unknown option
    rsync error: syntax or usage error (code 1) at main.c(1572) [client=3.1.1]
    ----------------------------------------------------------------------------
    rsnapshot encountered an error! The program was invoked with these options:
    ./rsnapshot-program.pl -c ../rsn.conf hourly
    ----------------------------------------------------------------------------
    ERROR: /usr/bin/rsync returned 1 while processing /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/
    touch /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.0/

If i then change cmd_rsync to smth like

    cmd_rsync       /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/lspp.sh

where lspp.sh just lists its arguments:

    $ cat lspp.sh
    #!/bin/sh

    for f; do
	echo "$f"
    done

i'll get following result:

    $ perl ./rsnapshot-program.pl -c ../rsn.conf hourly
    /bin/rm -rf /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.5/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.4/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.5/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.3/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.4/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.2/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.3/
    mv /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.1/ \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.2/
    /bin/cp -al /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.0 \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.1
    /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/lspp.sh -a -mv --delete \
	--numeric-ids --relative --delete-excluded --exclude=bkp \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot \
	/home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.0/localhost/
    -a -mv
    --delete
    --numeric-ids
    --relative
    --delete-excluded
    --exclude=bkp
    /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot
    /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.0/localhost/
    touch /home/sgf/Documents/rsnapshot/src/3rd/t/rsnapshot/bkp/hourly.0/

(i.e. '-a -mv' passed as single option)

#793684#10
Date:
2019-10-24 05:45:50 UTC
From:
To:
This was reported against 1.3.1, however 1.4.2 is available in oldstable. Can
you confirm if this issue is still present? If so, would you also be able to
also check against the latest git revision (many bug fixes are not released)?

#793684#15
Date:
2020-09-28 12:59:46 UTC
From:
To:
tags 793684 upstream
thanks

This was reported in 2013 against upstream at https://github.com/rsnapshot/rsnapshot/issues/11

I can still reproduce this with 1.3.4, see also my comments which I added to the quoted report.

Not sure if this will ever be fixed.


Regards,
Stefan

#793684#20
Date:
2020-09-28 13:18:50 UTC
From:
To:
oops, typo. I had meant to say that I can reproduce this with the latest 1.4.3.
#793684#25
Date:
2021-06-12 02:25:12 UTC
From:
To: