Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coreutils: fixed panic when multi-call binary has funny name #4366

Merged
merged 1 commit into from
Apr 28, 2023

Conversation

BartMassey
Copy link
Contributor

The multi-call coreutils binary starts by trying to convert its invocation path into a UTF-8 string, panicking if this doesn't work.

This patch makes coreutils exit gracefully in this case.

…name

The multi-call `coreutils` binary starts by trying to
convert its invocation path into a UTF-8 string, panicking
if this doesn't work.

This patch makes `coreutils` exit gracefully in this case.
@sylvestre
Copy link
Contributor

Cool, thanks. Would it be possible to write a test to make sure we don't regress in the future ?

@BartMassey
Copy link
Contributor Author

To be honest, I'm not sure what test would be worth inserting here. As long as name() returns an Option, I think things are good.

Any reasonable test would have to manipulate the host filesystem in odd ways, and would be unlikely to be very portable.

I'll think about what might be done.

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Feb 15, 2023

Maybe an integration test that just calls the binary with invalid utf-8 in this file: https://github.com/uutils/coreutils/blob/main/tests/test_util_name.rs?

Edit: Nevermind that's still difficult.

@sylvestre sylvestre merged commit b33986d into uutils:main Apr 28, 2023
@BartMassey
Copy link
Contributor Author

Thanks!

@sylvestre
Copy link
Contributor

Thank you and sorry for the latency !

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.

3 participants