/usr/share/pyshared/zfec/cmdline_zunfec.py is in python-zfec 1.4.5-2.
This file is owned by root:root, with mode 0o644.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #!/usr/bin/env python
# zfec -- a fast C implementation of Reed-Solomon erasure coding with
# command-line, C, and Python interfaces
import os, sys
import argparse
import filefec
from zfec import __version__ as libversion
__version__ = libversion
def main():
if '-V' in sys.argv or '--version' in sys.argv:
print "zfec library version: ", libversion
print "zunfec command-line tool version: ", __version__
return 0
parser = argparse.ArgumentParser(description="Decode data from share files.")
parser.add_argument('-o', '--outputfile', required=True, help='file to write the resulting data to, or "-" for stdout', type=str, metavar='OUTF')
parser.add_argument('sharefiles', nargs='*', help='shares file to read the encoded data from', type=unicode, metavar='SHAREFILE')
parser.add_argument('-v', '--verbose', help='print out messages about progress', action='store_true')
parser.add_argument('-f', '--force', help='overwrite any file which already in place of the output file', action='store_true')
parser.add_argument('-V', '--version', help='print out version number and exit', action='store_true')
args = parser.parse_args()
if len(args.sharefiles) < 2:
print "At least two sharefiles are required."
return 1
if args.force:
outf = open(args.outputfile, 'wb')
else:
try:
flags = os.O_WRONLY|os.O_CREAT|os.O_EXCL | (hasattr(os, 'O_BINARY') and os.O_BINARY)
outfd = os.open(args.outputfile, flags)
except OSError:
print "There is already a file named %r -- aborting. Use --force to overwrite." % (args.outputfile,)
return 2
outf = os.fdopen(outfd, "wb")
sharefs = []
# This sort() actually matters for performance (shares with numbers < k
# are much faster to use than the others), as well as being important for
# reproducibility.
args.sharefiles.sort()
for fn in args.sharefiles:
sharefs.append(open(fn, 'rb'))
try:
ret = filefec.decode_from_files(outf, sharefs, args.verbose)
except filefec.InsufficientShareFilesError, e:
print str(e)
return 3
return 0
# zfec -- fast forward error correction library with Python interface
#
# Copyright (C) 2007 Allmydata, Inc.
# Author: Zooko Wilcox-O'Hearn
#
# This file is part of zfec.
#
# See README.txt for licensing information.
|