From: Rob Browning Date: Sun, 12 Aug 2012 23:18:26 +0000 (-0500) Subject: Disallow empty graft points. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=4e2fe4155f143da5f5c962ffa6378dea8fc33b66;p=packages%2Fb%2Fbup.git Disallow empty graft points. Signed-off-by: Rob Browning Reviewed-by: Zoran Zaric --- diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index 2f7f950..53377d7 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -58,8 +58,10 @@ if opt.graft: splitted_parameter = parameter.split('=') if len(splitted_parameter) != 2: o.fatal("a graft point must be of the form old_path=new_path") - graft_points.append((realpath(splitted_parameter[0]), - realpath(splitted_parameter[1]))) + old_path, new_path = splitted_parameter + if not (old_path and new_path): + o.fatal("a graft point cannot be empty") + graft_points.append((realpath(old_path), realpath(new_path))) is_reverse = os.environ.get('BUP_SERVER_REVERSE') if is_reverse and opt.remote: diff --git a/t/test.sh b/t/test.sh index 8d0ffac..b56a06c 100755 --- a/t/test.sh +++ b/t/test.sh @@ -392,6 +392,8 @@ WVPASS bup random 128k >$D/b mkdir $D/d $D/d/e WVPASS bup random 512 >$D/f WVPASS bup index -ux $D +WVFAIL bup save --graft =/grafted -n graft-point-absolute $D +WVFAIL bup save --graft $TOP/$D= -n graft-point-absolute $D bup save --graft $TOP/$D=/grafted -n graft-point-absolute $D WVPASSEQ "$(bup ls graft-point-absolute/latest/grafted/)" "a b