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

strip redundant trailing slashes from backup dest #333

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions rsnapshot-program.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3802,10 +3802,11 @@ sub rsync_backup_point {
# bp_ref{'dest'} and snapshot_root have already been validated, but these might be blank
if (defined($interval_link_dest) && defined($interval_num_link_dest)) {

# strip redundant trailing slashes
my $link_dest_val = "$config_vars{'snapshot_root'}/$interval_link_dest.$interval_num_link_dest/$$bp_ref{'dest'}";
$link_dest_val =~ s|/+$|/|;
# push link_dest arguments onto cmd stack
push(@rsync_long_args_stack,
"--link-dest=$config_vars{'snapshot_root'}/$interval_link_dest.$interval_num_link_dest/$$bp_ref{'dest'}"
);
push(@rsync_long_args_stack, "--link-dest=$link_dest_val");
}
}

Expand Down Expand Up @@ -3880,12 +3881,16 @@ sub rsync_backup_point {
push(@cmd_stack, "$src");
#
# dest
my $tmp_rsync_dest;
if ($interval eq 'sync') {
push(@cmd_stack, "$config_vars{'snapshot_root'}/.sync/$$bp_ref{'dest'}");
$tmp_rsync_dest = "$config_vars{'snapshot_root'}/.sync/$$bp_ref{'dest'}";
}
else {
push(@cmd_stack, "$config_vars{'snapshot_root'}/$interval.0/$$bp_ref{'dest'}");
$tmp_rsync_dest = "$config_vars{'snapshot_root'}/$interval.0/$$bp_ref{'dest'}";
}
# strip redundant trailing slashes
$tmp_rsync_dest =~ s|/+$|/|;
push(@cmd_stack, "$tmp_rsync_dest");
#
# END RSYNC COMMAND ASSEMBLY

Expand Down