From 4608ce69a0adc461332dadd1ae2e10e529605d94 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 4 Mar 2018 06:32:20 +0100 Subject: [PATCH] xattr-helper.py: Make restoring of extended attributes work again. Set options.paths using standard input only in dump mode. Also fix support for paths passed as arguments. Bug: https://bugs.gentoo.org/649528 Fixes: 345c54de9e8c9daac190fbb07d33bf40e7bac5a9 --- bin/xattr-helper.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py index b5faed044..75844f279 100755 --- a/bin/xattr-helper.py +++ b/bin/xattr-helper.py @@ -1,5 +1,5 @@ #!/usr/bin/python -b -# Copyright 2012-2014 Gentoo Foundation +# Copyright 2012-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 doc = """Dump and restore extended attributes. @@ -147,12 +147,13 @@ def main(argv): actions.add_argument('--dump', action='store_true', help='Dump the values of all extended ' - 'attributes associated with null-separated' - ' paths read from stdin.') + 'attributes associated with paths ' + 'passed as arguments or null-separated ' + 'paths read from stdin.') actions.add_argument('--restore', action='store_true', - help='Restore extended attributes using' - ' a dump read from stdin.') + help='Restore extended attributes using ' + 'a dump read from stdin.') options = parser.parse_args(argv) @@ -160,10 +161,12 @@ def main(argv): file_in = sys.stdin.buffer.raw else: file_in = sys.stdin - if not options.paths: - options.paths += [x for x in file_in.read().split(b'\0') if x] if options.dump: + if options.paths: + options.paths = [unicode_encode(x) for x in options.paths] + else: + options.paths = [x for x in file_in.read().split(b'\0') if x] if sys.hexversion >= 0x3000000: file_out = sys.stdout.buffer else: -- 2.16.2