Skip to content

chcon: report verbose write failures without panicking - #15382

Merged
sylvestre merged 1 commit into
uutils:mainfrom
limadog9:fix/chcon-verbose-write-error
Oct 24, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
limadog9:fix/chcon-verbose-write-error

Conversation

@limadog9

Copy link
Copy Markdown
Contributor

Report verbose output failures once while continuing file operations. Add a regression covering the panic and continued operand processing.

Closes #13061.

Comment thread src/uu/chcon/src/chcon.rs Outdated
println!(
if self.options.verbose && self.write_error.is_none() {
self.write_error = writeln!(
io::stdout().lock(),

@oech3 oech3 Oct 15, 2026 •

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.

.lock() is not useful when you write just once.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@oech3 Removed the unnecessary lock

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In general, we found .lock() can be a pessimization for code size, see #14220 (comment).

@limadog9
limadog9 force-pushed the fix/chcon-verbose-write-error branch from 213ebe9 to b06d08e Compare October 15, 2026 15:03
@sylvestre
sylvestre merged commit 3f1bbe5 into uutils:main Oct 24, 2026
99 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

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(chcon): redirecting --verbose output when the file exist to /dev/full will panic

4 participants