X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=t%2Fecho-argv-bytes;h=66c5c6361cc122c70a8670957e04601e1b6245d9;hb=a4f58b2e4bb1a0208a9cec4b76a596d36134a881;hp=99a145ef0b9a7f8a1d30d9753887863d9c7e9d90;hpb=ed4c09941a1f9df13ea3cd6a7522327c4009c8e4;p=bup.git diff --git a/t/echo-argv-bytes b/t/echo-argv-bytes index 99a145e..66c5c63 100755 --- a/t/echo-argv-bytes +++ b/t/echo-argv-bytes @@ -1,7 +1,15 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? -exec "$bup_python" "$0" ${1+"$@"} +# 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 +bup_python="$(dirname "$0")/../lib/cmd/bup-python" || exit $? +exec "$bup_python" "$0" """ # end of bup preamble @@ -11,11 +19,11 @@ from os.path import abspath, dirname from sys import stdout import os, sys -script_home = abspath(dirname(sys.argv[0] or '.')) +script_home = abspath(dirname(__file__)) sys.path[:0] = [abspath(script_home + '/../lib'), abspath(script_home + '/..')] -from bup.compat import argv_bytes +from bup import compat -for arg in [argv_bytes(x) for x in sys.argv]: +for arg in compat.argvb: os.write(stdout.fileno(), arg) os.write(stdout.fileno(), b'\0\n')