Skip to content

Util add access permissions#26

Merged
scheibelp merged 4 commits intospack:mainfrom
johnwparent:util-add-access-permissions
Apr 8, 2026
Merged

Util add access permissions#26
scheibelp merged 4 commits intospack:mainfrom
johnwparent:util-add-access-permissions

Conversation

@johnwparent
Copy link
Copy Markdown
Collaborator

Utils: Add file permissions

Some packages install themselves as readonly, or with other file permissions that conflict with what we're doing with this compiler wrapper. Thus, we need the ability to override (and restore) those settings.

For this compiler wrapper to perform it's duties, it needs to be able to read and write the various binaries artifacts from a build. We thus need to be able to:
1. Obtain and store current permissions
2. Grant ourselves the required permissions
3. Do our reading/writing
4. Restore previous permissions

On Windows, file access is handled by the read/write bit, as on other platforms, but also by Access Control Lists (ACLs) which are populated by Discretionary Access Control Lists (DACLs) which are the atomic units responsible for granting rights.

This PR adds an interface to inspect, store, update, and restore the read/write bits and DACLs of a given file. This functionality is wrapped up in a RAII based class that essentially provides scoped permissions to a file for scope of the permissions object.

Note: this assumes the user creating the permissions is the user driving this wrapper, or this user has admin rights, otherwise this will fail (gracefully, but still a failure)

Based on #25

Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly questions at this point

Comment thread src/utils.cxx
Comment thread src/utils.cxx
Comment thread src/utils.cxx
Comment thread src/utils.cxx
Comment thread src/utils.cxx
Comment thread src/utils.cxx
Comment thread src/utils.cxx
@johnwparent johnwparent force-pushed the util-add-access-permissions branch from dfd67a9 to b616e80 Compare March 27, 2026 21:09
Some packages install themselves as readonly, or with other file permissions that conflict with what we're doing with this compiler wrapper. Thus, we need the ability to override (and restore) those settings.

For this compiler wrapper to perform it's duties, it needs to be able to read and write the various binaries artifacts from a build. We thus need to be able to:
1. Obtain and store current permissions
2. Grant ourselves the required permissions
3. Do our reading/writing
4. Restore previous permissions

On Windows, file access is handled by the read/write bit, as on other platforms, but also by Access Control Lists (ACLs) which are populated by Discretionary Access Control Lists (DACLs) which are the atomic units responsible for granting rights.

This PR adds an interface to inspect, store, update, and restore the read/write bits and DACLs of a given file. This functionality is wrapped up in a RAII based class that essentially provides scoped permissions to a file for scope of the permissions object.

Note: this assumes the user creating the permissions is the user driving this wrapper, or this user has admin rights, otherwise this will fail (gracefully, but still a failure)
Signed-off-by: John Parent <john.parent@kitware.com>
@johnwparent johnwparent force-pushed the util-add-access-permissions branch from 735cc7d to ba87063 Compare March 31, 2026 22:27
Signed-off-by: John Parent <john.parent@kitware.com>
Signed-off-by: John Parent <john.parent@kitware.com>
Signed-off-by: John Parent <john.parent@kitware.com>
@scheibelp scheibelp merged commit 4f0a823 into spack:main Apr 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants