From 89727ba4e75cbe2bcd8196a92abcf3d8e3b5e46a Mon Sep 17 00:00:00 2001 From: abernede <47601070+abernede@users.noreply.github.com> Date: Wed, 13 Feb 2019 20:18:36 +0100 Subject: 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. --- lib/spack/spack/hooks/permissions_setters.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') 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) -- cgit v1.2.3-70-g09d2