summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kuhn <suraia@ikkoku.de>2016-09-30 18:45:08 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2016-09-30 09:45:08 -0700
commit8d1ec0df3d4af0f6385ccd017aaad41d82cf96ef (patch)
tree07794212de6efd3d59b8f952464b51f03d1e7747
parent6c627dbac92ee044884b0f6c32ced5cb510909cf (diff)
downloadspack-8d1ec0df3d4af0f6385ccd017aaad41d82cf96ef.tar.gz
spack-8d1ec0df3d4af0f6385ccd017aaad41d82cf96ef.tar.bz2
spack-8d1ec0df3d4af0f6385ccd017aaad41d82cf96ef.tar.xz
spack-8d1ec0df3d4af0f6385ccd017aaad41d82cf96ef.zip
Fix read locks on read-only file systems (#1857)
-rw-r--r--lib/spack/llnl/util/lock.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/lock.py b/lib/spack/llnl/util/lock.py
index aa8272d5fe..b5e3a3a8f8 100644
--- a/lib/spack/llnl/util/lock.py
+++ b/lib/spack/llnl/util/lock.py
@@ -70,7 +70,8 @@ class Lock(object):
while (time.time() - start_time) < timeout:
try:
if self._fd is None:
- self._fd = os.open(self._file_path, os.O_RDWR)
+ mode = os.O_RDWR if op == fcntl.LOCK_EX else os.O_RDONLY
+ self._fd = os.open(self._file_path, mode)
fcntl.lockf(self._fd, op | fcntl.LOCK_NB)
if op == fcntl.LOCK_EX: