From d669068b43591b7b96e525ce0acc990fb29aa229 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Fri, 14 May 2021 17:03:52 -0400 Subject: [PATCH] Do not throw out the whole environment It is too risky from a compat perspective. --- qubes/storage/lvm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qubes/storage/lvm.py b/qubes/storage/lvm.py index 357c6663..f2f67495 100644 --- a/qubes/storage/lvm.py +++ b/qubes/storage/lvm.py @@ -232,7 +232,7 @@ def _parse_lvm_cache(lvm_output): def init_cache(log=logging.getLogger('qubes.storage.lvm')): cmd = _init_cache_cmd - environ={'LC_ALL': 'C.UTF-8', 'PATH': '/usr/sbin:/usr/bin'} + environ={'LC_ALL': 'C.UTF-8', **os.environ} p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, env=environ) out, err = p.communicate() @@ -247,7 +247,7 @@ def init_cache(log=logging.getLogger('qubes.storage.lvm')): @asyncio.coroutine def init_cache_coro(log=logging.getLogger('qubes.storage.lvm')): cmd = _init_cache_cmd - environ={'LC_ALL': 'C.UTF-8', 'PATH': '/usr/sbin:/usr/bin'} + environ={'LC_ALL': 'C.UTF-8', **os.environ} p = yield from asyncio.create_subprocess_exec(*cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, @@ -780,7 +780,7 @@ def qubes_lvm(cmd, log=logging.getLogger('qubes.storage.lvm')): ''' Call :program:`lvm` to execute an LVM operation ''' # the only caller for this non-coroutine version is ThinVolume.export() cmd = _get_lvm_cmdline(cmd) - environ={'LC_ALL': 'C.UTF-8', 'PATH': '/usr/sbin:/usr/bin'} + environ={'LC_ALL': 'C.UTF-8', **os.environ} p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, env=environ) out, err = p.communicate() @@ -791,7 +791,7 @@ def qubes_lvm_coro(cmd, log=logging.getLogger('qubes.storage.lvm')): ''' Call :program:`lvm` to execute an LVM operation Coroutine version of :py:func:`qubes_lvm`''' - environ={'LC_ALL': 'C.UTF-8', 'PATH': '/usr/sbin:/usr/bin'} + environ={'LC_ALL': 'C.UTF-8', **os.environ} if cmd[0] == "remove": pre_cmd = ['blkdiscard', '-p', '1G', '/dev/'+cmd[1]] p = yield from asyncio.create_subprocess_exec(*pre_cmd,