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

Handle spaces in tarball blacklist #117

Open
wants to merge 1 commit into
base: devel
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
11 changes: 7 additions & 4 deletions lib/backup-methods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,26 @@ function __get_flags_relative_blacklist()
for pattern in $BM_TARBALL_BLACKLIST
do
# absolute paths
char=$(expr substr $pattern 1 1)
char=$(expr substr "$pattern" 1 1)
if [[ "$char" = "/" ]]; then

# we blacklist only absolute paths related to $target
if [[ "${pattern#$target}" != "$pattern" ]]; then

# making a relative path...
pattern="${pattern#$target}"
length=$(expr length $pattern)
length=$(expr length "$pattern")
# for $target="/", no spare / is left at the beggining
# after the # substitution; thus take substr from pos 1
if [ "$target" != "/" ]; then
pattern=$(expr substr $pattern 2 $length)
pattern=$(expr substr "$pattern" 2 $length)
else
pattern=$(expr substr $pattern 1 $length)
pattern=$(expr substr "$pattern" 1 $length)
fi

# Replace ' ' with '?' to make command line be parsed properly
pattern=${pattern// /?}

# ...and blacklisting it
blacklist="$blacklist ${switch}${pattern}"
fi
Expand Down