coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

timeout/uucore: Should accept all casings of signal name

Open BenWiederhake opened this issue 1 year ago • 0 comments

kill accepts signal names regardless of the casing: #6217

timeout accepts signal names regardless of the casing (this issue):

$ cargo run -q --features timeout timeout -s TeRm 0.1 sleep 999
timeout: 'TeRm': invalid signal
Try 'target/debug/coreutils timeout --help' for more information.
[$? = 125]
$ timeout -s TeRm 0.1 sleep 999
[$? = 124]

env accepts signal names regardless of the casing (found while reviewing #6377):

$ env --ignore-signal=tErM sleep 0.1
$ env --ignore-signal=invalid sleep 0.1 # and it really tries to parse it!
env: 'invalid': invalid signal
Try 'env --help' for more information.
[$? = 125]

That's all current (and probably all future) callers of uucore::signals::signal_by_name_or_value (uucore/src/lib/features/signals.rs:342). Therefore, I suggest that we change the implementation of signal_by_name_or_value to accept any casing, which would simplify kill, fix timeout, and prevent a bug in env.

BenWiederhake avatar May 07 '24 19:05 BenWiederhake