spack/lib/spack
Todd Gamblin 06312ddf18
bugfix: setgid tests fail when primary group is unknown (#34729)
On systems with remote groups, the primary user group may be remote and may not exist on
the local system (i.e., it might just be a number). On the CLI, it looks like this:

```console
> touch foo
> l foo
-rw-r--r-- 1 gamblin2 57095 0 Dec 29 22:24 foo
> chmod 2000 foo
chmod: changing permissions of 'foo': Operation not permitted
```

Here, the local machine doesn't know about per-user groups, so they appear as gids in
`ls` output. `57095` is also `gamblin2`'s uid, but the local machine doesn't know that
`gamblin2` is in the `57095` group.

Unfortunately, it seems that Python's `os.chmod()` just fails silently, setting
permissions to `0o0000` instead of `0o2000`. We can avoid this by ensuring that the file
has a group the user is known to be a member of.

- [x] Add `ensure_known_group()` in the permissions tests.
- [x] Call `ensure_known_group()` on tempfile in `test_chmod_real_entries_ignores_suid_sgid`.
2022-12-30 10:24:35 +01:00
..
docs spack graph: rework to use Jinja templates and builders (#34637) 2022-12-27 15:25:53 +01:00
env Control Werror by converting to Wno-error (#30882) 2022-11-23 12:29:17 -08:00
external archspec: add support for zen4 (#34609) 2022-12-20 11:22:50 +01:00
llnl types: fix type annotations and remove novm annootations for llnl module 2022-12-26 22:28:44 +01:00
spack bugfix: setgid tests fail when primary group is unknown (#34729) 2022-12-30 10:24:35 +01:00
spack_installable Remove support for running with Python 2.7 (#33063) 2022-11-14 13:11:28 +01:00