mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
parser: fix bison error message output when built against bison 3.6+
bison change the default text past to yerror in bison 3.6, this breaks make check as some tests are comparing against the error output ====================================================================== FAIL: test_modefail (__main__.AAErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jj/apparmor.git/parser/tst/testlib.py", line 50, in new_unittest_func return unittest_func(self) File "./errors.py", line 58, in test_modefail self._run_test( File "./errors.py", line 40, in _run_test self.assertIn(message, outerr, report) AssertionError: 'AppArmor parser error for errors/modefail.sd in profile errors/modefail.sd at line 6: syntax error, unexpected TOK_ID, expecting TOK_MODE' not found in 'AppArmor parser error for errors/modefail.sd in profile errors/modefail.sd at line 6: syntax error\n' : Command: ../apparmor_parser --config-file=./parser.conf -S -I errors errors/modefail.sd Exit value:1 STDERR AppArmor parser error for errors/modefail.sd in profile errors/modefail.sd at line 6: syntax error To fix this we need to add define parse.error=verbose to bison. Unfortunately define parse.error was only added in bison 3.0 and and older versions of bison will break if that is defined in parser_yacc.y Instead test for the version of bison available and set define parse.error as a build flag if supported by the version of bison being called. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/640 Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Steve Beattie <steve.beattie@canonical.com>
This commit is contained in:
@@ -32,8 +32,19 @@ INSTALL_CONFDIR=${DESTDIR}${CONFDIR}
|
||||
LOCALEDIR=/usr/share/locale
|
||||
MANPAGES=apparmor.d.5 apparmor.7 apparmor_parser.8 aa-teardown.8 apparmor_xattrs.7
|
||||
|
||||
# Test for bison version
|
||||
# parse.error added in version 3.0
|
||||
# default behavior changed in version 3.6
|
||||
# parse.error=verbose supported from 3.0 so just test on that
|
||||
# TODO move to autoconf
|
||||
BISON_MAJOR:=$(shell bison --version | awk '/^bison/ { print ($$NF) }' | awk -F. '{print $$1 }')
|
||||
USE_PARSE_ERROR:=$(shell test ${BISON_MAJOR} -ge 3 && echo true)
|
||||
|
||||
YACC := bison
|
||||
YFLAGS := -d
|
||||
ifeq ($(USE_PARSE_ERROR),true)
|
||||
YFLAGS+=--define=parse.error=verbose
|
||||
endif
|
||||
LEX := flex
|
||||
LEXFLAGS = -B -v
|
||||
ifndef DEBUG
|
||||
|
Reference in New Issue
Block a user