diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-11-11 03:10:29 -0500 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-11-11 03:10:29 -0500 |
commit | f91c4805b159a50ab2df57836ef53ec5d26ea62b (patch) | |
tree | 8d9ec16d0c6b4765ac0c7c45cb5c8d91093529ec | |
parent | 5f8b37d0e7a20c64dee066d7fa1bee12803a1626 (diff) | |
download | meson-f91c4805b159a50ab2df57836ef53ec5d26ea62b.zip meson-f91c4805b159a50ab2df57836ef53ec5d26ea62b.tar.gz meson-f91c4805b159a50ab2df57836ef53ec5d26ea62b.tar.bz2 |
Pass restorecon file list through stdin.
This should avoid any issues with command-line argument limits.
-rw-r--r-- | mesonbuild/scripts/meson_install.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index b0a7d19..9485967 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -95,11 +95,13 @@ def restore_selinux_contexts(): # is ignored quietly. return - try: - subprocess.check_call(['restorecon', '-F'] + selinux_updates, stderr=subprocess.DEVNULL) - except subprocess.CalledProcessError as e: - msg = "{!r}: Failed to restore SELinux context, ignoring SELinux context for all remaining files..." - print(msg.format(selinux_updates, e.returncode)) + with subprocess.Popen(['restorecon', '-F', '-f-', '-0'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: + out, err = proc.communicate(input=b'\0'.join(os.fsencode(f) for f in selinux_updates) + b'\0') + if proc.returncode != 0: + print('Failed to restore SELinux context of installed files...', + 'Standard output:', out.decode(), + 'Standard error:', err.decode(), sep='\n') def append_to_log(line): install_log_file.write(line) |