diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2022-12-30 01:24:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-30 10:24:35 +0100 |
commit | 06312ddf1827c03e8d0b5f883eb622c547822d9d (patch) | |
tree | 122a17923bc709f54aa82cdb72aea5fa9adc75ad /var | |
parent | 3a0db729c7fc0def2ac58c7c487cd43d5578ba78 (diff) | |
download | spack-06312ddf1827c03e8d0b5f883eb622c547822d9d.tar.gz spack-06312ddf1827c03e8d0b5f883eb622c547822d9d.tar.bz2 spack-06312ddf1827c03e8d0b5f883eb622c547822d9d.tar.xz spack-06312ddf1827c03e8d0b5f883eb622c547822d9d.zip |
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`.
Diffstat (limited to 'var')
0 files changed, 0 insertions, 0 deletions