Re: suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Zachary Santer
On Wed, Jul 26, 2023 at 10:25 AM Kerin Millar wrote: > echo() { local IFS=' '; printf '%s\n' "$*"; } There's a simple solution. Ha. Thank you.

Re: suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Zachary Santer
I managed to set xpg_echo on in bash and then forget that I did that. I was using echo's behavior with -n to determine if set -o posix had taken effect, when it's completely unrelated. And sh in MSYS2 is definitely just bash with set -o posix on. What I get for rushing. However, the man page for b

[PATCH v2] read: non-raw-mode fixes

2023-07-26 Thread Grisha Levit
On Wed, Jul 26, 2023 at 2:23 PM Grisha Levit wrote: > If the last character read was an (unescaped) backslash, store it as > such instead of as a CTLESC. Avoids: > > $ printf '\\' | { read; echo "${REPLY@Q}"; } > bash: DEBUG warning: dequote_string: string with bare CTLESC > $'\001' Sorry that w

Re: built-in printf returns success when integer is out of range

2023-07-26 Thread Lawrence Velázquez
> On Jul 26, 2023, at 5:14 PM, tho...@habets.se wrote: > > On Wed, 26 Jul 2023 21:52:32 +0100, Dennis Williamson > said: >> You didn't include all the output. It's treated as a warning rather than an >> error. That's why an error status isn't set. > > Ah indeed, the stderr message with bash buil

Re: [PATCH] fix bind -X quoting

2023-07-26 Thread Grisha Levit
On Wed, Jul 26, 2023, 16:06 Chet Ramey wrote: > > On 7/24/23 1:13 PM, Chet Ramey wrote: > > > You could do it if you allowed, say > > > > bind -x '"\eX": \"command with spaces\" \"x\"' > > > > and then stripped the backslashes before calling rl_generic_bind, but > > that's not exactly backwards co

Re: built-in printf returns success when integer is out of range

2023-07-26 Thread thomas
On Wed, 26 Jul 2023 21:52:32 +0100, Dennis Williamson said: >> Configuration Information [Automatically generated, do not change]: >> Machine: x86_64 >> OS: linux-gnu >> Compiler: gcc >> Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat >> -Werror=format-security -Wall >> uname output:

Re: built-in printf returns success when integer is out of range

2023-07-26 Thread Dennis Williamson
On Wed, Jul 26, 2023, 3:40 PM wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat > -Werror=format-security -Wall > uname output: Linux fnord42 6.1.25-1rodete1

built-in printf returns success when integer is out of range

2023-07-26 Thread thomas
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux fnord42 6.1.25-1rodete1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.25-1rodete1

Re: [PATCH] fix bind -X quoting

2023-07-26 Thread Chet Ramey
On 7/24/23 1:13 PM, Chet Ramey wrote: You could do it if you allowed, say bind -x '"\eX": \"command with spaces\" \"x\"' and then stripped the backslashes before calling rl_generic_bind, but that's not exactly backwards compatible either. Thinking about it some more, you can do it like this:

[PATCH] read: non-raw-mode fixes

2023-07-26 Thread Grisha Levit
This patches addresses a few issues with `read' when not in raw mode. If the last character read was an (unescaped) backslash, store it as such instead of as a CTLESC. Avoids: $ printf '\\' | { read; echo "${REPLY@Q}"; } bash: DEBUG warning: dequote_string: string with bare CTLESC $'\001' If an

Re: Tilde (~) in bash(1) is typeset incorrectly as Unicode character

2023-07-26 Thread G. Branden Robinson
Hi Thomas, At 2023-07-26T10:47:05+0200, Thomas ten Cate wrote: > In the bash manual page (`man bash`), the ASCII tilde character '~' > (0x7e) is replaced by the Unicode character '˜' (U+02DC SMALL TILDE): > > $ man bash | grep 'additional binary operator' > An additional bin

Re: Tilde (~) in bash(1) is typeset incorrectly as Unicode character

2023-07-26 Thread Chet Ramey
On 7/26/23 4:47 AM, Thomas ten Cate wrote: Bash Version: 5.1 Patch Level: 16 Release Status: release Description: In the bash manual page (`man bash`), the ASCII tilde character '~' (0x7e) is replaced by the Unicode character '˜' (U+02DC SMALL TILDE): $ man bash | grep 'additional binary

Re: suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Zachary Santer
Oh, that's weird. I just assumed that sh would be running bash with 'set -o posix'. Evidently, not in MSYS2. 'man sh' takes me to the Bash man page. When I run sh, 'set -o posix' has no effect, but it definitely makes echo not interpret any arguments as options when I'm in bash. And I'm again not

Re: suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Kerin Millar
On Wed, 26 Jul 2023, at 1:42 PM, Zachary Santer wrote: > bash's echo command is broken - YouTube > > > To restate what's in the video, you can't safely use echo to print the > contents of a variable that could be arbitrary, because the variable could >

Re: suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Chet Ramey
On 7/26/23 10:15 AM, Zachary Santer wrote: Oh, that's weird. I just assumed that sh would be running bash with 'set -o posix'. Evidently, not in MSYS2. 'man sh' takes me to the Bash man page. Weird. I don't use MSYS2, but that's how it works on Unix/Linux systems. When I run sh, 'set -o posix

Re: suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Greg Wooledge
On Wed, Jul 26, 2023 at 08:42:15AM -0400, Zachary Santer wrote: > To restate what's in the video, you can't safely use echo to print the > contents of a variable that could be arbitrary, because the variable could > consist entirely of '-n', '-e', or '-E', and '--' is not interpreted as the > end o

Re: suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Chet Ramey
On 7/26/23 8:42 AM, Zachary Santer wrote: If POSIX mandates that '--' not be taken as the end of options, then the safe thing would be to simply not have echo take any options. Obviously, that would break backwards compatibility, so you'd want this to be optional behavior that the shell programm

Tilde (~) in bash(1) is typeset incorrectly as Unicode character

2023-07-26 Thread Thomas ten Cate
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-pro

suggestion: shell option for echo to not interpret any argument as an option

2023-07-26 Thread Zachary Santer
bash's echo command is broken - YouTube To restate what's in the video, you can't safely use echo to print the contents of a variable that could be arbitrary, because the variable could consist entirely of '-n', '-e', or '-E', and '--' is not interpret