summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorabernede <47601070+abernede@users.noreply.github.com>2019-02-13 20:18:36 +0100
committerGreg Becker <becker33@llnl.gov>2019-02-13 11:18:36 -0800
commit89727ba4e75cbe2bcd8196a92abcf3d8e3b5e46a (patch)
treedbd0cfe347a4c879ebe24f8ef50d038105852322 /lib
parenta76c50d1ee696c5b1a8b3c99978892bbe9b0d74a (diff)
downloadspack-89727ba4e75cbe2bcd8196a92abcf3d8e3b5e46a.tar.gz
spack-89727ba4e75cbe2bcd8196a92abcf3d8e3b5e46a.tar.bz2
spack-89727ba4e75cbe2bcd8196a92abcf3d8e3b5e46a.tar.xz
spack-89727ba4e75cbe2bcd8196a92abcf3d8e3b5e46a.zip
Bug Fix in permission setter (#10584)
* fix permission setter Fix a typo in islink test when applied to files. * os.walk explicitly set not to follow links The algorithm strongly rely on not following links.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/hooks/permissions_setters.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/spack/spack/hooks/permissions_setters.py b/lib/spack/spack/hooks/permissions_setters.py
index 0b8a60728c..631118ffac 100644
--- a/lib/spack/spack/hooks/permissions_setters.py
+++ b/lib/spack/spack/hooks/permissions_setters.py
@@ -15,7 +15,8 @@ def forall_files(path, fn, args, dir_args=None):
"""Apply function to all files in directory, with file as first arg.
Does not apply to the root dir. Does not apply to links"""
- for root, dirs, files in os.walk(path):
+ # os.walk explicitly set not to follow links
+ for root, dirs, files in os.walk(path, followlinks=False):
for d in dirs:
if not os.path.islink(os.path.join(root, d)):
if dir_args:
@@ -23,7 +24,7 @@ def forall_files(path, fn, args, dir_args=None):
else:
fn(os.path.join(root, d), *args)
for f in files:
- if not os.path.islink(os.path.join(root, d)):
+ if not os.path.islink(os.path.join(root, f)):
fn(os.path.join(root, f), *args)