Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.6.2 introduces behavior change that is incompatible with previous versions #113

Closed
nvinson opened this issue Oct 28, 2016 · 13 comments
Closed

Comments

@nvinson
Copy link

nvinson commented Oct 28, 2016

With version 2.6.1 if prefix was set, then all affected functions would have their declaration changed and all references in the lexer input file would be changed as well. With v2.6.2 only the function declarations are changed.

For example, set prefix to AA, reference yyget_extra() in the lexer input file, and build the C file using v2.6.1 and all calls in the C source file will be to AAget_extra(). However, build with v2.6.2 and the resultant C file will still have calls to yyget_extra() resulting in a broken source file.

This change in behavior appears to have been introduced with commit ee87e5d.

@Polynomial-C
Copy link

Consequences of this change can be searched and found here: https://bugs.gentoo.org/598186

@fabled
Copy link

fabled commented Nov 1, 2016

Flex 2.6.2 also does not properly handle doxygen. The flex generated code fails with:

[ 23%] Building CXX object qtools/CMakeFiles/qtools.dir/qregexp.cpp.o
configimpl.l:692:32: error: stray '' in program
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
configimpl.l: In function 'int configimplYYlex()':
configimpl.l:692:1: error: expected primary-expression before '<' token
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
^
configimpl.l:692:9: error: 'a' was not declared in this scope
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
^
configimpl.l:692:10: error: expected ',' before '-' token
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
^
configimpl.l:692:10: error: expected identifier before '-' token
configimpl.l: In lambda function:
configimpl.l:692:17: error: expected '{' before '[' token
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
^
configimpl.l: In function 'int configimplYYlex()':
configimpl.l:692:20: error: 'z_A' was not declared in this scope
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
^~~
configimpl.l:692:24: error: 'Z0' was not declared in this scope
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
^~
configimpl.l:692:33: error: 't' was not declared in this scope
[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
^
configimpl.l: In lambda function:
configimpl.l:692:35: error: expected '{' before '' token
[a-z_A-Z][a-z_A-Z0-9]
[ \t]*"+=" { QCString cmd=yytext;
^

The code it generated looks like:

                                    }

[a-z_A-Z][a-z_A-Z0-9][ \t]"+=" { QCString cmd=yytext;
cmd=cmd.left(cmd.length()-2).stripWhiteSpace();
ConfigOption *option = config->get(cmd);
if (option==0) // oops not

Basically it did not handle the pattern match at all.

algitbot pushed a commit to alpinelinux/aports that referenced this issue Nov 1, 2016
This partially reverts commit 2dfc72b.

flex 2.6.2 is broken horribly causing build failures in various
packages. For details: westes/flex#113
@ghost
Copy link

ghost commented Nov 3, 2016

Just to add another me too. This issue breaks Mesa also: https://bugs.freedesktop.org/show_bug.cgi?id=98473

@tgurr
Copy link

tgurr commented Nov 4, 2016

It also breaks kde-frameworks/kservice: https://bugs.kde.org/show_bug.cgi?id=371885 and the developers comment was "So why not report this to the flex authors?".

@westes
Copy link
Owner

westes commented Nov 4, 2016

@DemiMarie, could you have a look at this?

DemiMarie added a commit to DemiMarie/flex that referenced this issue Nov 8, 2016
My changes caused Flex to mishandle string and character literals
in line comments.  This commit fixes them.

Fixes westes#113.
@westes westes closed this as completed in c8ad3d6 Nov 8, 2016
@nvinson
Copy link
Author

nvinson commented Nov 9, 2016

I just tested head against nftables-0.6 (using Gentoo's nftables-0.6-r4 ebuild) and the issue is still present. Could you please reopen this bug until the issue is fixed?

edit: head in this case is commit d374b87

@westes westes reopened this Nov 9, 2016
@westes
Copy link
Owner

westes commented Nov 9, 2016

Certainly. @DemiMarie, what do you think?

@DemiMarie
Copy link
Contributor

I think I know what is going on.

Flex versions <= 2.6.1 expand M4 macros in the source file. This allows a bad input file to execute arbitrary shell commands and results in broken debugging info. It also corrupts string literals that happen to contain the relevant strings.

I "fixed" this behavior. This also required changing the testsuite. In retrospect, I should probably have realized that this would break code.

The solution is to add CPP (not M4) macros that handle this. I will make a patch.

@DemiMarie
Copy link
Contributor

If the problem is in section 3, you can use --unsafe-no-m4-sect3-escape as a temporary workaround.

DemiMarie added a commit to DemiMarie/flex that referenced this issue Nov 9, 2016
This patch adds compatiblity `#defines` for all macros affected by
`%prefix`.

Fixes westes#113.
@DemiMarie
Copy link
Contributor

@nvinson Can you see if #123 fixes this?

@nvinson
Copy link
Author

nvinson commented Nov 10, 2016

@nvinson Can you see if #123 fixes this?

nftables compiled with that change. I'll do more extensive testing later this week.

@Polynomial-C
Copy link

@westes Can we please have a new release once this issue has been confirmed to be fixed?

@westes westes closed this as completed in 347652c Nov 12, 2016
MishimaHaruna added a commit to HerculesWS/Hercules that referenced this issue Nov 19, 2016
The version of flex used here includes a workaround for
westes/flex#113 (since it's otherwise
not-compilable)
MishimaHaruna added a commit to HerculesWS/Hercules that referenced this issue Nov 19, 2016
The version of flex used here includes a workaround for
westes/flex#113 (since it's otherwise
not-compilable)
MishimaHaruna added a commit to HerculesWS/Hercules that referenced this issue Nov 19, 2016
The version of flex used here includes a workaround for
westes/flex#113 (since it's otherwise
not-compilable)
MishimaHaruna added a commit to HerculesWS/Hercules that referenced this issue Nov 19, 2016
The version of flex used here includes a workaround for
westes/flex#113 (since it's otherwise
not-compilable)
wiedi added a commit to wiedi/pkgsrc-legacy that referenced this issue Dec 13, 2016
mainly related to westes/flex#113
"v2.6.2 introduces behavior change that is incompatible with previous versions"

This fixes at least doxygen
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Dec 13, 2016
mainly related to westes/flex#113
"v2.6.2 introduces behavior change that is incompatible with previous versions"

This fixes at least doxygen
dastgirp pushed a commit to RagEmu/Renewal that referenced this issue Dec 15, 2016
The version of flex used here includes a workaround for
westes/flex#113 (since it's otherwise
not-compilable)
alagoutte pushed a commit to alagoutte/flex that referenced this issue Dec 19, 2016
My changes caused Flex to mishandle string and character literals in
line comments.  This commit fixes them.

Fixes westes#113.
alagoutte pushed a commit to alagoutte/flex that referenced this issue Dec 19, 2016
This patch addscompatibility `#defines` for all macros affected by
`%prefix`.

Fixes westes#113.
@MarcinWieczorek
Copy link

Hi guys, I'm having trouble with flex.
Here's my build log, read the bottom please:
http://sprunge.us/dTKi
Do you think it's related?

daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
Flex 2.6.2 has a bug which results in incorrect variable
expansion and that causes quite a lot of other packages
to fail
westes/flex#113
The best way for now is to work it around for the
concerning packages as upstream is thinking of reverting
back to the older version
https://patchwork.openembedded.org/patch/135715/
https://patchwork.openembedded.org/patch/135503/

Signed-off-by: Awais Belal <awais_belal@mentor.com>
daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
Flex 2.6.2 has a bug which results in incorrect variable
expansion and that causes quite a lot of other packages
to fail
westes/flex#113
The best way for now is to work it around for the
concerning packages as upstream is thinking of reverting
back to the older version
https://patchwork.openembedded.org/patch/135715/
https://patchwork.openembedded.org/patch/135503/

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants