coreutils
coreutils copied to clipboard
coreutils: fixed panic when multi-call binary has funny 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.
Cool, thanks. Would it be possible to write a test to make sure we don't regress in the future ?
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.
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.
Thanks!
Thank you and sorry for the latency !