Skip to content

Conversation

@asder8215
Copy link
Contributor

@asder8215 asder8215 commented Dec 23, 2025

This PR modifies checking if a file exists from using .exists() to .try_exists() (handling it with match statements than if conditionals). This allows us to check for errors like PermissionDenied and output the error message accordingly for inaccesible directories/files as regular user. This fixes #9789.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/chmod/silent. tests/chmod/silent is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/chmod/thru-dangling. tests/chmod/thru-dangling is passing on 'main'. Maybe you have to rebase?

@asder8215
Copy link
Contributor Author

asder8215 commented Dec 24, 2025

I'm not sure if any of the errors on CICD/Build + L10n are the result of the changes I made to this code (it shouldn't affect anything because I just change the implementation of the code from using .exists() to .try_exists() and modified the error messages accordingly to match what GNU outputs). I see the same error for CICD/Build in #9796.

As for the WSL2 error, I ran the sync and df tests locally on my computer and it all passes. Can anyone else confirm anything about these errors?

@sylvestre
Copy link
Contributor

sorry, it needs to be rebased

@asder8215 asder8215 force-pushed the chmod_exists_permission_denied branch from e77c343 to 1c0f4c0 Compare December 30, 2025 02:54
@asder8215
Copy link
Contributor Author

@sylvestre, I just resetted the branch to the current updates that coreutils' main has and reapplied my changes within chmod.rs and test_chmod.rs

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.

chmod: behavioral divergence from coreutils when the target file is not accessible

2 participants