]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/meta-cmd.py
Bypass Python 3 glibc argv problems by routing args through env
[bup.git] / lib / cmd / meta-cmd.py
index 2f30ce8ced2c1e5a255b26aa7faccfdd692ac717..e006c0bc7421b59c50bacec2d16cdf9d6e3e2384 100755 (executable)
@@ -1,7 +1,16 @@
 #!/bin/sh
 """": # -*-python-*-
+# https://sourceware.org/bugzilla/show_bug.cgi?id=26034
+export "BUP_ARGV_0"="$0"
+arg_i=1
+for arg in "$@"; do
+    export "BUP_ARGV_${arg_i}"="$arg"
+    shift
+    arg_i=$((arg_i + 1))
+done
+# Here to end of preamble replaced during install
 bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
+exec "$bup_python" "$0"
 """
 # end of bup preamble
 
@@ -14,7 +23,7 @@ exec "$bup_python" "$0" ${1+"$@"}
 
 from __future__ import absolute_import
 import sys
-from bup import metadata
+from bup import compat, metadata
 from bup import options
 from bup.compat import argv_bytes
 from bup.io import byte_stream
@@ -68,7 +77,7 @@ handle_ctrl_c()
 
 o = options.Options(optspec)
 (opt, flags, remainder) = o.parse(['--paths', '--symlinks', '--recurse']
-                                  + sys.argv[1:])
+                                  + compat.argv[1:])
 
 opt.verbose = opt.verbose or 0
 opt.quiet = opt.quiet or 0