Skip to content

Conversation

@garrisonhh
Copy link
Contributor

@garrisonhh garrisonhh commented Mar 5, 2024

Resolves #19162

access and accessat family of functions:

  • recognize EPERM as AccessError.PermissionDenied
  • recognize EACCES as AccessError.AccessDenied, which is consistent with other functions in std.os

access and accessat family of functions:
- recognize EPERM as AccessError.PermissionDenied
- recognize EACCES as AccessError.AccessDenied, which is consistent
  with other functions in std.os
@garrisonhh
Copy link
Contributor Author

In the second commit I also found similar inconsistencies in handling ACCESS_DENIED in os.windows.GetFileAttributes and os.windows.TerminateProcess.

@squeek502
Copy link
Member

Related: #16782

@andrewrk
Copy link
Member

andrewrk commented May 9, 2024

I'm sorry, I didn't review this in time, and now it has bitrotted. Furthermore, so many pull requests have stacked up that I can't keep up and I am therefore declaring Pull Request Bankruptcy and closing old PRs that now have conflicts with master branch.

If you want to reroll, you are by all means welcome to revisit this changeset with respect to the current state of master branch, and there's a decent chance your patch will be reviewed the second time around.

Either way, I'm closing this now, otherwise the PR queue will continue to grow indefinitely.

@andrewrk andrewrk closed this May 9, 2024
rootbeer added a commit to rootbeer/zig that referenced this pull request Feb 19, 2025
…ionDenied

AccessDenied is returned if the file mode bit (user/group/other rwx bits)
disallow access.  PermissionDenied is returned if something else denies
access (immutable bit, SELinux, capabilities, etc).  This somewhat subtle
distinction is a POSIX thing.

This PR is effecitvely an update of PR ziglang#19193.  See ziglang#16782 for the deeper
problems with the AccessDenied/PermissionDenied duopoly.

Tested locally with an immutable file.

Fixes ziglang#22733 and ziglang#19162.
rootbeer added a commit to rootbeer/zig that referenced this pull request Feb 20, 2025
… PermissionDenied

`EACCES` is returned if the file mode bit (i.e., user/group/other rwx
bits) disallow access (mapped to `error.AccessDenied`).  `EPERM` is
returned if something else denies access (immutable bit, SELinux,
capabilities, etc) and is mapped to `error.PermissionDenied`.  This
somewhat subtle no-access distinction is part of POSIX.

This PR is effecitvely an update/simplification of PR ziglang#19193.  See ziglang#16782
for the deeper problems with the AccessDenied/PermissionDenied duopoly.

Tested locally with an immutable file.

Fixes ziglang#22733 and ziglang#19162.
rootbeer added a commit to rootbeer/zig that referenced this pull request Feb 20, 2025
… PermissionDenied

`EACCES` is returned if the file mode bit (i.e., user/group/other rwx
bits) disallow access.  `EPERM` is returned if something else denies
access (immutable bit, SELinux, capabilities, etc).  This somewhat subtle
no-access distinction is part of POSIX.  For now map both to
`error.PermissionDenied` to keep the error signature unchanged.  See
duopoly.

This PR is effecitvely an update/simplification of PR ziglang#19193.

Tested locally with an immutable file.

Fixes ziglang#22733 and ziglang#19162.
alexrp pushed a commit that referenced this pull request Feb 21, 2025
… PermissionDenied

`EACCES` is returned if the file mode bit (i.e., user/group/other rwx
bits) disallow access.  `EPERM` is returned if something else denies
access (immutable bit, SELinux, capabilities, etc).  This somewhat subtle
no-access distinction is part of POSIX.  For now map both to
`error.PermissionDenied` to keep the error signature unchanged.  See
duopoly.

This PR is effecitvely an update/simplification of PR #19193.

Tested locally with an immutable file.

Fixes #22733 and #19162.
T1nk3r1 pushed a commit to T1nk3r1/zig-frictionless that referenced this pull request Apr 5, 2025
… PermissionDenied

`EACCES` is returned if the file mode bit (i.e., user/group/other rwx
bits) disallow access.  `EPERM` is returned if something else denies
access (immutable bit, SELinux, capabilities, etc).  This somewhat subtle
no-access distinction is part of POSIX.  For now map both to
`error.PermissionDenied` to keep the error signature unchanged.  See
duopoly.

This PR is effecitvely an update/simplification of PR ziglang#19193.

Tested locally with an immutable file.

Fixes ziglang#22733 and ziglang#19162.
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.

std.os.access doesn't handle EPERM errno

3 participants