stage: avoid using group name in _first_accessible_path()

On machines where $TMP is owned by a gid with no name, this avoids the
following error when the default spack stage does not exist:

    (spackbook):spack$ spack clean
    ==> Removing all temporary build stages
    ==> Error: 'getgrgid(): gid not found: 57095'

Spack needs to deal with gids directly unless users pass them in.
This commit is contained in:
Todd Gamblin 2019-08-20 14:52:53 -07:00
parent a41014ed9e
commit 368bf2d69c
No known key found for this signature in database
GPG Key ID: 66B24B9050FDD0B8

View File

@ -3,7 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import grp
import os
import stat
import sys
@ -56,8 +55,8 @@ def _first_accessible_path(paths):
if not os.path.exists(prefix):
break
parent = os.path.dirname(prefix)
group = grp.getgrgid(os.stat(parent).st_gid)[0]
mkdirp(path, group=group, default_perms='parents')
gid = os.stat(parent).st_gid
mkdirp(path, group=gid, default_perms='parents')
if can_access(path):
return path