Skip to content

chmod: preserve metadata errors for overlong paths - #15499

Open
limadog9 wants to merge 1 commit into
uutils:mainfrom
limadog9:fix/chmod-stat-error-context-12828
Open

limadog9 wants to merge 1 commit into
uutils:mainfrom
limadog9:fix/chmod-stat-error-context-12828

Conversation

@limadog9

Copy link
Copy Markdown
Contributor

Preserve metadata errors for operands and --reference files so overlong paths report File name too long. Add regressions for recursive operation and continued processing.

Closes #12828.

Comment thread src/uu/chmod/src/chmod.rs
enum ChmodError {
#[error("{}", translate!("chmod-error-cannot-stat", "file" => _0.quote()))]
CannotStat(PathBuf),
#[error("{}", translate!("perms-cannot-access", "file" => _0.quote(), "error" => strip_errno(_1)))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for --reference GNU says "failed to get attributes of 'x': ...", not "cannot access"
could you please keep a separate variant for the reference file?

Comment thread src/uu/chmod/src/chmod.rs
#[error("{}", translate!("chmod-error-cannot-stat", "file" => _0.quote()))]
CannotStat(PathBuf),
#[error("{}", translate!("perms-cannot-access", "file" => _0.quote(), "error" => strip_errno(_1)))]
CannotStat(PathBuf, std::io::Error),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

chmod-error-cannot-stat is now unused, please remove it from the ftl files too

.arg("700")
.arg(&path)
.arg("valid")
.fails_with_code(1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please check the whole message ("cannot access ...: File name too long"), not only the errno

@limadog9
limadog9 force-pushed the fix/chmod-stat-error-context-12828 branch 2 times, most recently from 1c1e0c8 to 44f3193 Compare October 19, 2026 11:36
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/tail/follow-symlink is no longer failing!

Comment thread src/uu/chmod/locales/en-US.ftl Outdated
chmod-verbose-mode-retained = mode of {$file} retained as {$mode_octal} ({$mode_display})
chmod-verbose-failed-change = failed to change mode of file {$file} from {$old_mode} ({$old_mode_display}) to {$new_mode} ({$new_mode_display})
chmod-verbose-mode-changed = mode of {$file} changed from {$old_mode} ({$old_mode_display}) to {$new_mode} ({$new_mode_display})
chmod-error-reference-stat = failed to get attributes of { $file }: { $error }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could you please move it next to the other chmod-error-* keys? (same in fr-FR.ftl)

Preserve metadata errors for operands and --reference files so overlong paths report File name too long. Add regressions for recursive operation and continued processing.

Closes uutils#12828.
@limadog9
limadog9 force-pushed the fix/chmod-stat-error-context-12828 branch from 44f3193 to 9625395 Compare October 19, 2026 19:39

This branch has not been deployed

No deployments
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.

bug(chmod): when a file is a larger, the utility reports incorrect error messages

2 participants