Skip to content

Commit 8ae50ae

Browse files
pramodskumbharscheibelp
authored andcommitted
Use abspath to avoid permission errors(#7241)
Fixes #5189 When working with non-normalized paths containing ".." on some file systems, Spack was found to encounter a permission error when writing to the path. This normalizes a path written by the intel-parallel-studio package and also normalizes all paths written by the license install hook (for all packages) to avoid this issue for intel-parallel-studio.
1 parent 557e6ba commit 8ae50ae

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/spack/spack/hooks/licensing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def symlink_license(pkg):
157157
target = pkg.global_license_file
158158
for filename in pkg.license_files:
159159
link_name = join_path(pkg.prefix, filename)
160+
link_name = os.path.abspath(link_name)
160161
license_dir = os.path.dirname(link_name)
161162
if not os.path.exists(license_dir):
162163
mkdirp(license_dir)

var/spack/repos/builtin/packages/intel-parallel-studio/package.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ def rpath_configuration(self):
433433
for compiler in ['icc', 'icpc', 'ifort']:
434434
cfgfilename = os.path.join(
435435
self.prefix, self.bin_dir, '{0}.cfg'.format(compiler))
436+
cfgfilename = os.path.abspath(cfgfilename)
436437
with open(cfgfilename, 'w') as f:
437438
f.write('-Xlinker -rpath -Xlinker {0}\n'.format(lib_dir))
438439

@@ -443,7 +444,7 @@ def fix_psxevars(self):
443444

444445
bindir = glob.glob(join_path(
445446
self.prefix, 'parallel_studio*', 'bin'))[0]
446-
447+
bindir = os.path.abspath(bindir)
447448
if self.version[1] > 2016:
448449
filter_file('^SCRIPTPATH=.*', 'SCRIPTPATH={0}'.format(self.prefix),
449450
os.path.join(bindir, 'psxevars.sh'),

0 commit comments

Comments
 (0)