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.
This commit is contained in:
Pramod S Kumbhar 2018-02-16 02:26:37 +01:00 committed by scheibelp
parent 557e6ba2f9
commit 8ae50ae8bb
2 changed files with 3 additions and 1 deletions

View file

@ -157,6 +157,7 @@ def symlink_license(pkg):
target = pkg.global_license_file target = pkg.global_license_file
for filename in pkg.license_files: for filename in pkg.license_files:
link_name = join_path(pkg.prefix, filename) link_name = join_path(pkg.prefix, filename)
link_name = os.path.abspath(link_name)
license_dir = os.path.dirname(link_name) license_dir = os.path.dirname(link_name)
if not os.path.exists(license_dir): if not os.path.exists(license_dir):
mkdirp(license_dir) mkdirp(license_dir)

View file

@ -433,6 +433,7 @@ def rpath_configuration(self):
for compiler in ['icc', 'icpc', 'ifort']: for compiler in ['icc', 'icpc', 'ifort']:
cfgfilename = os.path.join( cfgfilename = os.path.join(
self.prefix, self.bin_dir, '{0}.cfg'.format(compiler)) self.prefix, self.bin_dir, '{0}.cfg'.format(compiler))
cfgfilename = os.path.abspath(cfgfilename)
with open(cfgfilename, 'w') as f: with open(cfgfilename, 'w') as f:
f.write('-Xlinker -rpath -Xlinker {0}\n'.format(lib_dir)) f.write('-Xlinker -rpath -Xlinker {0}\n'.format(lib_dir))
@ -443,7 +444,7 @@ def fix_psxevars(self):
bindir = glob.glob(join_path( bindir = glob.glob(join_path(
self.prefix, 'parallel_studio*', 'bin'))[0] self.prefix, 'parallel_studio*', 'bin'))[0]
bindir = os.path.abspath(bindir)
if self.version[1] > 2016: if self.version[1] > 2016:
filter_file('^SCRIPTPATH=.*', 'SCRIPTPATH={0}'.format(self.prefix), filter_file('^SCRIPTPATH=.*', 'SCRIPTPATH={0}'.format(self.prefix),
os.path.join(bindir, 'psxevars.sh'), os.path.join(bindir, 'psxevars.sh'),