]> arthur.barton.de Git - bup.git/commitdiff
ftp: fix ls arguments for python3
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 28 Jul 2020 21:28:46 +0000 (23:28 +0200)
committerRob Browning <rlb@defaultvalue.org>
Wed, 29 Jul 2020 00:51:55 +0000 (19:51 -0500)
During the conversion to python 3, ftp ls could no longer
get option arguments, because we're now passing *bytes* to
the option parser that still expects *str*.

Fix this by fsdecode()'ing the bytes into str, which then
causes the option parsing to work properly, and the result
will be fsencode()'d again via argv_bytes() for usage.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/cmd/ftp-cmd.py

index 732082abbbbd1a49e870d10ffc8b7b1257223d14..8e05fa831d232d3021dd8a4143e8f52567c8cccf 100755 (executable)
@@ -25,7 +25,7 @@ import os, fnmatch, stat, sys
 sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
 
 from bup import _helpers, compat, options, git, shquote, ls, vfs
-from bup.compat import argv_bytes
+from bup.compat import argv_bytes, fsdecode
 from bup.helpers import chunkyreader, handle_ctrl_c, log
 from bup.io import byte_stream, path_msg
 from bup.repo import LocalRepo
@@ -39,7 +39,8 @@ class OptionError(Exception):
 
 def do_ls(repo, args, out):
     try:
-        opt = ls.opts_from_cmdline(args, onabort=OptionError)
+        opt = ls.opts_from_cmdline([fsdecode(arg) for arg in args],
+                                   onabort=OptionError)
     except OptionError as e:
         log('error: %s' % e)
         return