Until/unless https://sourceware.org/bugzilla/show_bug.cgi?id=26034 is
resolved by Python or GNU libc, sidestep the problem, which can crash
Python 3 during initialization, with a trivial sh wrapper that diverts
the command line arguments into BUP_ARGV_{0,1,2,...} environment
variables, since those can be safely retrieved.
Add compat.argvb and compat.argv and populate them at startup with the
BUP_ARGV_* values. Adjust all the relevant commands to rely on those
vars instead of sys.argv.
Although the preamble say "rewritten during install", that's not in
place yet, but will be soon (when we drop LC_CTYPE and rework
bup-python).
Thanks to Johannes Berg for suggesting this, and help figuring out the
details.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
43 files changed:
+argv = None
+argvb = None
+
+def _configure_argv():
+ global argv, argvb
+ assert not argv
+ assert not argvb
+ if len(sys.argv) > 1:
+ if environ.get(b'BUP_ARGV_0'):
+ print('error: BUP_ARGV* set and sys.argv not empty', file=sys.stderr)
+ sys.exit(2)
+ argv = sys.argv
+ argvb = [argv_bytes(x) for x in argv]
+ return
+ args = []
+ i = 0
+ arg = environ.get(b'BUP_ARGV_%d' % i)
+ while arg is not None:
+ args.append(arg)
+ i += 1
+ arg = environ.get(b'BUP_ARGV_%d' % i)
+ i -= 1
+ while i >= 0:
+ del environ[b'BUP_ARGV_%d' % i]
+ i -= 1
+ argvb = args
+ # System encoding?
+ if py3:
+ argv = [x.decode(errors='surrogateescape') for x in args]
+ else:
+ argv = argvb
+
+_configure_argv()
+
+
def restore_lc_env():
# Once we're up and running with iso-8859-1, undo the bup-python
# LC_CTYPE hackery, so we don't affect unrelated subprocesses.
def restore_lc_env():
# Once we're up and running with iso-8859-1, undo the bup-python
# LC_CTYPE hackery, so we don't affect unrelated subprocesses.
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import glob, os, sys, tempfile
"""
# end of bup preamble
from __future__ import absolute_import
import glob, os, sys, tempfile
-from bup import options, git, bloom
+from bup import compat, options, git, bloom
from bup.compat import argv_bytes, hexstr
from bup.helpers import (add_error, debug1, handle_ctrl_c, log, progress, qprogress,
saved_errors)
from bup.compat import argv_bytes, hexstr
from bup.helpers import (add_error, debug1, handle_ctrl_c, log, progress, qprogress,
saved_errors)
handle_ctrl_c()
o = options.Options(optspec)
handle_ctrl_c()
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if extra:
o.fatal('no positional parameters expected')
if extra:
o.fatal('no positional parameters expected')
-"""": # -*-python-*- # -*-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
+# Find our directory
top="$(pwd)"
cmdpath="$0"
# loop because macos doesn't have recursive readlink/realpath utils
top="$(pwd)"
cmdpath="$0"
# loop because macos doesn't have recursive readlink/realpath utils
done
script_home="$(cd "$(dirname "$cmdpath")" && pwd -P)"
cd "$top"
done
script_home="$(cd "$(dirname "$cmdpath")" && pwd -P)"
cd "$top"
-exec "$script_home/bup-python" "$0" ${1+"$@"}
+exec "$script_home/bup-python" "$0"
"""
# end of bup preamble
"""
# end of bup preamble
log("\n%s\n" % msg)
sys.exit(99)
log("\n%s\n" % msg)
sys.exit(99)
+argv = compat.argv
+if len(argv) < 2:
usage()
# Handle global options.
try:
optspec = ['help', 'version', 'debug', 'profile', 'bup-dir=']
usage()
# Handle global options.
try:
optspec = ['help', 'version', 'debug', 'profile', 'bup-dir=']
- global_args, subcmd = getopt.getopt(sys.argv[1:], '?VDd:', optspec)
+ global_args, subcmd = getopt.getopt(argv[1:], '?VDd:', optspec)
except getopt.GetoptError as ex:
usage('error: %s' % ex.msg)
except getopt.GetoptError as ex:
usage('error: %s' % ex.msg)
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import re, stat, sys
"""
# end of bup preamble
from __future__ import absolute_import
import re, stat, sys
-from bup import options, git, vfs
+from bup import compat, options, git, vfs
from bup.compat import argv_bytes
from bup.helpers import chunkyreader, handle_ctrl_c, log, saved_errors
from bup.io import byte_stream
from bup.compat import argv_bytes
from bup.helpers import chunkyreader, handle_ctrl_c, log, saved_errors
from bup.io import byte_stream
handle_ctrl_c()
o = options.Options(optspec)
handle_ctrl_c()
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys, getopt, socket, subprocess, fcntl
"""
# end of bup preamble
from __future__ import absolute_import
import sys, getopt, socket, subprocess, fcntl
-from bup import options, path
+
+from bup import compat, options, path
from bup.helpers import *
optspec = """
from bup.helpers import *
optspec = """
p,port port to listen on, defaults to 1982
"""
o = options.Options(optspec, optfunc=getopt.getopt)
p,port port to listen on, defaults to 1982
"""
o = options.Options(optspec, optfunc=getopt.getopt)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
host = opt.listen
port = opt.port and int(opt.port) or 1982
host = opt.listen
port = opt.port and int(opt.port) or 1982
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys, os, random
"""
# end of bup preamble
from __future__ import absolute_import
import sys, os, random
+from bup import compat, options
from bup.compat import argv_bytes, bytes_from_uint, range
from bup.helpers import log
from bup.io import path_msg
from bup.compat import argv_bytes, bytes_from_uint, range
from bup.helpers import log
from bup.io import path_msg
S,seed= random number seed (for repeatable tests)
"""
o = options.Options(optspec)
S,seed= random number seed (for repeatable tests)
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if not extra:
o.fatal('filenames expected')
if not extra:
o.fatal('filenames expected')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from os.path import relpath
import sys
from os.path import relpath
import sys
-from bup import options, drecurse
+from bup import compat, options, drecurse
from bup.compat import argv_bytes
from bup.helpers import log, parse_excludes, parse_rx_excludes, saved_errors
from bup.io import byte_stream
from bup.compat import argv_bytes
from bup.helpers import log, parse_excludes, parse_rx_excludes, saved_errors
from bup.io import byte_stream
profile run under the python profiler
"""
o = options.Options(optspec)
profile run under the python profiler
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if len(extra) != 1:
o.fatal("exactly one filename expected")
if len(extra) != 1:
o.fatal("exactly one filename expected")
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from tempfile import mkdtemp
from binascii import hexlify
from tempfile import mkdtemp
from binascii import hexlify
-from bup import options, git
+from bup import compat, options, git
from bup.compat import argv_bytes
from bup.helpers import Sha1, chunkyreader, istty2, log, progress
from bup.io import byte_stream
from bup.compat import argv_bytes
from bup.helpers import Sha1, chunkyreader, istty2, log, progress
from bup.io import byte_stream
disable-par2 ignore par2 even if it is available
"""
o = options.Options(optspec)
disable-par2 ignore par2 even if it is available
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
opt.verbose = opt.verbose or 0
par2_setup()
opt.verbose = opt.verbose or 0
par2_setup()
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from __future__ import absolute_import, print_function
import sys, os, stat, fnmatch
from __future__ import absolute_import, print_function
import sys, os, stat, fnmatch
-from bup import _helpers, options, git, shquote, ls, vfs
+from bup import _helpers, compat, options, git, shquote, ls, vfs
from bup.compat import argv_bytes
from bup.helpers import chunkyreader, handle_ctrl_c, log
from bup.io import byte_stream, path_msg
from bup.compat import argv_bytes
from bup.helpers import chunkyreader, handle_ctrl_c, log
from bup.io import byte_stream, path_msg
bup ftp [commands...]
"""
o = options.Options(optspec)
bup ftp [commands...]
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
file=sys.stderr)
sys.exit(2)
file=sys.stderr)
sys.exit(2)
-from bup import options, git, vfs, xstat
+from bup import compat, options, git, vfs, xstat
from bup.compat import argv_bytes, fsdecode, py_maj
from bup.helpers import log
from bup.repo import LocalRepo
from bup.compat import argv_bytes, fsdecode, py_maj
from bup.helpers import log
from bup.repo import LocalRepo
v,verbose increase log output (can be used more than once)
"""
o = options.Options(optspec)
v,verbose increase log output (can be used more than once)
"""
o = options.Options(optspec)
-opt, flags, extra = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if not opt.verbose:
opt.verbose = 0
if not opt.verbose:
opt.verbose = 0
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys
"""
# end of bup preamble
from __future__ import absolute_import
import sys
-from bup import git, options
+from bup import compat, git, options
from bup.gc import bup_gc
from bup.helpers import die_if_errors, handle_ctrl_c, log
from bup.gc import bup_gc
from bup.helpers import die_if_errors, handle_ctrl_c, log
handle_ctrl_c()
o = options.Options(optspec)
handle_ctrl_c()
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if not opt.unsafe:
o.fatal('refusing to run dangerous, experimental command without --unsafe')
if not opt.unsafe:
o.fatal('refusing to run dangerous, experimental command without --unsafe')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from functools import partial
from stat import S_ISDIR
from functools import partial
from stat import S_ISDIR
-from bup import git, client, helpers, vfs
+from bup import compat, git, client, helpers, vfs
from bup.compat import argv_bytes, environ, hexstr, items, wrap_main
from bup.git import get_cat_data, parse_commit, walk_object
from bup.helpers import add_error, debug1, handle_ctrl_c, log, saved_errors
from bup.compat import argv_bytes, environ, hexstr, items, wrap_main
from bup.git import get_cat_data, parse_commit, walk_object
from bup.helpers import add_error, debug1, handle_ctrl_c, log, saved_errors
if item.src.type == 'tree':
get_random_item(item.spec.src, src_oidx, src_repo, writer, opt)
parent = item.dest.hash
if item.src.type == 'tree':
get_random_item(item.spec.src, src_oidx, src_repo, writer, opt)
parent = item.dest.hash
- msg = b'bup save\n\nGenerated by command:\n%r\n' % sys.argv
+ msg = b'bup save\n\nGenerated by command:\n%r\n' % compat.argvb
userline = b'%s <%s@%s>' % (userfullname(), username(), hostname())
now = time.time()
commit = writer.new_commit(item.src.hash, parent,
userline = b'%s <%s@%s>' % (userfullname(), username(), hostname())
now = time.time()
commit = writer.new_commit(item.src.hash, parent,
def main():
handle_ctrl_c()
is_reverse = environ.get(b'BUP_SERVER_REVERSE')
def main():
handle_ctrl_c()
is_reverse = environ.get(b'BUP_SERVER_REVERSE')
- opt = parse_args(sys.argv)
+ opt = parse_args(compat.argv)
git.check_repo_or_die()
if opt.source:
opt.source = argv_bytes(opt.source)
git.check_repo_or_die()
if opt.source:
opt.source = argv_bytes(opt.source)
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys, os, glob
"""
# end of bup preamble
from __future__ import absolute_import
import sys, os, glob
-from bup import options, path
+from bup import compat, options, path
optspec = """
bup help <command>
"""
o = options.Options(optspec)
optspec = """
bup help <command>
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if len(extra) == 0:
# the wrapper program provides the default usage string
if len(extra) == 0:
# the wrapper program provides the default usage string
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
import sys
import tempfile
import sys
import tempfile
-from bup import git, helpers, options
+from bup import compat, git, helpers, options
from bup.compat import argv_bytes, str_type
from bup.helpers import (handle_ctrl_c,
log,
from bup.compat import argv_bytes, str_type
from bup.helpers import (handle_ctrl_c,
log,
log('\nbup: import-duplicity is EXPERIMENTAL (proceed with caution)\n\n')
o = options.Options(optspec)
log('\nbup: import-duplicity is EXPERIMENTAL (proceed with caution)\n\n')
o = options.Options(optspec)
-opt, flags, extra = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if len(extra) < 1 or not extra[0]:
o.fatal('duplicity source URL required')
if len(extra) < 1 or not extra[0]:
o.fatal('duplicity source URL required')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from binascii import hexlify
import sys, stat, time, os, errno, re
from binascii import hexlify
import sys, stat, time, os, errno, re
-from bup import metadata, options, git, index, drecurse, hlinkdb
+from bup import compat, metadata, options, git, index, drecurse, hlinkdb
from bup.compat import argv_bytes
from bup.drecurse import recursive_dirlist
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
from bup.compat import argv_bytes
from bup.drecurse import recursive_dirlist
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
x,xdev,one-file-system don't cross filesystem boundaries
"""
o = options.Options(optspec)
x,xdev,one-file-system don't cross filesystem boundaries
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if not (opt.modified or \
opt['print'] or \
if not (opt.modified or \
opt['print'] or \
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys
"""
# end of bup preamble
from __future__ import absolute_import
import sys
-from bup import git, options, client
+from bup import compat, git, options, client
from bup.helpers import log, saved_errors
from bup.compat import argv_bytes
from bup.helpers import log, saved_errors
from bup.compat import argv_bytes
r,remote= remote repository path
"""
o = options.Options(optspec)
r,remote= remote repository path
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if extra:
o.fatal("no arguments expected")
if extra:
o.fatal("no arguments expected")
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys
"""
# end of bup preamble
from __future__ import absolute_import
import sys
-from bup import git, options
+from bup import compat, git, options
from bup.compat import argv_bytes
from bup.helpers import linereader, log
from bup.io import byte_stream
from bup.compat import argv_bytes
from bup.helpers import linereader, log
from bup.io import byte_stream
o= output filename
"""
o = options.Options(optspec)
o= output filename
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if opt.remote:
opt.remote = argv_bytes(opt.remote)
if opt.remote:
opt.remote = argv_bytes(opt.remote)
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from binascii import hexlify, unhexlify
import sys, os
from binascii import hexlify, unhexlify
import sys, os
-from bup import git, options
+from bup import compat, git, options
from bup.compat import argv_bytes
from bup.helpers import add_error, handle_ctrl_c, log, qprogress, saved_errors
from bup.io import byte_stream
from bup.compat import argv_bytes
from bup.helpers import add_error, handle_ctrl_c, log, qprogress, saved_errors
from bup.io import byte_stream
find= display only objects that start with <prefix>
"""
o = options.Options(optspec)
find= display only objects that start with <prefix>
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys
"""
# end of bup preamble
from __future__ import absolute_import
import sys
+from bup import compat, git, ls
from bup.io import byte_stream
from bup.io import byte_stream
sys.stdout.flush()
out = byte_stream(sys.stdout)
# Check out lib/bup/ls.py for the opt spec
sys.stdout.flush()
out = byte_stream(sys.stdout)
# Check out lib/bup/ls.py for the opt spec
-rc = ls.via_cmdline(sys.argv[1:], out=out)
+rc = ls.via_cmdline(compat.argv[1:], out=out)
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys, struct, math
"""
# end of bup preamble
from __future__ import absolute_import
import sys, struct, math
-from bup import options, git, _helpers
+from bup import compat, options, git, _helpers
from bup.helpers import log
from bup.io import byte_stream
from bup.helpers import log
from bup.io import byte_stream
ignore-midx Don't use midx files; use only plain pack idx files.
"""
o = options.Options(optspec)
ignore-midx Don't use midx files; use only plain pack idx files.
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if extra:
o.fatal("no arguments expected")
if extra:
o.fatal("no arguments expected")
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import, print_function
import sys, re, struct, time, resource
"""
# end of bup preamble
from __future__ import absolute_import, print_function
import sys, re, struct, time, resource
-from bup import git, bloom, midx, options, _helpers
+from bup import compat, git, bloom, midx, options, _helpers
from bup.compat import range
from bup.helpers import handle_ctrl_c
from bup.io import byte_stream
from bup.compat import range
from bup.helpers import handle_ctrl_c
from bup.io import byte_stream
existing test with existing objects instead of fake ones
"""
o = options.Options(optspec)
existing test with existing objects instead of fake ones
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if extra:
o.fatal('no arguments expected')
if extra:
o.fatal('no arguments expected')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from __future__ import absolute_import
import sys
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
from bup import options
from bup.compat import argv_bytes
from bup.io import byte_stream
o = options.Options(optspec)
(opt, flags, remainder) = o.parse(['--paths', '--symlinks', '--recurse']
o = options.Options(optspec)
(opt, flags, remainder) = o.parse(['--paths', '--symlinks', '--recurse']
opt.verbose = opt.verbose or 0
opt.quiet = opt.quiet or 0
opt.verbose = opt.verbose or 0
opt.quiet = opt.quiet or 0
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from binascii import hexlify
import glob, math, os, resource, struct, sys, tempfile
from binascii import hexlify
import glob, math, os, resource, struct, sys, tempfile
-from bup import options, git, midx, _helpers, xstat
+from bup import compat, options, git, midx, _helpers, xstat
from bup.compat import argv_bytes, hexstr, range
from bup.helpers import (Sha1, add_error, atomically_replaced_file, debug1, fdatasync,
handle_ctrl_c, log, mmap_readwrite, qprogress,
from bup.compat import argv_bytes, hexstr, range
from bup.helpers import (Sha1, add_error, atomically_replaced_file, debug1, fdatasync,
handle_ctrl_c, log, mmap_readwrite, qprogress,
handle_ctrl_c()
o = options.Options(optspec)
handle_ctrl_c()
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
opt.dir = argv_bytes(opt.dir) if opt.dir else None
opt.output = argv_bytes(opt.output) if opt.output else None
opt.dir = argv_bytes(opt.dir) if opt.dir else None
opt.output = argv_bytes(opt.output) if opt.output else None
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import os, sys, subprocess, struct
"""
# end of bup preamble
from __future__ import absolute_import
import os, sys, subprocess, struct
+from bup import compat, options
from bup.helpers import debug1, debug2, mux
from bup.io import byte_stream
from bup.helpers import debug1, debug2, mux
from bup.io import byte_stream
--
"""
o = options.Options(optspec)
--
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if len(extra) < 1:
o.fatal('command is required')
if len(extra) < 1:
o.fatal('command is required')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys, os, struct
"""
# end of bup preamble
from __future__ import absolute_import
import sys, os, struct
-from bup import options, helpers, path
+from bup import compat, options, helpers, path
from bup.compat import environ, py_maj
from bup.io import byte_stream
from bup.compat import environ, py_maj
from bup.io import byte_stream
This command is run automatically by 'bup on'
"""
o = options.Options(optspec)
This command is run automatically by 'bup on'
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if extra:
o.fatal('no arguments expected')
if extra:
o.fatal('no arguments expected')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from subprocess import PIPE
import sys, os, struct, getopt, subprocess, signal
from subprocess import PIPE
import sys, os, struct, getopt, subprocess, signal
-from bup import options, ssh, path
+from bup import compat, options, ssh, path
from bup.compat import argv_bytes
from bup.helpers import DemuxConn, log
from bup.io import byte_stream
from bup.compat import argv_bytes
from bup.helpers import DemuxConn, log
from bup.io import byte_stream
bup on <hostname> get ...
"""
o = options.Options(optspec, optfunc=getopt.getopt)
bup on <hostname> get ...
"""
o = options.Options(optspec, optfunc=getopt.getopt)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if len(extra) < 2:
o.fatal('arguments expected')
if len(extra) < 2:
o.fatal('arguments expected')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from time import localtime, strftime, time
import re, sys
from time import localtime, strftime, time
import re, sys
-from bup import git, options
+from bup import compat, git, options
from bup.compat import argv_bytes, int_types
from bup.gc import bup_gc
from bup.helpers import die_if_errors, log, partition, period_as_secs
from bup.compat import argv_bytes, int_types
from bup.gc import bup_gc
from bup.helpers import die_if_errors, log, partition, period_as_secs
"""
o = options.Options(optspec)
"""
o = options.Options(optspec)
-opt, flags, roots = o.parse(sys.argv[1:])
+opt, flags, roots = o.parse(compat.argv[1:])
roots = [argv_bytes(x) for x in roots]
if not opt.unsafe:
roots = [argv_bytes(x) for x in roots]
if not opt.unsafe:
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import os, sys
"""
# end of bup preamble
from __future__ import absolute_import
import os, sys
-from bup import options, _helpers
+from bup import compat, options, _helpers
from bup.helpers import atoi, handle_ctrl_c, log, parse_num
from bup.helpers import atoi, handle_ctrl_c, log, parse_num
v,verbose print byte counter to stderr
"""
o = options.Options(optspec)
v,verbose print byte counter to stderr
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+(opt, flags, extra) = o.parse(compat.argv[1:])
if len(extra) != 1:
o.fatal("exactly one argument expected")
if len(extra) != 1:
o.fatal("exactly one argument expected")
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from stat import S_ISDIR
import copy, errno, os, sys, stat, re
from stat import S_ISDIR
import copy, errno, os, sys, stat, re
-from bup import options, git, metadata, vfs
+from bup import compat, options, git, metadata, vfs
from bup._helpers import write_sparsely
from bup.compat import argv_bytes, fsencode, wrap_main
from bup.helpers import (add_error, chunkyreader, die_if_errors, handle_ctrl_c,
from bup._helpers import write_sparsely
from bup.compat import argv_bytes, fsencode, wrap_main
from bup.helpers import (add_error, chunkyreader, die_if_errors, handle_ctrl_c,
def main():
o = options.Options(optspec)
def main():
o = options.Options(optspec)
- opt, flags, extra = o.parse(sys.argv[1:])
+ opt, flags, extra = o.parse(compat.argv[1:])
verbosity = (opt.verbose or 0) if not opt.quiet else -1
if opt.remote:
opt.remote = argv_bytes(opt.remote)
verbosity = (opt.verbose or 0) if not opt.quiet else -1
if opt.remote:
opt.remote = argv_bytes(opt.remote)
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys
"""
# end of bup preamble
from __future__ import absolute_import
import sys
from bup.compat import argv_bytes
from bup.git import check_repo_or_die
from bup.options import Options
from bup.compat import argv_bytes
from bup.git import check_repo_or_die
from bup.options import Options
handle_ctrl_c()
o = Options(optspec)
handle_ctrl_c()
o = Options(optspec)
-opt, flags, extra = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if not opt.unsafe:
o.fatal('refusing to run dangerous, experimental command without --unsafe')
if not opt.unsafe:
o.fatal('refusing to run dangerous, experimental command without --unsafe')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from io import BytesIO
import os, sys, stat, time, math
from io import BytesIO
import os, sys, stat, time, math
-from bup import hashsplit, git, options, index, client, metadata, hlinkdb
+from bup import compat, hashsplit, git, options, index, client, metadata
+from bup import hlinkdb
from bup.compat import argv_bytes, environ
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK
from bup.helpers import (add_error, grafted_path_components, handle_ctrl_c,
from bup.compat import argv_bytes, environ
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK
from bup.helpers import (add_error, grafted_path_components, handle_ctrl_c,
#,compress= set compression level to # (0-9, 9 is highest) [1]
"""
o = options.Options(optspec)
#,compress= set compression level to # (0-9, 9 is highest) [1]
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if opt.indexfile:
opt.indexfile = argv_bytes(opt.indexfile)
if opt.indexfile:
opt.indexfile = argv_bytes(opt.indexfile)
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from binascii import hexlify, unhexlify
import os, sys, struct, subprocess
from binascii import hexlify, unhexlify
import os, sys, struct, subprocess
-from bup import options, git, vfs, vint
+from bup import compat, options, git, vfs, vint
from bup.compat import environ, hexstr
from bup.git import MissingObject
from bup.helpers import (Conn, debug1, debug2, linereader, lines_until_sentinel,
from bup.compat import environ, hexstr
from bup.git import MissingObject
from bup.helpers import (Conn, debug1, debug2, linereader, lines_until_sentinel,
bup server
"""
o = options.Options(optspec)
bup server
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+(opt, flags, extra) = o.parse(compat.argv[1:])
if extra:
o.fatal('no arguments expected')
if extra:
o.fatal('no arguments expected')
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from binascii import hexlify
import os, sys, time
from binascii import hexlify
import os, sys, time
-from bup import hashsplit, git, options, client
+from bup import compat, hashsplit, git, options, client
from bup.compat import argv_bytes, environ
from bup.helpers import (add_error, handle_ctrl_c, hostname, log, parse_num,
qprogress, reprogress, saved_errors,
from bup.compat import argv_bytes, environ
from bup.helpers import (add_error, handle_ctrl_c, hostname, log, parse_num,
qprogress, reprogress, saved_errors,
handle_ctrl_c()
o = options.Options(optspec)
handle_ctrl_c()
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if opt.name: opt.name = argv_bytes(opt.name)
if opt.remote: opt.remote = argv_bytes(opt.remote)
if opt.verbose is None: opt.verbose = 0
if opt.name: opt.name = argv_bytes(opt.name)
if opt.remote: opt.remote = argv_bytes(opt.remote)
if opt.verbose is None: opt.verbose = 0
if opt.tree:
out.write(hexlify(tree) + b'\n')
if opt.commit or opt.name:
if opt.tree:
out.write(hexlify(tree) + b'\n')
if opt.commit or opt.name:
- msg = b'bup split\n\nGenerated by command:\n%r\n' % sys.argv
+ msg = b'bup split\n\nGenerated by command:\n%r\n' % compat.argvb
ref = opt.name and (b'refs/heads/%s' % opt.name) or None
userline = b'%s <%s@%s>' % (userfullname(), username(), hostname())
commit = pack_writer.new_commit(tree, oldref, userline, date, None,
ref = opt.name and (b'refs/heads/%s' % opt.name) or None
userline = b'%s <%s@%s>' % (userfullname(), username(), hostname())
commit = pack_writer.new_commit(tree, oldref, userline, date, None,
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from binascii import hexlify
import os, sys
from binascii import hexlify
import os, sys
-from bup import git, options
+from bup import compat, git, options
from bup.compat import argv_bytes
from bup.helpers import debug1, handle_ctrl_c, log
from bup.io import byte_stream, path_msg
from bup.compat import argv_bytes
from bup.helpers import debug1, handle_ctrl_c, log
from bup.io import byte_stream, path_msg
"""
o = options.Options(optspec)
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import
import sys, time
"""
# end of bup preamble
from __future__ import absolute_import
import sys, time
+
+from bup import compat, options
optspec = """
bup tick
"""
o = options.Options(optspec)
optspec = """
bup tick
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if extra:
o.fatal("no arguments expected")
if extra:
o.fatal("no arguments expected")
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from __future__ import absolute_import, print_function
import re, sys
"""
# end of bup preamble
from __future__ import absolute_import, print_function
import re, sys
-from bup import options
-from bup import version
+from bup import compat, options, version
version_rx = re.compile(r'^[0-9]+\.[0-9]+(\.[0-9]+)?(-[0-9]+-g[0-9abcdef]+)?$')
version_rx = re.compile(r'^[0-9]+\.[0-9]+(\.[0-9]+)?(-[0-9]+-g[0-9abcdef]+)?$')
tag display the tag name of this version. If no tag is available, display the commit id
"""
o = options.Options(optspec)
tag display the tag name of this version. If no tag is available, display the commit id
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
total = (opt.date or 0) + (opt.commit or 0) + (opt.tag or 0)
total = (opt.date or 0) + (opt.commit or 0) + (opt.tag or 0)
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
import mimetypes, os, posixpath, signal, stat, sys, time, urllib, webbrowser
from binascii import hexlify
import mimetypes, os, posixpath, signal, stat, sys, time, urllib, webbrowser
from binascii import hexlify
-from bup import options, git, vfs
+from bup import compat, options, git, vfs
from bup.helpers import (chunkyreader, debug1, format_filesize, handle_ctrl_c,
log, saved_errors)
from bup.metadata import Metadata
from bup.helpers import (chunkyreader, debug1, format_filesize, handle_ctrl_c,
log, saved_errors)
from bup.metadata import Metadata
browser show repository in default browser (incompatible with unix://)
"""
o = options.Options(optspec)
browser show repository in default browser (incompatible with unix://)
"""
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
if len(extra) > 1:
o.fatal("at most one argument expected")
if len(extra) > 1:
o.fatal("at most one argument expected")
#!/bin/sh
"""": # -*-python-*-
#!/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 $?
bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
"""
# end of bup preamble
from __future__ import absolute_import, print_function
import sys, stat, errno
from __future__ import absolute_import, print_function
import sys, stat, errno
-from bup import metadata, options, xstat
+from bup import compat, metadata, options, xstat
from bup.compat import argv_bytes
from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \
add_error, log
from bup.compat import argv_bytes
from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \
add_error, log
handle_ctrl_c()
o = options.Options(optspec)
handle_ctrl_c()
o = options.Options(optspec)
-(opt, flags, remainder) = o.parse(sys.argv[1:])
+(opt, flags, remainder) = o.parse(compat.argv[1:])
atime_resolution = parse_timestamp_arg('atime', opt.atime_resolution)
mtime_resolution = parse_timestamp_arg('mtime', opt.mtime_resolution)
atime_resolution = parse_timestamp_arg('atime', opt.atime_resolution)
mtime_resolution = parse_timestamp_arg('mtime', opt.mtime_resolution)
#!/bin/sh
"""": # -*-python-*-
#!/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
"""
# end of bup preamble
from sys import stdout
import os, sys
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 + '/..')]
sys.path[:0] = [abspath(script_home + '/../lib'), abspath(script_home + '/..')]
-from bup.compat import argv_bytes
-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')
os.write(stdout.fileno(), arg)
os.write(stdout.fileno(), b'\0\n')
#!/bin/sh
"""": # -*-python-*-
#!/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
from __future__ import absolute_import, print_function
import os, stat, sys
"""
# end of bup preamble
from __future__ import absolute_import, print_function
import os, stat, sys
-from bup.compat import argv_bytes
from bup.io import byte_stream
from bup.io import byte_stream
def usage():
print("Usage: hardlink-sets <paths ...>", file=sys.stderr)
def usage():
print("Usage: hardlink-sets <paths ...>", file=sys.stderr)
+if len(compat.argv) < 2:
-for p in (argv_bytes(x) for x in sys.argv[1:]):
+for p in compat.argvb[1:]:
for root, dirs, files in os.walk(p, onerror = on_walk_error):
for filename in files:
full_path = os.path.join(root, filename)
for root, dirs, files in os.walk(p, onerror = on_walk_error):
for filename in files:
full_path = os.path.join(root, filename)
#!/bin/sh
"""": # -*-python-*-
#!/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
"""
# end of bup preamble
from bup.compat import argv_bytes
from bup.helpers import handle_ctrl_c, saved_errors
from bup.io import byte_stream
from bup.compat import argv_bytes
from bup.helpers import handle_ctrl_c, saved_errors
from bup.io import byte_stream
-from bup import metadata, options
+from bup import compat, metadata, options
import bup.xstat as xstat
import bup.xstat as xstat
handle_ctrl_c()
o = options.Options(optspec)
handle_ctrl_c()
o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
sys.stdout.flush()
out = byte_stream(sys.stdout)
sys.stdout.flush()
out = byte_stream(sys.stdout)
from sys import stderr, stdout
import sys
from sys import stderr, stdout
import 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 wvtest import wvcheck, wvfail, wvmsg, wvpass, wvpasseq, wvpassne, wvstart
sys.path[:0] = [abspath(script_home + '/../lib'), abspath(script_home + '/..')]
from wvtest import wvcheck, wvfail, wvmsg, wvpass, wvpasseq, wvpassne, wvstart
#!/bin/sh
"""": # -*-python-*-
#!/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
"""
# end of bup preamble
if int(environ.get(b'BUP_TEST_LEVEL', b'0')) >= 11:
dispositions_to_test += ('get-on', 'get-to')
if int(environ.get(b'BUP_TEST_LEVEL', b'0')) >= 11:
dispositions_to_test += ('get-on', 'get-to')
+if len(compat.argv) == 1:
categories = ('replace', 'universal', 'ff', 'append', 'pick', 'new-tag',
'unnamed')
else:
categories = ('replace', 'universal', 'ff', 'append', 'pick', 'new-tag',
'unnamed')
else:
- categories = sys.argv[1:]
+ categories = compat.argv[1:]
with test_tempdir(b'get-') as tmpdir:
chdir(tmpdir)
with test_tempdir(b'get-') as tmpdir:
chdir(tmpdir)