/usr/lib/bup/cmd/bup-mux is in bup 0.29-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #!/usr/bin/python2.7
import os, sys, subprocess, struct
from bup import options
from bup.helpers import debug1, debug2, mux
# Give the subcommand exclusive access to stdin.
orig_stdin = os.dup(0)
devnull = os.open('/dev/null', os.O_RDONLY)
os.dup2(devnull, 0)
os.close(devnull)
optspec = """
bup mux command [arguments...]
--
"""
o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
if len(extra) < 1:
o.fatal('command is required')
subcmd = extra
debug2('bup mux: starting %r\n' % (extra,))
outr, outw = os.pipe()
errr, errw = os.pipe()
def close_fds():
os.close(outr)
os.close(errr)
p = subprocess.Popen(subcmd, stdin=orig_stdin, stdout=outw, stderr=errw,
preexec_fn=close_fds)
os.close(outw)
os.close(errw)
sys.stdout.write('BUPMUX')
sys.stdout.flush()
mux(p, sys.stdout.fileno(), outr, errr)
os.close(outr)
os.close(errr)
prv = p.wait()
if prv:
debug1('%s exited with code %d\n' % (extra[0], prv))
debug1('bup mux: done\n')
sys.exit(prv)
|