[PATCH] D99304: [LLD] Fix probing a MSYS based 'tar' in a Windows Container

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 15:15:27 PDT 2021


mstorsjo created this revision.
mstorsjo added reviewers: goncharov, rnk, MaskRay.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

Don't run the 'tar' tool in a cleared environment with only the
LANG variable set, just set LANG on top of the existing environment.

If the 'tar' tool is an MSYS based tool, running it in a Windows
Container hangs if all environment variables are cleared - in
particular, the USERPROFILE variable needs to be kept intact.

This is the same issue fixed as was fixed in other places in
9de63b2e051cb3e79645cc20b83b4d33d132cba0 <https://reviews.llvm.org/rG9de63b2e051cb3e79645cc20b83b4d33d132cba0>, but contrary to running
the actual tests, running with an as-cleared-as-possible environment
here is less important.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99304

Files:
  lld/test/lit.cfg.py


Index: lld/test/lit.cfg.py
===================================================================
--- lld/test/lit.cfg.py
+++ lld/test/lit.cfg.py
@@ -101,11 +101,13 @@
 
 tar_executable = lit.util.which('tar', config.environment['PATH'])
 if tar_executable:
+    env = os.environ
+    env['LANG'] = 'C'
     tar_version = subprocess.Popen(
         [tar_executable, '--version'],
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,
-        env={'LANG': 'C'})
+        env=env)
     sout, _ = tar_version.communicate()
     if 'GNU tar' in sout.decode():
         config.available_features.add('gnutar')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99304.333146.patch
Type: text/x-patch
Size: 615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210324/27d09ca6/attachment.bin>


More information about the llvm-commits mailing list