bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invalid inputs FAILED (input.at:102) on Solaris


From: Akim Demaille
Subject: Re: Invalid inputs FAILED (input.at:102) on Solaris
Date: Fri, 4 Dec 2020 07:27:52 +0100

Hi Martin,

> Le 30 nov. 2020 à 16:56, Martin Rehak <martin.rehak@oracle.com> a écrit :
> 
> Hi Akim,
> 
> On November 26, 2020 8:27 am Akim Demaille wrote:
>> Hi Martin,
>> 
>>> Le 25 nov. 2020 à 09:03, Martin Rehak <martin.rehak@oracle.com> a écrit :
>>> 
>>> Hi Akim,
>>> 
>>> Strange, absolutely same output:
>>> 
>>> $ printf "\0\n" > /tmp/foo.y
>>> $ LC_ALL=C ./src/bison -fcaret /tmp/foo.y >/tmp/foo.log 2>&1
>>> ?1$ xxd /tmp/foo.log
>>> 00000000: 2f74 6d70 2f66 6f6f 2e79 3a31 2e31 3a20  /tmp/foo.y:1.1: 
>>> 00000010: 6572 726f 723a 2069 6e76 616c 6964 2063  error: invalid c
>>> 00000020: 6861 7261 6374 6572 3a20 275c 3027 0a20  haracter: '\0'. 
>>> 00000030: 2020 2031 207c 2000 0a20 2020 2020 207c     1 | ..      |
>>> 00000040: 205e 0a                                   ^.
>>> $ perl -p -e 's{([\0\377])}{sprintf "\\x%02x", ord($1)}ge' /tmp/foo.log
>>> /tmp/foo.y:1.1: error: invalid character: '\0'
>>>   1 | \x00
>>>     | ^
>> 
>> I am confused.  Please run this:
>> 
>> make check-local TESTSUITEFLAGS='-d 4'
>> 
>> and wrap a tarball of tests/testsuite.dir/004 and send it.
>> 
>>> In case you are not happy with debugging this case (and I would 
>>> understand it) is there a way how to disable it?
> 
> Tarball is attached.

The stderr file in your tarball starts with:

input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
    1 | ^A^BM-^??
      | ^~
input.y:2.2: error: invalid null character
    2 | ""
      |  ^

In other words, the NUL byte is really not there.  For some reason
when you ran the shorter example above the NUL byte was properly
output, but not when there is another character after it.

The function which is at work here is location_caret in src/location.c.
It uses Gnulib's mbchar.h.

I have made a stripped down version of this routine in this tarball:

https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.4.136-0e78a-dirty.tar.gz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.4.136-0e78a-dirty.tar.lz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.4.136-0e78a-dirty.tar.xz

Once compiled, src/mbcat should imitate what bison does when it quotes
the input.  So could you feed it with tests/testsuite.dir/004/input.y
and see what difference there is between the input and the output?

./src/mbcat tests/testsuite.dir/004/input.y >/tmp/out.y
diff tests/testsuite.dir/004/input.y /tmp/out.y

And if there are diffs, try to make them visible (cat -v for instance).
Or attach /tmp/out.y.

Thanks!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]