From: Rob Browning Date: Mon, 27 Jan 2014 20:51:47 +0000 (-0600) Subject: save-cmd.py: disallow backup set names containing "/". X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=52a98179490c6ccb990e221bbdeb511f1de59de4;p=packages%2Fb%2Fbup.git save-cmd.py: disallow backup set names containing "/". There's no way to refer to them via the VFS, because the VFS (as expected) treats all forward slashes as path separators. Before this change, it was possible to create backup sets with names like "x/y/z" that were inaccessible via ls, restore, etc. Thanks to Laura Morrissey for the report. Signed-off-by: Rob Browning --- diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index 5031edb..bb683f5 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -67,8 +67,11 @@ is_reverse = os.environ.get('BUP_SERVER_REVERSE') if is_reverse and opt.remote: o.fatal("don't use -r in reverse mode; it's automatic") -if opt.name and opt.name.startswith('.'): - o.fatal("'%s' is not a valid branch name" % opt.name) +if opt.name: + if opt.name.startswith('.'): + o.fatal('backup set names cannot start with "."') + if '/' in opt.name: + o.fatal('backup set names cannot contain "/"') refname = opt.name and 'refs/heads/%s' % opt.name or None if opt.remote or is_reverse: cli = client.Client(opt.remote)