bug-global
[Top][All Lists]
Advanced

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

Re: Failed to Parse Template and Corrupted Tags


From: Gustaf Waldemarson
Subject: Re: Failed to Parse Template and Corrupted Tags
Date: Wed, 7 Sep 2016 09:45:12 +0200

Hello,

I would say "global: <full path>/GTAGS seems to be corrupted." is a
great response :)

Perhaps you would also like to add the something like "Were tags
created with non-zero exit code?" under the --verbose flag for
additional debugging? Hardly necessary, but could be useful for the
user to figure out why the file got corrupted.


Another idea would be to add a note under the "DIAGNOSTICS" header in
the manual:

    DIAGNOSTICS
    Gtags exits with a non-0 value if an error occurred, 0 otherwise.

Perhaps it should say something along the lines of:

    DIAGNOSTICS
    Gtags exits with a non-0 value if an error occurred, 0 otherwise.

    Note that files created by gtags with a non-zero exit code should
be considered corrupted.


Happy to help and keep up the good work!

Regards,
Gustaf

2016-09-07 2:10 GMT+02:00 Shigio YAMAGUCHI <address@hidden>:
> Hi,
> You are right.
> After checking about that, it was understood that there are two problems.
>
> 1. Treatment of NULL file
>
> A NULL file (file size == 0) is treated as a correct db file.
> This is the cause of the inappropriate message ('...seems older format').
> It should be treated as a corrupted file (EFTYPE error).
>
> 2. Another inappropriate message
>
> Currently, when a tag file is corrupted, you will see the following message.
>
> global: GTAGS not found.
>
> This isn't also appropriate. I think it should be like the following.
>
> global: <full path>/GTAGS seems to be corrupted.
>
> What do you think?
>
> This is an example:
> -------------------------------------------------------------------------------
> Current GLOBAL (6.5.4)
> -------------------------------------------------------------------------------
> $ echo 'main(){}' >main.c
> $ gtags
> $ global -x main
> main                1 main.c           main(){}
> $ cp /dev/null GTAGS
> $ global -x main
> global: /tmp/test/GTAGS seems older format. Please remake tag files.
> $ echo aaa >GTAGS
> $ global -x main
> global: GTAGS not found.
> -------------------------------------------------------------------------------
> |
> v
> -------------------------------------------------------------------------------
> New GLOBAL (6.5.5?)
> -------------------------------------------------------------------------------
> $ echo 'main(){}' >main.c
> $ gtags
> $ global -x main
> main                1 main.c           main(){}
> $ cp /dev/null GTAGS
> $ global -x main
> global: /tmp/test/GTAGS seems to be corrupted.
> $ echo aaa >GTAGS
> $ global -x main
> global: /tmp/test/GTAGS seems to be corrupted.
> -------------------------------------------------------------------------------
>
> Thank you for making me notice the basic bug.
>
> Regards,
> Shigio
>
> 2016-09-05 16:16 GMT+09:00 Gustaf Waldemarson
> <address@hidden>:
>>
>> Hello,
>> Thanks for fixing it so quickly! Keep up the good work! :)
>>
>> Perhaps it might be an Idea to update the error message as well? The
>> 'GTAGS seems older format' feels like an odd response to a possibly
>> corrupted tags file. Perhaps 'Could not read GTAGS file properly. Were
>> tags created successfully with a non-zero exit code?' might be a bit
>> more appropriate?
>>
>> Regards,
>> Gustaf
>>
>> 2016-09-03 11:27 GMT+02:00 Shigio YAMAGUCHI <address@hidden>:
>> > Hi,
>> > You are right. I have rewritten the source code slightly
>> > using 'goto finish' method.
>> >
>> > RCS file: /sources/global/global/libparser/Cpp.c,v
>> > retrieving revision 1.22
>> > diff -r1.22 Cpp.c
>> > 239,240c239,243
>> > < } else if (c == EOF)
>> > < die("failed to parse template [+%d %s].", savelineno, curfile);
>> > ---
>> >> } else if (c == EOF) {
>> >> if (param->flags & PARSER_WARNING)
>> >> warning("failed to parse template [+%d %s].", savelineno, curfile);
>> >> goto finish;
>> >> }
>> > 583a587
>> >> finish:
>> >
>> >
>> > By the way, in the current GLOBAL, each parser can stop
>> > the program itself. In that case, the tag files get corrupted.
>> > When gtags ends with status != 0, you should not use them.
>> >
>> > Regards
>> > Shigio
>> >
>> >
>> > 2016-09-02 16:47 GMT+09:00 Gustaf Waldemarson
>> > <address@hidden>:
>> >>
>> >> Hello Global Maintainers,
>> >>
>> >> I seem to have run into one or possibly two bugs while trying out
>> >> Global:
>> >>
>> >> Recipe:
>> >>
>> >> 1. Create a new directory for testing:
>> >>    - mkdir debug
>> >>
>> >> 2. Create a new file in the directory e.g. `main.cpp' with the
>> >> contents:
>> >>
>> >>     #include <iostream>
>> >>
>> >>     #define TEST_MACRO struct test<
>> >>
>> >>     int main(void)
>> >>     {
>> >>         std::cout << "hello, world!" << std::endl;
>> >>         return 0;
>> >>     }
>> >>
>> >> 3. Generate tags:
>> >>    - `gtags'
>> >>    - Bug 1: Parser error: `gtags: failed to parse template [+3
>> >>      ./main.cpp].'
>> >>
>> >> 4. Trying to use the generated tags then leads to possibly different
>> >>    bug:
>> >>    - `global -u'
>> >>    - Bug 2: `gtags: /home/guswal01/git/debug/GTAGS seems older
>> >>      format. Please remake tag files.'
>> >>
>> >> This occured on `Global 6.5'.4 when built on Ubuntu 15.10 using the
>> >> default `sh reconf.sh && ./configure' settings.
>> >>
>> >> In my opinion, failing to parse some odd C++ file is usually fine, but
>> >> in in this it seems like the tag files get corrupted somehow.
>> >>
>> >> _______________________________________________
>> >> Bug-global mailing list
>> >> address@hidden
>> >> https://lists.gnu.org/mailman/listinfo/bug-global
>> >
>> >
>> >
>> >
>> > --
>> > Shigio YAMAGUCHI <address@hidden>
>> > PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3
>
>
>
>
> --
> Shigio YAMAGUCHI <address@hidden>
> PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



reply via email to

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