stty erase returns "invalid argument" on MacOS
On MacOS stty returns an error instead of setting the erase character.
/bin/stty erase ^H
works as expected. But (from MacPorts)
/opt/local/libexec/uutils/stty erase ^H
/opt/local/libexec/uutils/stty: invalid argument 'erase'
Nonetheless, erase is listed as a control character:
/opt/local/libexec/uutils/stty -a
speed 9600 baud; rows 54; columns 169;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixoff -tandem ixon ixany imaxbel -iutf8
opost -ocrnl onlcr -onocr -onlret -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe -echok -echonl -noflsh -tostop -echoprt echoctl echoke -flusho -extproc
This behavior has also been replicated in debug mode on the current repo:
cargo build --bin coreutils --features macos
./target/debug/coreutils stty erase ^H
stty: invalid argument 'erase'
Thanks for filing! Here's a bit of guidance for people who want to look into this. This seems to be part of https://github.com/uutils/coreutils/issues/3861, because setting special characters is not supported yet. So it's not just erase but all control characters.
Hi! Could I be assigned this issue? I'm interested in resolving it.
Thank you!
I'm interested in working on this issue. I'd like to use a similar approach to this. But instead of using apply_flag(...), maybe create a new function like apply_char_mapping(...) as the control characters are not flags.
Fixed by https://github.com/uutils/coreutils/pull/7931