Re: unreliable value of LINENO variable

2023-12-07 Thread Chet Ramey
On 12/4/23 2:24 PM, Giacomo Comes wrote: The script I was using was more complicated. I did simplify it and I tested the simpler version only with bash 5.0, assuming it would fail with 5.1 and 5.2 too. The following one fails with every 5.x version: --

Re: unreliable value of LINENO variable

2023-12-04 Thread Phi Debian
Confirmed on Ubuntu 22.04.3 LTS -- $ cat ~/yo.sh echo $BASH_VERSION echo 0 $LINENO if ((1)); then ( : ) | : ; echo 1 $LINENO fi echo 2 $LINENO $ for s in bash ./bash ksh zsh > do printf "\n$s\n" ; $s ~/yo.sh > done bash 5.1.16(1)-release 0 2 1 4 2 5

Re: unreliable value of LINENO variable

2023-12-04 Thread Giacomo Comes
On Mon, Dec 04, 2023 at 12:21:11PM -0500, Chet Ramey wrote: > On 12/4/23 8:46 AM, Giacomo Comes wrote: > > I use often the value of LINEO in order > > to know where to look for issues in a script. > > Recently I discovered a bug. > > > > Please consider the following 6 line script: > >

Re: unreliable value of LINENO variable

2023-12-04 Thread alex xmb sw ratchev
i ve experienced many ghost fails .. got better over time and knowerledge greets On Mon, Dec 4, 2023, 18:21 Chet Ramey wrote: > On 12/4/23 8:46 AM, Giacomo Comes wrote: > > I use often the value of LINEO in order > > to know where to look for issues in a script. > > Recently I discovered a bug.

Re: unreliable value of LINENO variable

2023-12-04 Thread Chet Ramey
On 12/4/23 8:46 AM, Giacomo Comes wrote: I use often the value of LINEO in order to know where to look for issues in a script. Recently I discovered a bug. Please consider the following 6 line script: #!/bin/bash if ((1)); then ( : ) ; ec

unreliable value of LINENO variable

2023-12-04 Thread Giacomo Comes
I use often the value of LINEO in order to know where to look for issues in a script. Recently I discovered a bug. Please consider the following 6 line script: #!/bin/bash if ((1)); then ( : ) ; echo 1 $LINENO fi echo 2 $LINENO -