[PATCH] D79861: Fixed a problem removing temp files

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 07:32:41 PDT 2020


PeteSteinfeld created this revision.
PeteSteinfeld added a reviewer: yln.
Herald added subscribers: llvm-commits, delcypher.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.

Before making this change, whenever I ran "check-flang", I'd get an
error message like:

llvm-lit: /mnt/c/GitHub/f18/c751/flang/build/bin/../../../llvm/utils/lit/lit/main.py:252: warning: Failed to delete temp directory '/tmp/lit_tmp_gOKUIh'

With this change, there's no such message in the output, and the temp
directory is successfully removed.

Note that my working environment is on Windows 10 running Windows
Subsystem for Linux using the Ubuntu app.  I'm running Python version
2.7.1.

Earlier versions of Python do not contain `shutil`.  It may be that this
module was available on Windows systems later than other platforms.
Upgrading my version of Python made the problem go away

I don't believe that timing was a problem since inserting a long delay
didn't fix things.

So I added some text to the error message recommending that the user
upgrade their version of Python if they run into this problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79861

Files:
  llvm/utils/lit/lit/main.py


Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -247,9 +247,8 @@
             try:
                 import shutil
                 shutil.rmtree(tmp_dir)
-            except:
-                # FIXME: Re-try after timeout on Windows.
-                lit_config.warning("Failed to delete temp directory '%s'" % tmp_dir)
+            except Exception as e: 
+                lit_config.warning("Failed to delete temp directory '%s', try upgrading your version of Python to fix this" % tmp_dir)
 
 
 def print_histogram(tests):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79861.263708.patch
Type: text/x-patch
Size: 645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200513/833123e3/attachment.bin>


More information about the llvm-commits mailing list