adding lineno implementation
daggs
daggs at gmx.com
Mon Feb 12 15:38:44 UTC 2018
Greetings Denys,
> Sent: Monday, February 12, 2018 at 8:09 AM
> From: daggs <daggs at gmx.com>
> To: "Denys Vlasenko" <vda.linux at googlemail.com>
> Cc: busybox <busybox at busybox.net>
> Subject: Re: adding lineno implementation
>
> Greetings Denys,
>
> > On Thu, Feb 8, 2018 at 1:55 PM, daggs <daggs at gmx.com> wrote:
> > > I've tested the implementation on 1.28.0 with the two following patches:
> > > https://git.busybox.net/busybox/commit/shell/hush.c?id=b8d076b00bad9da87e6dcaf4f36dfd06e2d2e5e8
> > > https://git.busybox.net/busybox/commit/shell/hush.c?id=6aad1ddcc9d8fe2303cc444b6ddea2af1fc1dd30
> > > on the test script I've posted in the first mail and the output is as follows:
> > > $ ./busybox hush test.sh
> > > hush: using fallback suid method
> > > at line 5
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 6
> > > at line 10
> > > hello world 10
> > >
> > > that differs from the bash output, the line that is printed most is actually in line 7 and not 6.
> > > I think this implementation suffers from a similar but my implementation suffered.
> >
> >
> > Reproduced.
> >
> > while ....; do
> > echo ...
> > done
> >
> > hush parser thinks that the command is "do echo ..." :) and therefore
> > it starts on line-1.
> >
> > Fixed in git, please try now.
> >
>
> indeed that worked but there is another scenario it goes haywire.
> I'll try to provide a test case script that reproduces it soon.
>
> Thanks for all the hard work,
>
> Dagg.
> _______________________________________________
here is another test case that goes bad"
cat -n test.sh
1 #!/bin/bash
2
3 echo "E${LINENO}"
4 echo "$(readlink -f /proc/self/fd/2)" > /tmp/fd.old
5 echo "E${LINENO}"
6 exec 2>> /tmp/err.txt
7 echo "E${LINENO}"
./test.sh
E3
E6
E8
Dagg.
More information about the busybox
mailing list