Skip to content

chmod: fix EROFS showing as Permission denied#12200

Open
gabrielhnf wants to merge 5 commits intouutils:mainfrom
gabrielhnf:fix-chmod-erofs-error-message
Open

chmod: fix EROFS showing as Permission denied#12200
gabrielhnf wants to merge 5 commits intouutils:mainfrom
gabrielhnf:fix-chmod-erofs-error-message

Conversation

@gabrielhnf
Copy link
Copy Markdown

Fixes #12196

Problem

When running chmod -R on a read-only filesystem, uutils was reporting:

chmod: cannot access 'file': Permission denied

Instead of the correct:

chmod: changing permissions of 'file': Read-only file system

Cause

safe_chmod_file was hardcoding ChmodError::PermissionDenied regardless of the actual error returned by the OS, discarding the real error kind.

Fix

Map ErrorKind::ReadOnlyFilesystem to a new ChmodError::ReadOnlyFileSystem variant with the correct message, consistent with GNU coreutils behavior.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Copy Markdown
Contributor

looks good but could you please add a test to make sure we don't regress

@gabrielhnf
Copy link
Copy Markdown
Author

Thanks for the suggestion! Also planning a follow-up PR to fix another problem regarding error reporting, should that include tests as well?

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 -R: cannot access ...: Permission denied when gnuchmod gives Read-only file system

2 participants