mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 03:02:55 +08:00

A weird interaction between grouped short options and our weird option parsing that puts unknown options back: ``` echo "-n foo" ``` would see the `-n`, turn off printing newlines, interpret the " " as another grouped short option, see that there is no short option for space and put the entire token back on the arguments pile. So it would print "-n foo" *without a newline*. Fix this by keeping an old state of the options around and reverting it when putting options back. The alternative is *probably* to forbid the " " short option in wgetopt, then check if an option group contains it and error out, but this should only really be a problem in `echo` because that is, AFAICT, the only thing that puts the options back. Fixes #7614