After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 712679 - parse: prototype-mismatch
parse: prototype-mismatch
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal blocker
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-11-19 14:01 UTC by Fabian
Modified: 2013-11-29 19:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix segfaulting prototype mismatch (2.72 KB, patch)
2013-11-19 14:14 UTC, Fabian
committed Details | Review
0002-clean up Makefile after fixing the bug (1.64 KB, patch)
2013-11-19 17:28 UTC, Fabian
committed Details | Review

Description Fabian 2013-11-19 14:01:19 UTC
just tracked down a segfault:

gstreamer/gst/parse$ grep "int.*yylex_init " *.c

grammar.tab.c:int priv_gst_parse_yylex_init (yyscan_t scanner);
lex.priv_gst_parse_yy.c:int priv_gst_parse_yylex_init (yyscan_t* scanner);


funny/scary that it works most of the time.
patch will be attached in a minute (or two ;).
Comment 1 Fabian 2013-11-19 14:14:54 UTC
Created attachment 260241 [details] [review]
fix segfaulting prototype mismatch
Comment 2 Fabian 2013-11-19 17:28:24 UTC
Created attachment 260264 [details] [review]
0002-clean up Makefile after fixing the bug

to be applied after the other patch.

We no longer need to avoid -Werror and -Wall.
What a surprise.. ;)
Comment 3 Olivier Crête 2013-11-29 00:09:59 UTC
I merged your two patches and committed them with two small modifications. I put the include after the part about debugging so that YYDEBUG is set to 1 if debugging is enabled. Then the include file always defines YYDEBUG (to 0 if it was not defined), so actually check for the content.

commit 56d74ddb644052dc76d97c22b9f284cc0c7fe35a
Author: Fabian Kirsch <derFakir@web.de>
Date:   Tue Nov 19 15:03:35 2013 +0100

    parse: fix segfaulting prototype-mismatch
    
    Now YYDEBUG is always set, so check it's value
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712679
Comment 4 Edward Hervey 2013-11-29 15:29:51 UTC
this commit breaks the build

http://arracacha.collabora.co.uk:8080/job/GStreamer-master/385/console

Note that it succeeds one some setups but fails on other (that machines is a up to date Ubuntu 12.04 but I also have it failing on a 12.10).
Comment 5 Fabian 2013-11-29 15:48:12 UTC
the missing prototypes are in the generated header:

$ grep yy.*_col parse_lex.h 
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
    int yy_bs_column; /**< The column count. */
int priv_gst_parse_yyget_column  (yyscan_t yyscanner );
void priv_gst_parse_yyset_column (int column_no ,yyscan_t yyscanner );


But lex.priv_gst_parse_yy.c does not include it:
$ grep parse_lex lex.priv_gst_parse_yy.c 
$

instead flex already weaves it in:
$ grep -n yyget_col *.c 
lex.priv_gst_parse_yy.c:1019:int priv_gst_parse_yyget_column  (yyscan_t
yyscanner );
lex.priv_gst_parse_yy.c:2189:int priv_gst_parse_yyget_column  (yyscan_t
yyscanner)

what version of flex do you have?
$ flex -V
flex 2.5.35

if i include parse_lex.h in parse.l, gcc complains later.
Comment 6 Fabian 2013-11-29 15:56:21 UTC
the missing prototypes are in the generated header:

$ grep yy.*_col parse_lex.h 
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
    int yy_bs_column; /**< The column count. */
int priv_gst_parse_yyget_column  (yyscan_t yyscanner );
void priv_gst_parse_yyset_column (int column_no ,yyscan_t yyscanner );


But lex.priv_gst_parse_yy.c does not include it:
$ grep parse_lex lex.priv_gst_parse_yy.c 
$

instead flex already weaves it in:
$ grep -n yyget_col *.c 
lex.priv_gst_parse_yy.c:1019:int priv_gst_parse_yyget_column  (yyscan_t
yyscanner );
lex.priv_gst_parse_yy.c:2189:int priv_gst_parse_yyget_column  (yyscan_t
yyscanner)

what version of flex do you have?
$ flex -V
flex 2.5.35

if i include parse_lex.h in parse.l, gcc complains later.
if we get [-Werror=redundant-decls] out of the make, than we can include parse_lex.h in parse.l
Comment 7 Edward Hervey 2013-11-29 16:18:43 UTC
Ubuntu 12.10:

$ grep yy.*_col parse_lex.h
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
    int yy_bs_column; /**< The column count. */

$ grep parse_lex lex.priv_gst_parse_yy.c

$ grep -n yyget_col *.c
lex.priv_gst_parse_yy.c:2185:int priv_gst_parse_yyget_column  (yyscan_t yyscanner)

$ flex -V
flex 2.5.35




fedora 19 (where it works):

$ grep yy.*_col parse_lex.h
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
    int yy_bs_column; /**< The column count. */
int priv_gst_parse_yyget_column  (yyscan_t yyscanner );
void priv_gst_parse_yyset_column (int column_no ,yyscan_t yyscanner );

$ grep parse_lex lex.priv_gst_parse_yy.c

$ grep -n yyget_col *.c
lex.priv_gst_parse_yy.c:1011:int priv_gst_parse_yyget_column  (yyscan_t yyscanner );
lex.priv_gst_parse_yy.c:2177:int priv_gst_parse_yyget_column  (yyscan_t yyscanner)

$ flex -V
flex 2.5.37
Comment 8 Olivier Crête 2013-11-29 16:48:42 UTC
@fabian: which distro are you using ?
Comment 9 Fabian 2013-11-29 16:52:00 UTC
debian wheezy
Comment 10 Fabian 2013-11-29 17:01:32 UTC
i asked on flex-help@lists.sourceforge.net to have a look at this.

my minimal testcase comes here:
---8<---
/tmp/flex$ flex -V
flex 2.5.35
/tmp/flex$ cat > testfile.l << "EOT"
> %{
> %}
>
> %x value
> %option noyywrap
> %option nounput
> %option reentrant
> %option bison-bridge
> %option never-interactive
> %option noinput
> %%
>
> EOT
/tmp/flex$ flex testfile.l
/tmp/flex$ grep et_col *
lex.yy.c:int yyget_column  (yyscan_t yyscanner );
lex.yy.c:void yyset_column (int column_no ,yyscan_t yyscanner );
lex.yy.c:int yyget_column  (yyscan_t yyscanner)
lex.yy.c:void yyset_column (int  column_no , yyscan_t yyscanner)
[..]
--->8---
Comment 11 Olivier Crête 2013-11-29 17:08:22 UTC
Yes, these protoypes were added in flex 2.5.36... but debian patched it back into their 2.5.35 version. Ubuntu had this patch in 12.10, but it's not in their 12.04 version that Edward's using.
Comment 12 Olivier Crête 2013-11-29 19:03:50 UTC
Fixed again, by adding the prototypes manually if they were not already there

commit 3c4d54fd885ee352d16cdcce60323f01a22721e1
Author: Olivier Crête <olivier.crete@collabora.com>
Date:   Fri Nov 29 14:00:35 2013 -0500

    parse: Manually insert priv_gst_parse_yyget/set_column prototypes for older 
    
    Older versions of flex (before 2.5.36) don't add the prototype, so it must
    be added manually. We can't check by the version number, because Debian/Ubun
    patched it into their 2.5.35 at some point.