Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup dir with space, quoting and shell command #165

Open
shodanshok opened this issue Jan 17, 2017 · 1 comment
Open

Backup dir with space, quoting and shell command #165

shodanshok opened this issue Jan 17, 2017 · 1 comment

Comments

@shodanshok
Copy link
Contributor

shodanshok commented Jan 17, 2017

Hi all,
I would like to stress a discrepancy between the command output by rsnapshot -t and the real rsync command executed when a backup dir contain spaces. Let say I have a directory called "fileserver test".

On 1.3.1 I would put a similar line to rsnapshot.conf:
backup "root@localhost:/opt/fileserver\ test/" fileserver/
The output from rsnapshot -t daily would be:

[root@centos-webdev opt]# rsnapshot -t daily
echo 11032 > /var/run/rsnapshot.pid
/bin/rm -rf /.snapshots/daily.6/
mv /.snapshots/daily.5/ /.snapshots/daily.6/
mv /.snapshots/daily.4/ /.snapshots/daily.5/
mv /.snapshots/daily.3/ /.snapshots/daily.4/
mv /.snapshots/daily.2/ /.snapshots/daily.3/
mv /.snapshots/daily.1/ /.snapshots/daily.2/
mv /.snapshots/daily.0/ /.snapshots/daily.1/
/usr/bin/rsync -aA --delete --numeric-ids --relative --delete-excluded \
    --rsh=/usr/bin/ssh --link-dest=/.snapshots/daily.1/fileserver/ \
    "root@localhost:/opt/fileserver\ test/" /.snapshots/daily.0/fileserver/
touch /.snapshots/daily.0/

If I grab the rsync command and I execute it, it works without problem.

On 1.4.2, my rsnapshot.conf line look like this:
backup root@localhost:/opt/fileserver\ test fileserver/
The output from rsnapshot -t daily would be:

[root@centos-webdev opt]# rsnapshot -t daily
echo 11111 > /var/run/rsnapshot.pid
/bin/rm -rf /.snapshots/daily.6/
mv /.snapshots/daily.5/ /.snapshots/daily.6/
mv /.snapshots/daily.4/ /.snapshots/daily.5/
mv /.snapshots/daily.3/ /.snapshots/daily.4/
mv /.snapshots/daily.2/ /.snapshots/daily.3/
mv /.snapshots/daily.1/ /.snapshots/daily.2/
mv /.snapshots/daily.0/ /.snapshots/daily.1/
/usr/bin/rsync -aA --delete --numeric-ids --relative --delete-excluded \
    --rsh=/usr/bin/ssh --link-dest=/.snapshots/daily.1/fileserver/ \
    root@localhost:/opt/fileserver\ test/ /.snapshots/daily.0/fileserver/
touch /.snapshots/daily.0/

If I again grab the rsync command and I execute it, it obviously does not work in shell, due to missing quotes.

I completely understand and really appreciate the change to use a params array (rather than a shell) to launch rsync from rsnapshot (too much thing can go wrong with shell quoting), however right now rsnapshot -t output is confusing, as you need to re-quote it correctly to launch it from shell.

I also think that the change in backup directive format (no direct quoting needed) should be clearly stressed in the docs, as a direct update from 1.3.1 to 1.4.2 can result a not-working configuration (which is trivial to correct, by the way).

Thanks.

@jdholtz
Copy link

jdholtz commented Nov 20, 2023

I am getting a similar issue with the snapshot_root containing a space. Here are the relevant logs:

/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded --filter=-/_/mnt/backups/Spaced Directory/Backups / /mnt/backups/Spaced Directory/Backups/daily.0/localhost/
[2023-11-20T01:00:04] rsync: [sender] link_stat "/mnt/backups/Spaced Directory/Backups/Directory/Backups" failed: No such file or directory (2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants