git: 4e3fa977a14f - releng/13.0 - lex: Do not let input() return 0 when end-of-file is reached

Jung-uk Kim jkim at FreeBSD.org
Mon Feb 22 21:34:16 UTC 2021


The branch releng/13.0 has been updated by jkim:

URL: https://cgit.FreeBSD.org/src/commit/?id=4e3fa977a14f7c69a39aacd8788a437527767dac

commit 4e3fa977a14f7c69a39aacd8788a437527767dac
Author:     Jung-uk Kim <jkim at FreeBSD.org>
AuthorDate: 2021-02-17 07:22:47 +0000
Commit:     Jung-uk Kim <jkim at FreeBSD.org>
CommitDate: 2021-02-22 21:28:53 +0000

    lex: Do not let input() return 0 when end-of-file is reached
    
    Importing flex 2.6.4 has introduced a regression: input() now returns 0
    instead of EOF to indicate that the end of input was reached, just like
    traditional AT&T and POSIX lex.  Note the behavior contradicts flex(1).
    See "INCOMPATIBILITIES WITH LEX AND POSIX" section for information.
    This incompatibility traces back to the original version and documented
    in its manual page by the Vern Paxson.
    
    Apparently, it has been reported in a few places, e.g.,
    
    https://github.com/westes/flex/issues/448
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911415
    
    Unfortunately, this also breaks the scanner used by libdtrace and
    dtrace is unable to resolve some probe argument types as a result.  See
    PR253440 for more information.
    
    Note the regression was introduced by the following upstream commit
    without any explanation or documentation change:
    
    https://github.com/westes/flex/commit/f863c9490e6912ffcaeb12965fb3a567a10745ff
    
    Now we restore the traditional flex behavior unless lex-compatibility
    mode is set with "-l" option because I believe the author originally
    wanted to make it more lex and POSIX compatible.
    
    PR:             253440
    Reported by:    markj
    Approved by:    re (gjb)
    
    (cherry picked from commit 6b7e592c215fb76ea027f25030ddc9a697184fbe)
---
 contrib/flex/src/flex.skl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/contrib/flex/src/flex.skl b/contrib/flex/src/flex.skl
index 242645f53245..c23b944ea473 100644
--- a/contrib/flex/src/flex.skl
+++ b/contrib/flex/src/flex.skl
@@ -1863,7 +1863,11 @@ m4_ifdef( [[M4_YY_USE_LINENO]],
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
+#ifdef YY_FLEX_LEX_COMPAT
 						return 0;
+#else
+						return EOF;
+#endif
 
 					if ( ! YY_G(yy_did_buffer_switch_on_eof) )
 						YY_NEW_FILE;


More information about the dev-commits-src-all mailing list