Fix spack install chgrp on symlinks (#30743)
Fixes missing chgrp on symlinks in package installations, and errors on symlinks referencing non-existent or non-writable locations. Note: `os.chown(.., follow_symlinks=False)` is python3 only, but `os.lchown` exists in both versions.
This commit is contained in:
@@ -820,7 +820,7 @@ def test_setup_install_dir_grp(install_mockery, monkeypatch, capfd):
|
||||
def _get_group(spec):
|
||||
return mock_group
|
||||
|
||||
def _chgrp(path, group):
|
||||
def _chgrp(path, group, follow_symlinks=True):
|
||||
tty.msg(mock_chgrp_msg.format(path, group))
|
||||
|
||||
monkeypatch.setattr(prefs, 'get_package_group', _get_group)
|
||||
|
||||
@@ -44,7 +44,7 @@ def set_permissions(path, perms, group=None):
|
||||
fs.chmod_x(path, perms)
|
||||
|
||||
if group:
|
||||
fs.chgrp(path, group)
|
||||
fs.chgrp(path, group, follow_symlinks=False)
|
||||
|
||||
|
||||
class InvalidPermissionsError(SpackError):
|
||||
|
||||
Reference in New Issue
Block a user