|
From: Karl-Friedrich R. <mai...@gm...> - 2012-10-31 15:51:02
|
Hi,
i observe a strange parser error, where any command containing + or
- would no longer be accepted. It first occured to me after a
mistype with the stats commmand, and boils down to this:
gp> a=0
gp> stats file"
undefined variable: file
gp> a=a+1
^
';' expected
gp> stats "file"
warning: Skipping unreadable file "file"
Can´t read data file
gp> a=a+1; print a
1
gp>
Same happens after ommitting the leading " on giving the file name
in a fit command, eg.
gp> fit f(x) file"
undefinded variable: file
gp> a=a+1
';'expectd
So after "stats" or "fit" gives out the "undefined variable" error,
the parser will no longer understand any command containing "+" or
"-" ("*", "/" work, btw.). After a another stats command that works
(or gives another error message), the parsing will be OK again.
The error does not occur with "plot", strangely.
I´m using gp4.6.0, official windows build. Is anyone working on the
4.6.1 build for windows, btw? Tatsuro used to do it, i think, but if
he´s not around, i might volunteer if someone has a few pointers on
how it´s done. I´d be starting from scratch, so it might be a few
days ...
Regards, Karl
|
|
From: Ethan A M. <sf...@us...> - 2012-10-31 17:20:24
|
On Wednesday, October 31, 2012 08:33:01 am Karl-Friedrich Ratzsch wrote:
> Hi,
>
> i observe a strange parser error, where any command containing + or
> - would no longer be accepted. It first occured to me after a
> mistype with the stats commmand, and boils down to this:
>
>
> gp> a=0
> gp> stats file"
> undefined variable: file
> gp> a=a+1
> ^
> ';' expected
> gp> stats "file"
> warning: Skipping unreadable file "file"
> Can�t read data file
> gp> a=a+1; print a
> 1
> gp>
>
Indeed quite strange. I see the same thing with 4.4.4 and with
the current 4.6 CVS source.
But it doesn't happen in 4.7, so bisecting the changes from
4.6 to 4.7 should identify the source of the problem and
provide a fix.
Ethan
> Same happens after ommitting the leading " on giving the file name
> in a fit command, eg.
>
>
> gp> fit f(x) file"
> undefinded variable: file
> gp> a=a+1
> ';'expectd
>
>
>
> So after "stats" or "fit" gives out the "undefined variable" error,
> the parser will no longer understand any command containing "+" or
> "-" ("*", "/" work, btw.). After a another stats command that works
> (or gives another error message), the parsing will be OK again.
>
> The error does not occur with "plot", strangely.
>
> I�m using gp4.6.0, official windows build. Is anyone working on the
> 4.6.1 build for windows, btw? Tatsuro used to do it, i think, but if
> he�s not around, i might volunteer if someone has a few pointers on
> how it�s done. I�d be starting from scratch, so it might be a few
> days ...
>
> Regards, Karl
|
|
From: Dima K. <gn...@di...> - 2012-10-31 20:07:33
|
> On Wed, 31 Oct 2012 10:17:06 -0700
> Ethan A Merritt <sf...@us...> wrote:
>
> On Wednesday, October 31, 2012 08:33:01 am Karl-Friedrich Ratzsch
> wrote:
> > Hi,
> >
> > i observe a strange parser error, where any command containing + or
> > - would no longer be accepted. It first occured to me after a
> > mistype with the stats commmand, and boils down to this:
> >
> >
> > gp> a=0
> > gp> stats file"
> > undefined variable: file
> > gp> a=a+1
> > ^
> > ';' expected
> > gp> stats "file"
> > warning: Skipping unreadable file "file"
> > Can't read data file
> > gp> a=a+1; print a
> > 1
> > gp>
> >
>
> Indeed quite strange. I see the same thing with 4.4.4 and with
> the current 4.6 CVS source.
>
> But it doesn't happen in 4.7, so bisecting the changes from
> 4.6 to 4.7 should identify the source of the problem and
> provide a fix.
>
> Ethan
>
>
>
>
> > Same happens after ommitting the leading " on giving the file name
> > in a fit command, eg.
> >
> >
> > gp> fit f(x) file"
> > undefinded variable: file
> > gp> a=a+1
> > ';'expectd
> >
> >
> >
> > So after "stats" or "fit" gives out the "undefined variable" error,
> > the parser will no longer understand any command containing "+" or
> > "-" ("*", "/" work, btw.). After a another stats command that works
> > (or gives another error message), the parsing will be OK again.
> >
> > The error does not occur with "plot", strangely.
> >
> > I'm using gp4.6.0, official windows build. Is anyone working on the
> > 4.6.1 build for windows, btw? Tatsuro used to do it, i think, but if
> > he's not around, i might volunteer if someone has a few pointers on
> > how it's done. I'd be starting from scratch, so it might be a few
> > days ...
> >
> > Regards, Karl
Git bisect says the fix happened in
https://github.com/gnuplot/gnuplot/commit/9b944c2cd4c59545ce3cc903fdb88f01a8ca6e1e
Another interesting data point is that the issue only manifests when gnuplot
reads the input on STDIN, not from a file.
For reference, to find this commit, I did this:
$ git bisect start origin/master gnuplot-4-4-alpha
$ git bisect run zsh -c './prepare; ./configure --without-tutorial --without-cairo --without-lua; make -j7 -C src gnuplot || exit 125; HOME=/tmp src/gnuplot < /tmp/tst.gp |& grep -q expected; r=$?; git clean -ffdx; git reset --hard; exit $r'
with /tmp/tst.gp:
a=0
fit f(x) file"
a=a+1
|
|
From: Ethan A M. <sf...@us...> - 2012-10-31 20:44:09
|
On Wednesday, October 31, 2012 01:06:12 pm Dima Kogan wrote: > > > > On Wednesday, October 31, 2012 08:33:01 am Karl-Friedrich Ratzsch > > wrote: > > > > > > i observe a strange parser error, where any command containing + or > > > - would no longer be accepted. It first occured to me after a > > > mistype with the stats commmand, and boils down to this: > > > > > > gp> a=0 > > > gp> stats file" > > > undefined variable: file > > > gp> a=a+1 > > > ^ > > > ';' expected > > On Wed, 31 Oct 2012 10:17:06 -0700 > > Ethan A Merritt <sf...@us...> wrote: > > Indeed quite strange. I see the same thing with 4.4.4 and with > > the current 4.6 CVS source. > > > > But it doesn't happen in 4.7, so bisecting the changes from > > 4.6 to 4.7 should identify the source of the problem and > > provide a fix. Dima Kogan wrote> > Git bisect says the fix happened in > > https://github.com/gnuplot/gnuplot/commit/9b944c2cd4c59545ce3cc903fdb88f01a8ca6e1e > This turns out to be a good example of when automatic bisection yields only a hint, not a fix. The commit you found (I found it also) did not actually remove the problem. It changed 2 call sites, one in stats.c and one in fit.c, such that try_to_get_string() was replaced with a call to string_or_express(). After this change the specific commands provided by Karl-Friedrich Ratzsch no longer trigger the error, but other calls to try_to_get_string() were still vulnerable. The underlying problem was a failure to reset internal parsing state variables after an error exit from command line parsing. Now fixed in CVS for 4.6 and 4.7. Ethan |