Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
Date:Wed, 02 Feb 2022 17:18:08 -0800 From:L A Walsh Message-ID: <61fb2d50.7010...@tlinx.org> | My posix non-conformance issue has to do with bash not starting with | aliases enabled by default in all default invocations. If you're using aliases in scripts, then j

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Alex fxmbsw7 Ratchev
i see only two solutions as an option one option does expand aliases inside safe out of the tree the other more eval ing On Thu, Feb 3, 2022, 02:27 L A Walsh wrote: > > > On 2022/02/02 08:50, Chet Ramey wrote: > > On 2/2/22 8:25 AM, L A Walsh wrote: > > > > > >> I.e. My bash is posix compliant b

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/02/02 08:50, Chet Ramey wrote: On 2/2/22 8:25 AM, L A Walsh wrote: I.e. My bash is posix compliant by default w/r/t aliases: It's not, and that's how this whole issue got started. You're running bash-4.4. POSIX requires the following to work: alias switch=case echo $(switc

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Alex fxmbsw7 Ratchev
On Wed, Feb 2, 2022, 21:59 Chet Ramey wrote: > On 2/2/22 1:40 PM, Martijn Dekker wrote: > > Op 01-02-22 om 15:23 schreef Chet Ramey: > >> Historically, bash (and ksh93) has favored the former. Just about all > the > >> other shells claiming some sort of POSIX conformance favor the latter > (all >

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/2/22 1:40 PM, Martijn Dekker wrote: > Op 01-02-22 om 15:23 schreef Chet Ramey: >> Historically, bash (and ksh93) has favored the former. Just about all the >> other shells claiming some sort of POSIX conformance favor the latter (all >> the ash-based shells, yash, mksh). >> >> What are your pl

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/2/22 11:14 AM, L A Walsh wrote: > On 2022/02/01 07:50, Chet Ramey wrote: >> >> >> "Historically some shells used simple parenthesis counting to find the >> terminating ')' and therefore did not account for aliases. However, such >> shells never conformed to POSIX, which has always required rec

Re: Bash not escaping escape sequences in directory names

2022-02-02 Thread Lawrence Velázquez
On Wed, Feb 2, 2022, at 9:30 AM, L A Walsh wrote: > Instead of worrying about effects of dirnames on PS1, one might worry > about how the directory names were created in the first place, and then > worry about why one would deliberately 'cd' into such a directory. https://en.wikipedia.org/wiki/Red

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
Date:Wed, 2 Feb 2022 11:38:30 -0500 From:Chet Ramey Message-ID: <7c422cbb-bba8-0a57-a565-eeb115120...@case.edu> | > How accurately can you reconstitute? That is, can you maintain the | > difference between $(a b) and $( a b ) for example ? How about $(a b) ?

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Martijn Dekker
Op 01-02-22 om 15:23 schreef Chet Ramey: Historically, bash (and ksh93) has favored the former. Just about all the other shells claiming some sort of POSIX conformance favor the latter (all the ash-based shells, yash, mksh). What are your plans here? I've no current plans. Any remotely plausib

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/2/22 8:25 AM, L A Walsh wrote: > I.e. My bash is posix compliant by default w/r/t aliases: It's not, and that's how this whole issue got started. You're running bash-4.4. POSIX requires the following to work: alias switch=case echo $(switch foo in foo) echo ok 2;; esac ) and it simply does

Re: How to display parameters in a function backtrace?

2022-02-02 Thread Chet Ramey
On 2/2/22 9:00 AM, L A Walsh wrote: > I was trying to find parameters to a function that gave an error, so > I 'turned on' (included my backtracing routine), which showed: > > ./24bc: line 46: printf: `txt=\nRed,': not a valid identifier > STOPPING execution @ "printf ${_:+-v $_} '\x1b[48;2;%s;%s;

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/1/22 5:31 PM, Robert Elz wrote: > Date:Tue, 1 Feb 2022 15:39:06 -0500 > From:Chet Ramey > Message-ID: <2816cf78-d7be-b9e1-733d-12427b04c...@case.edu> > > | When you say "just parsed," when are aliases expanded? > > During lexical analysis, right between when t

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
And I forgot to say, that obviously for this, aliases need to be being expanded, if they're not, there cannot possibly be an issue with aliases, can there? kre

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/02/01 07:50, Chet Ramey wrote: "Historically some shells used simple parenthesis counting to find the terminating ')' and therefore did not account for aliases. However, such shells never conformed to POSIX, which has always required recursive parsing (see XCU 2.3 item 5)."

Re: How to display parameters in a function backtrace?

2022-02-02 Thread L A Walsh
On 2022/02/02 06:43, Alex fxmbsw7 Ratchev wrote: i had gdb new version --- This is about looking at a backtrace of shell functions in shell gdb may show a backtrace of shell functions, but gdb isn't a shell debugger, but one for the source code of bash. If you look at my backtrace function

Re: How to display parameters in a function backtrace?

2022-02-02 Thread Alex fxmbsw7 Ratchev
my fault misunderstanding then too, sorry too cheers On Wed, Feb 2, 2022, 15:52 L A Walsh wrote: > > > On 2022/02/02 06:43, Alex fxmbsw7 Ratchev wrote: > > i had gdb new version > --- > This is about looking at a backtrace of shell functions in shell > > gdb may show a backtrace of shell functio

Re: How to display parameters in a function backtrace?

2022-02-02 Thread Alex fxmbsw7 Ratchev
the attached text is how it looks like since newly On Wed, Feb 2, 2022 at 3:35 PM L A Walsh wrote: > > I was trying to find parameters to a function that gave an error, so > I 'turned on' (included my backtracing routine), which showed: > > ./24bc: line 46: printf: `txt=\nRed,': not a valid ident

Re: How to display parameters in a function backtrace?

2022-02-02 Thread Alex fxmbsw7 Ratchev
i had gdb new version and then it all displayed already all params to funcs and stuff (once seen) On Wed, Feb 2, 2022, 15:35 L A Walsh wrote: > I was trying to find parameters to a function that gave an error, so > I 'turned on' (included my backtracing routine), which showed: > > ./24bc: line 4

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Martijn Dekker
Op 02-02-22 om 13:25 schreef L A Walsh: I can't say for sure, but it would be interesting if anyone else has this result in a bash with aliases on by default: I.e. My bash is posix compliant by default w/r/t aliases:  env -i /bin/bash --noprofile --norc bash-4.4$ shopt -p expand_aliases Of c

Re: Bash not escaping escape sequences in directory names

2022-02-02 Thread L A Walsh
BTW, thinking about how this problem would arise On 2022/01/20 22:43, Lawrence Velázquez wrote: Depends what you consider to be an issue. Personally, I would be less than pleased if my whole terminal turned red just because I changed into a directory that happened to have a weird name. S

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
Date:Wed, 02 Feb 2022 05:25:30 -0800 From:L A Walsh Message-ID: <61fa864a.7090...@tlinx.org> | On 2022/01/31 20:40, Martijn Dekker wrote: | > On the latest code from the devel branch: | I can't say for sure, but it would be interesting if anyone else | has th

How to display parameters in a function backtrace?

2022-02-02 Thread L A Walsh
I was trying to find parameters to a function that gave an error, so I 'turned on' (included my backtracing routine), which showed: ./24bc: line 46: printf: `txt=\nRed,': not a valid identifier STOPPING execution @ "printf ${_:+-v $_} '\x1b[48;2;%s;%s;%sm' $1 $2 $3" in "setBgColor()" at ./24bc #

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Alex fxmbsw7 Ratchev
ive had many inconsistency with bash this regarding exoerienced On Wed, Feb 2, 2022, 15:00 L A Walsh wrote: > On 2022/01/31 20:40, Martijn Dekker wrote: > > On the latest code from the devel branch: > > GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) > > > > Reproducer script: > > >

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/01/31 20:40, Martijn Dekker wrote: On the latest code from the devel branch: GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) Reproducer script: shopt -s expand_aliases alias let='let --' set -x let '1 == 1' : $(let '1 == 1') Output: + let -- '1 == 1' ++ let -- -- '1 == 1'