Codebase list debian-goodies / c22ca48
which-pkg-broke: Enforce POSIX ("C") locale without resetting $PATH Closes: #883889 Explanation for the commit by committer Axel Beckert after explanations by commit-author Jakub Wilk: Resetting all environment variables and hence also $PATH causes Python to set its default search path which includes the current directory. Including the current directory in $PATH is nowadays considered a a security issue. See also https://bugs.python.org/issue26414 Jakub Wilk authored 6 years ago Axel Beckert committed 5 years ago
1 changed file(s) with 6 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
88 from string import *
99 from stat import *
1010
11 def force_posix_locale():
12 os.environ['LC_ALL'] = 'C'
13
1114 def pkgdeps(pkgs):
1215 apt_cache = subprocess.Popen(
1316 ['apt-cache', 'depends', *pkgs],
1417 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
1518 universal_newlines=True,
16 env={} # force POSIX locale
19 preexec_fn=force_posix_locale,
1720 )
1821 deps = []
1922 for myline in apt_cache.stdout:
4144 ['dpkg', '--print-architecture'],
4245 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
4346 universal_newlines=True,
44 env={} # force POSIX locale
47 preexec_fn=force_posix_locale,
4548 )
4649 for arch in dpkg_arch.stdout.readlines():
4750 architectures.append(arch.rstrip())
5154 ['dpkg', '--print-foreign-architecture'],
5255 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
5356 universal_newlines=True,
54 env={} # force POSIX locale
57 preexec_fn=force_posix_locale,
5558 )
5659 for arch in dpkg_archs.stdout.readlines():
5760 architectures.append(arch.rstrip())