Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Martin D Kealey
On Sat, 14 Oct 2023 at 06:33, Robert Elz wrote: > The issue we have (which possibly might be similar in bash, but only > possibly - but it would explain the symptoms) is that when one does > > VAR=value command > > "VAR" is essentially made a local variable for command, so its value > in

Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Kerin Millar
On Fri, 13 Oct 2023 13:02:30 -0400 Ti Strga wrote: > First off, I have a feeling that GMail is going to garble the line > wrapping in this message; I cannot get it to stop being "helpful". > Apologies if that happens. > > I've encountered some behavior that I cannot find described anywhere in >

Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Grisha Levit
On Fri, Oct 13, 2023, 10:03 Ti Strga wrote: > [*] Alternatively, there's the trick about putting the entire script > contents inside a compound statement to force the parser to read it all, > but that just makes the script harder for a human to read. Copy-and-exec > makes the top-level scripts c

Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Chet Ramey
On 10/13/23 1:02 PM, Ti Strga wrote: First off, I have a feeling that GMail is going to garble the line wrapping in this message; I cannot get it to stop being "helpful". Apologies if that happens. I've encountered some behavior that I cannot find described anywhere in the man page, and I'm hopi

Re: bash tries to parse comsub in quoted PE pattern

2023-10-13 Thread Chet Ramey
On 10/13/23 12:08 PM, Emanuele Torre wrote: In a PE pattern, if the pattern has a single quoted part that contains $( and does not contain a closing parenthesis, and has \' at the end, bash will try to parse a command substitution and fail. This is brace expansion. It looks like I'll have

Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Robert Elz
Date:Fri, 13 Oct 2023 14:21:59 -0400 From:"Dale R. Worley" Message-ID: <87bkd2idrs@hobgoblin.ariadne.com> | but I coded an instance of | your description (above), and it does not show the dubious behavior that | you report. Your test isn't accomplishing wha

Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Greg Wooledge
On Fri, Oct 13, 2023 at 02:21:59PM -0400, Dale R. Worley wrote: > I was too lazy to chew through your example, but I coded an instance of > your description (above), and it does not show the dubious behavior that > you report. Specifically, > > $ bash -version > GNU bash, version 5.1.0(1)

Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Ti Strga
On Fri, Oct 13, 2023 at 2:22 PM Dale R. Worley wrote: > $ bash -version > GNU bash, version 5.1.0(1)-release (x86_64-redhat-linux-gnu) If I can get 5.1.x installed, I'll try with that; if the behavior is no longer exhibited then it's possible something got wonky between then and 5.2.15.

Re: variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Dale R. Worley
Ti Strga writes: > The summary is that if a parameter is set specifically for a '.'/'source' > command, and the source'd file calls 'exec' to run another script, then > that exec'd script cannot unset the parameter; if we want that parameter > to not be present in the exec'd script, then the sourc

variable set in exec'ing shell cannot be unset by child shell

2023-10-13 Thread Ti Strga
First off, I have a feeling that GMail is going to garble the line wrapping in this message; I cannot get it to stop being "helpful". Apologies if that happens. I've encountered some behavior that I cannot find described anywhere in the man page, and I'm hoping to learn whether it's a bug (it seem

Re: [PATCH] expanding $'\c^A'

2023-10-13 Thread Grisha Levit
On Fri, Oct 13, 2023, 09:13 Chet Ramey wrote: > On 10/13/23 12:36 AM, Grisha Levit wrote: > > Handle $'\c^A' and $'\c^?' correctly when expanded by the parser: > > > > $ bash -c $'printf "%q\n" $\'\\c\001 \\c\177\'' > > $'\001\001 \001\177' > > > > --- > > diff --git a/lib/sh/strtrans.c b/lib/sh/

Re: [PATCH] expanding $'\c^A'

2023-10-13 Thread Chet Ramey
On 10/13/23 12:36 AM, Grisha Levit wrote: Handle $'\c^A' and $'\c^?' correctly when expanded by the parser: $ bash -c $'printf "%q\n" $\'\\c\001 \\c\177\'' $'\001\001 \001\177' --- diff --git a/lib/sh/strtrans.c b/lib/sh/strtrans.c index d3b27f3b..3df33ade 100644 --- a/lib/sh/strtrans.c +++ b/l

bash tries to parse comsub in quoted PE pattern

2023-10-13 Thread Emanuele Torre
In a PE pattern, if the pattern has a single quoted part that contains $( and does not contain a closing parenthesis, and has \' at the end, bash will try to parse a command substitution and fail. $ echo "${HOME#'$('\'}" bash: command substitution: line 3: unexpected EOF while looking

Re: [PATCH] parser handling of \^A

2023-10-13 Thread Chet Ramey
On 10/13/23 12:36 AM, Grisha Levit wrote: AFAICT, everything works fine if parse_matched_pair just stores \^A as is (as long as dequote_string doesn't drop trailing ^A's). This seems a lot easier than the alternative of teaching the subst.c functions to handle \^A^A and \^A^? specially but mayb

e-mail address for reports concerning the bash manual

2023-10-13 Thread Vincent Lefevre
Hi, For reports concerning the bash manual, the tarballs (5.2, 5.2.15) and the Git repository say to Chet Ramey's address (both in the man page and in the HTML file). But https://www.gnu.org/software/bash/manual/html_node/Reporting-Bugs.html says "Please send all reports concerning this manual

Re: PATCH] unquoted_glob_pattern_p: better recognition

2023-10-13 Thread Chet Ramey
On 10/12/23 7:11 PM, Grisha Levit wrote: On Sat, Oct 7, 2023 at 9:57 AM Chet Ramey wrote: On 9/26/23 2:25 AM, Grisha Levit wrote: A CTLESC-escaped character should be treated as such even if it follows an unquoted backslash, same as in quote_string_for_globbing: Thanks for the report and pa

value of $? and exit status are partially undocumented, possibly wrong

2023-10-13 Thread Vincent Lefevre
With bash 5.2.15(1)-release under Debian (bash 5.2.15-2+b6 package), on one of my machines: $ bash -c 'echo $?' 0 $ bash vlefevre@cventin:~$ echo $? 0 $ bash ; echo $? vlefevre@cventin:~$ exit exit 0 and on another one: $ bash -c 'echo $?' 0 $ bash vinc17@zira:~$ echo $? 1 $ bash ; echo $? v