Add sgid notice when running on AFS (#30247)

This commit is contained in:
Michael Kuhn 2022-11-17 09:17:41 +01:00 committed by GitHub
parent 61f5d85525
commit 93eecae0c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import stat
import warnings
import spack.error
import spack.repo
@ -221,6 +222,12 @@ def get_package_dir_permissions(spec):
perms = get_package_permissions(spec)
if perms & stat.S_IRWXG and spack.config.get("config:allow_sgid", True):
perms |= stat.S_ISGID
if spec.concrete and "/afs/" in spec.prefix:
warnings.warn(
"Directory {0} seems to be located on AFS. If you"
" encounter errors, try disabling the allow_sgid option"
" using: spack config add 'config:allow_sgid:false'".format(spec.prefix)
)
return perms