Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Robert Elz
Date:Fri, 30 Jun 2023 20:21:20 -0400 From:Eli Schwartz Message-ID: I suggested using set partly because it should work in any shell. The need, or even ability, to set posix mode is likely to differ, but that is minor. In general I vastly prefer highly portable solu

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Eli Schwartz
On 6/30/23 3:25 PM, Robert Elz wrote: > Date:Fri, 30 Jun 2023 18:35:34 +0100 > From:Kerin Millar > Message-ID: <20230630183534.85da7986a24855126bfea...@plushkava.net> > > | This can be trivially foiled. > > You mean it doesn't give you all the variable names? Why

Re: [PATCH] fix printing command after group with heredoc

2023-06-30 Thread Chet Ramey
On 6/29/23 4:05 AM, Grisha Levit wrote: If the last redirection list in a group / subshell / substitution has a heredoc and the following connector is a semicolon, the connector is incorrectly skipped over. Try this patch instead: *** ../bash-20230628/print_cmd.cMon Jun 26 16:56:46 202

Re: maybe a bug in bash?

2023-06-30 Thread Greg Wooledge
On Sat, Jul 01, 2023 at 05:47:33AM +0900, Dominique Martinet wrote: > hm, this has the password show up in ps on the box executing ssh; > depending on the context that can be bad. Fair enough. We have no way to judge the OP's risk analysis, because they've kept almost everything secret so far. I

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Eli Schwartz
On 6/30/23 12:53 PM, Chet Ramey wrote: >> And because this is conditional on readline, which is usually an >> external library dependency (a global system policy decision), reducing >> the number of shared libraries the dynamic loader has to deal with might >> be especially interesting. > > The dy

Re: maybe a bug in bash?

2023-06-30 Thread Dominique Martinet
Greg Wooledge wrote on Fri, Jun 30, 2023 at 10:36:36AM -0400: > > then as Greg suggested pass password to bash as argument instead; > > assuming password has been quoted once as previously: > > ssh user@machine << EOF > > bash -c 'echo \$1' -- $password > > EOF > > I never suggested embedding the

Re: [PATCH] printing multiple heredocs in list

2023-06-30 Thread Grisha Levit
On Fri, Jun 30, 2023, 16:02 Chet Ramey wrote: > On 6/29/23 4:01 AM, Grisha Levit wrote: > > If there are multiple commands in a row that each require printing the > > connector prior to the heredoc body, the connector ends up in the wrong > > place for commands after the first: > > OK. The parser

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Kerin Millar
On Sat, 01 Jul 2023 02:25:33 +0700 Robert Elz wrote: > Date:Fri, 30 Jun 2023 18:35:34 +0100 > From:Kerin Millar > Message-ID: <20230630183534.85da7986a24855126bfea...@plushkava.net> > > | This can be trivially foiled. > > You mean it doesn't give you all the vari

Re: [PATCH] printing multiple heredocs in list

2023-06-30 Thread Chet Ramey
On 6/29/23 4:01 AM, Grisha Levit wrote: If there are multiple commands in a row that each require printing the connector prior to the heredoc body, the connector ends up in the wrong place for commands after the first: OK. The parser builds lists (connections) left-side heavy. What do you think

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Robert Elz
Date:Fri, 30 Jun 2023 18:35:34 +0100 From:Kerin Millar Message-ID: <20230630183534.85da7986a24855126bfea...@plushkava.net> | This can be trivially foiled. You mean it doesn't give you all the variable names? Why not? Does bash have a bug in this area that I am un

Re: +=() can be used to set illegal indices

2023-06-30 Thread Emanuele Torre
On Fri, Jun 30, 2023 at 12:16:46PM -0400, Chet Ramey wrote: > > What I would have expected was something like this: > > > >$ x=([9223372036854775805]=foo) > >$ x+=( {1..5} ); echo "this won't run" > >bash: some "invalid assignment" error > >$ declare -p x # no value gets appended s

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Eli Schwartz
On 6/30/23 1:19 PM, Robert Elz wrote: > Date:Thu, 29 Jun 2023 23:05:38 +0100 > From:Kerin Millar > Message-ID: <20230629230538.cbef14a75694143ccf034...@plushkava.net> > > | The thing is that portage also has a legitimate stake in needing > | to enumerate all varia

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Kerin Millar
On Sat, 01 Jul 2023 00:19:41 +0700 Robert Elz wrote: > Date:Thu, 29 Jun 2023 23:05:38 +0100 > From:Kerin Millar > Message-ID: <20230629230538.cbef14a75694143ccf034...@plushkava.net> > > | The thing is that portage also has a legitimate stake in needing > | to en

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Robert Elz
Date:Thu, 29 Jun 2023 23:05:38 +0100 From:Kerin Millar Message-ID: <20230629230538.cbef14a75694143ccf034...@plushkava.net> | The thing is that portage also has a legitimate stake in needing | to enumerate all variable names. Why isn't "set" good enough for that?

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Chet Ramey
On 6/29/23 11:16 PM, Eli Schwartz wrote: I assume that, given the option exists in the configure script, there are people who will want to use the option made available to them. One reason might be because they are configuring it for a system that isn't fussed about using bash for an interactive

Re: +=() can be used to set illegal indices

2023-06-30 Thread Chet Ramey
On 6/29/23 6:24 AM, Emanuele Torre wrote: The fix in the most recent push did not fix the issue: $ x=([9223372036854775805]=foo) $ x+=( {1..5} ) $ echo "${x[@]}" 3 4 5 foo 1 2 It behaves exactly the same way: no error is printed, some elements are prepended instead of appended, and

Re: Enable compgen even when programmable completions are not available?

2023-06-30 Thread Chet Ramey
On 6/29/23 6:05 PM, Kerin Millar wrote: On Thu, 29 Jun 2023 16:39:52 -0400 Chet Ramey wrote: On 6/25/23 2:38 PM, Eli Schwartz wrote: compgen is a useful builtin for inspecting information about the shell context e.g. in scripts -- a good example of this is compgen -A function or compgen -A va

Re: maybe a bug in bash?

2023-06-30 Thread Greg Wooledge
On Fri, Jun 30, 2023 at 11:17:06PM +0900, Dominique Martinet wrote: > Sebastian Luhnburg wrote on Fri, Jun 30, 2023 at 03:47:57PM +0200: > > p.s.: in the final script, it is only one SSH: > > > > ssh user@machine << EOF > > /bin/bash -c "do something with the password" > > EOF I wish you would re

Re: maybe a bug in bash?

2023-06-30 Thread Dominique Martinet
Sebastian Luhnburg wrote on Fri, Jun 30, 2023 at 03:47:57PM +0200: > /bin/bash -c "echo 'password in subshell in here document: ' ${password@Q}" ${password@Q} is still within double quotes in your here-document here; these quotes are breaking the escaping you used. This would be out of quotes: ba

Re: maybe a bug in bash?

2023-06-30 Thread Greg Wooledge
On Fri, Jun 30, 2023 at 03:49:23PM +0200, Sebastian Luhnburg wrote: > You suggest to use an argument, to pass the password. Please correct me if I > be wrong, but to write one or more password(s) in clear text as an argument > in the terminal (./myscript.sh password1 password2) is not the best prac

Re: maybe a bug in bash?

2023-06-30 Thread Sebastian Luhnburg
Hello Greg, thank you for your quick answer, too! First, I am not a Bash mastermind or have deeper knowledge about secure programming. Your suggestion about the risk of coding injection is very interesting! But I will read the full text after my holidays, which will begin after this E-Mail :)

Re: maybe a bug in bash?

2023-06-30 Thread Sebastian Luhnburg
Thank you very much for your quick answer! I am not sure what do you mean with "open the quote"? I try to copy your example, but my copy did not work. I wrote this: #!/usr/bin/env bash initial_password='$abc&xyz' echo "initial password: " $initial_password among_password="${initial_password@Q

Re: [PATCH] sleep builtin signal handling

2023-06-30 Thread Emanuele Torre
On Fri, Jun 30, 2023 at 08:53:16AM +0200, Phi Debian wrote: > Well > > ┌─none:/home/phi > └─PW$ type sleep > sleep is hashed (/usr/bin/sleep) > > So sleep is not a builtin here. This patch is for the sleep loadable builtin example distributed with bash. You can activate it using enable -f "$(