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

Martin Rehak <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <[email protected]>
Hi Akim,

On December 4, 2020 7:27 am Akim Demaille wrote:
> Hi Martin,
> 
>> Le 30 nov. 2020 à 16:56, Martin Rehak <[email protected]> a écrit :
>> 
>> Hi Akim,
>> 
>> On November 26, 2020 8:27 am Akim Demaille wrote:
>>> Hi Martin,
>>> 
>>>> Le 25 nov. 2020 à 09:03, Martin Rehak <[email protected]> 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://urldefense.com/v3/__https://www.lrde.epita.fr/*akim/private/bison/bison-3.7.4.136-0e78a-dirty.tar.gz__;fg!!GqivPVa7Brio!OoEllf4EXPgqSG1AEwmvKYVYVJ_ZxMNnjWQEK7cq6T7Bgs9ekKcKsUlYH_lsP5nmGQ$ 
> https://urldefense.com/v3/__https://www.lrde.epita.fr/*akim/private/bison/bison-3.7.4.136-0e78a-dirty.tar.lz__;fg!!GqivPVa7Brio!OoEllf4EXPgqSG1AEwmvKYVYVJ_ZxMNnjWQEK7cq6T7Bgs9ekKcKsUlYH_mGBczwDg$ 
> https://urldefense.com/v3/__https://www.lrde.epita.fr/*akim/private/bison/bison-3.7.4.136-0e78a-dirty.tar.xz__;fg!!GqivPVa7Brio!OoEllf4EXPgqSG1AEwmvKYVYVJ_ZxMNnjWQEK7cq6T7Bgs9ekKcKsUlYH_n0AvB7mg$ 
> 
> 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.

So I am puzzled even more.

$ ./src/mbcat tests/testsuite.dir/004/input.y >/tmp/out.y
$ diff tests/testsuite.dir/004/input.y /tmp/out.y
$ echo $?
0
$ cat -v /tmp/out.y
^@^A^BM-^??
"^@"
%%
?
default: 'a' }
%&
%a-does-not-exist
%-
%{

It's fine that we have bison working. But I don't understand the test 
failing. :) And it still does:

$ gmake check-local TESTSUITEFLAGS='-d 4'
...
/bin/bash /builds/mrehak/workspace/bison/components/bison/bison-3.7.3/tests/testsuite -C tests -d 4
## --------------------------- ##
## GNU Bison 3.7.3 test suite. ##
## --------------------------- ##
  4: Invalid inputs                                  FAILED (input.at:102)

## ------------- ##
## Test results. ##
## ------------- ##

ERROR: 1 test was run,

Any idea, please?

Thanks
-- 
Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.