Re: About `M-C-e` expand result `'` failed

2024-02-06 Thread Chet Ramey
On 2/3/24 7:44 AM, Martin D Kealey wrote: On Wed, 31 Jan 2024 at 01:04, Andreas Schwab wrote: On Jan 30 2024, Zachary Santer wrote: There's no way this is the intended behavior, right? The command is doing exactly what it is documented to do, that is do all of the shell word expansions.

Re: Feature request: prompt strings in output from edit-and-execute-command readline function ( was About `M-C-e` expand result `'` failed )

2024-02-06 Thread Chet Ramey
On 2/3/24 10:43 PM, Oğuz wrote: I want to make one too. Multiline commands retrieved from history can be short-circuited like this: $ ls x y $ echo ' > rm * > ' >z $ $ ls x y z $ echo '' rm * ' >z > ^C $ ls $ After the second invocation of `ls' I a

Re: Feature request: prompt strings in output from edit-and-execute-command readline function ( was About `M-C-e` expand result `'` failed )

2024-02-06 Thread Oğuz
On Tuesday, February 6, 2024, Chet Ramey wrote: > > What's the specific request here? > That bash interpret multiline commands retrieved from command history as a whole and not run the rest of the lines as separate commands when the first line is changed. Try it yourself; run a multiline command,

Re: About `M-C-e` expand result `'` failed

2024-02-06 Thread Chet Ramey
On 2/3/24 10:58 PM, Martin D Kealey wrote: On Sun, 4 Feb 2024, 02:01 Koichi Murase, wrote: I now think I should leave a comment because even Martin (who I believed was one of the careful people about backward compatibility as seen in [1,2]) seems to suggest a breaking change. That's a fair

Re: About `M-C-e` expand result `'` failed

2024-02-06 Thread Chet Ramey
On 2/4/24 2:35 AM, Martin D Kealey wrote: PS: Sadly M-C-r seems to be already taken, so I can't just hop one key over. You can rebind it, you know. Anyway, let's assume the existence of a new bindable command that (shell) quotes the (shell? readline?) words on a line. Let's assume that this ne

Re: About `M-C-e` expand result `'` failed

2024-02-06 Thread Zachary Santer
On Tue, Feb 6, 2024 at 2:35 PM Chet Ramey wrote: > and add a second bindable function -- which would add the same keypress -- > to quote the words. > Would Bash be saving what the line looked like before it performed quote removal with M-C-e, and replacing what's on the command-line with that wh

Re: Feature request: prompt strings in output from edit-and-execute-command readline function ( was About `M-C-e` expand result `'` failed )

2024-02-06 Thread Chet Ramey
On 2/3/24 10:18 PM, Zachary Santer wrote: While I'm making feature requests. I hit C-x C-e and enter the following into my editor: var='duck' declare -p var (   var='squirrel'   declare -p var ) declare -p var I save that and exit my editor, and this is what I get in the terminal: zsant@Za

Re: About `M-C-e` expand result `'` failed

2024-02-06 Thread Chet Ramey
On 2/6/24 3:04 PM, Zachary Santer wrote: On Tue, Feb 6, 2024 at 2:35 PM Chet Ramey > wrote: and add a second bindable function -- which would add the same keypress -- to quote the words. Would Bash be saving what the line looked like before it performed quot

Re: Feature request: prompt strings in output from edit-and-execute-command readline function ( was About `M-C-e` expand result `'` failed )

2024-02-06 Thread Chet Ramey
On 2/6/24 1:39 PM, Oğuz wrote: On Tuesday, February 6, 2024, Chet Ramey > wrote: What's the specific request here? That bash interpret multiline commands retrieved from command history as a whole and not run the rest of the lines as separate commands when the f

Re: About `M-C-e` expand result `'` failed

2024-02-06 Thread Mike Jonkmans
On Tue, Feb 06, 2024 at 02:59:21PM -0500, Chet Ramey wrote: > On 2/4/24 2:35 AM, Martin D Kealey wrote: > > > PS: Sadly M-C-r seems to be already taken, so I can't just hop one key over. > > You can rebind it, you know. Anyway, let's assume the existence of a new > bindable command that (shell) q

Re: About `M-C-e` expand result `'` failed

2024-02-06 Thread Zachary Santer
On Tue, Feb 6, 2024 at 3:13 PM Chet Ramey wrote: > There are other places (e.g., ${var@Q} where bash chooses the most > appropriate form of quoting. Why not here? zsant@Zack2021HPPavilion MINGW64 ~ $ animal='dog' zsant@Zack2021HPPavilion MINGW64 ~ $ action='chases the cat' zsant@Zack2021HPPav

Re: Feature request: prompt strings in output from edit-and-execute-command readline function ( was About `M-C-e` expand result `'` failed )

2024-02-06 Thread Zachary Santer
On Tue, Feb 6, 2024 at 3:07 PM Chet Ramey wrote: > This is more like sourcing a file with `set -v' temporarily enabled (in > fact, it's very close to that). > Can't imagine POSIX would be amenable to all the 'set -v' output lines being prepended with PS2s, but that actually suffers from the same

[PATCH] retry opening startup files on EINTR

2024-02-06 Thread Grisha Levit
I have some dotfiles symlinked to storage backed by a macOS File Provider extension (e.g. Dropbox): $ realpath ~/.bash_profile /Users/levit/Library/CloudStorage/Dropbox/profile/.bash_profile This normally works fine, except when my terminal emulator (tested both Terminal.app and iTerm) re

[PATCH] ASS_NOEVAL for BASHOPTS and SHELLOPTS

2024-02-06 Thread Grisha Levit
(Prompted by the report from Emanuele Torre in [1]) The value of currently_executing_command is garbage when there is an error during assignment when popping the variable context: $ bash -c 'declare -i SHELLOPTS; f() { local -; set -f; }; f' |& cat -v bash: line 1: M-`^WM-R^N^\{: braceexp

declare -Aa var

2024-02-06 Thread Grisha Levit
If given both the -a and -A flags and an existing scalar variable, declare will assign both attributes to the variable: $ V=X; declare -Aa V; echo $? 0 $ echo ${V@a} aA $ (declare -p V) Segmentation fault: 11

declare -A +A

2024-02-06 Thread Grisha Levit
If a single declare command both sets and unsets the array or assoc attribute for an existing scalar variable, the `value' member of the SHELL_VAR is assigned an ARRAY* or HASH_TABLE* as appropriate, but later ends up treated as a char*: $ bash-asan -c 'X=Y; declare -A +A X; declare -p X'