]> arthur.barton.de Git - bup.git/commitdiff
Disallow empty graft points.
authorRob Browning <rlb@defaultvalue.org>
Sun, 12 Aug 2012 23:18:26 +0000 (18:18 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 22 Dec 2012 19:58:54 +0000 (13:58 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
cmd/save-cmd.py
t/test.sh

index 2f7f950748b2e4b0aed8d6a33e29b438e276e71a..53377d75effd295bb6c7d0492b654d291d362ce0 100755 (executable)
@@ -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:
index 8d0ffac9fd6d05bb0b7b320708d6f7770b36f23e..b56a06c1c77551ac40a38e99783fc541384a76ed 100755 (executable)
--- 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