diff options
author | George Hartzell <hartzell@alerce.com> | 2017-10-17 11:26:05 -0700 |
---|---|---|
committer | becker33 <becker33@llnl.gov> | 2017-10-17 11:26:05 -0700 |
commit | 464e558aeacfca0c4547ad24b895fc29e5f4bf5e (patch) | |
tree | 5d18996d6bbcea3eee7997b1ba67c34066c38a72 /lib | |
parent | ffc4c31b824856f421a13e4e93e25e55f40921e4 (diff) | |
download | spack-464e558aeacfca0c4547ad24b895fc29e5f4bf5e.tar.gz spack-464e558aeacfca0c4547ad24b895fc29e5f4bf5e.tar.bz2 spack-464e558aeacfca0c4547ad24b895fc29e5f4bf5e.tar.xz spack-464e558aeacfca0c4547ad24b895fc29e5f4bf5e.zip |
filter_file, don't remove absent backup file (#5733)
I'm tracking down a problem with the perl package that's been
generating this error:
```
OSError: OSError: [Errno 2] No such file or directory: '/blah/blah/blah/lib/5.24.1/x86_64-linux/Config.pm~'
```
The real problem is upstream, but it's being masked by an exception
raised in `filter_file`s finally block.
In my case, `backup` is `False`.
The backup is created around line 127, the `re.sub()` calls
fails (working on that), the `except` block fires and moves the backup
file back, then the finally block tries to remove the non-existent
backup file.
This change just avoids trying to remove the non-existent file.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 1d7b9ff7a3..5ed4d9249a 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -136,7 +136,7 @@ def filter_file(regex, repl, *filenames, **kwargs): raise finally: - if not backup: + if not backup and os.path.exists(backup_filename): os.remove(backup_filename) |