diff options
author | Seth R. Johnson <johnsonsr@ornl.gov> | 2022-09-06 12:50:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 09:50:59 -0700 |
commit | c7292aa4b67ca6ab9e454a0fa4dd6b974ca8666c (patch) | |
tree | 3d81d8c57cd9e7ed5b017635f130885350c38972 | |
parent | d7d59a24d12eba3ea87b052eab1e978ebca20428 (diff) | |
download | spack-c7292aa4b67ca6ab9e454a0fa4dd6b974ca8666c.tar.gz spack-c7292aa4b67ca6ab9e454a0fa4dd6b974ca8666c.tar.bz2 spack-c7292aa4b67ca6ab9e454a0fa4dd6b974ca8666c.tar.xz spack-c7292aa4b67ca6ab9e454a0fa4dd6b974ca8666c.zip |
Fix spack locking on some NFS systems (#32426)
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
-rw-r--r-- | lib/spack/llnl/util/lock.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/spack/llnl/util/lock.py b/lib/spack/llnl/util/lock.py index 0682ce059a..6dfba50abb 100644 --- a/lib/spack/llnl/util/lock.py +++ b/lib/spack/llnl/util/lock.py @@ -386,8 +386,12 @@ class Lock(object): try: os.makedirs(parent) except OSError as e: - # makedirs can fail when diretory already exists. - if not (e.errno == errno.EEXIST and os.path.isdir(parent) or e.errno == errno.EISDIR): + # os.makedirs can fail in a number of ways when the directory already exists. + # With EISDIR, we know it exists, and others like EEXIST, EACCES, and EROFS + # are fine if we ensure that the directory exists. + # Python 3 allows an exist_ok parameter and ignores any OSError as long as + # the directory exists. + if not (e.errno == errno.EISDIR or os.path.isdir(parent)): raise return parent |