diff --git a/0001-Reset-scan-state-when-opening-a-new-file.patch b/0001-Reset-scan-state-when-opening-a-new-file.patch new file mode 100644 index 0000000..e205251 --- /dev/null +++ b/0001-Reset-scan-state-when-opening-a-new-file.patch @@ -0,0 +1,100 @@ +From a68c5b7b29eb1433b1be73b50c4248e10eab8e64 Mon Sep 17 00:00:00 2001 +From: Daniel Stone +Date: Thu, 1 Nov 2012 16:37:03 +1100 +Subject: [PATCH] Reset scan state when opening a new file + +When we opened a new file after encountering a parse error, we weren't +resetting our scan state, and continued to read out of the old buffer +rather than that of the new file. + +Fixes a regression introduced in 9887842e ('Use fread() instead of +getc()'). + +Test case: + xkbcomp -lfhlpR "path/to/xkeyboard-config.git/symbols/*" +The Makefiles in that tree would cause parse errors, the resulting directory +file is incomplete (down from ~12000 to ~230 lines). + +Reported-by: Peter Hutterer +Signed-off-by: Daniel Stone +--- + parseutils.c | 2 +- + parseutils.h | 3 +-- + xkbcomp.c | 2 +- + xkbscan.c | 10 +++++++++- + 4 files changed, 12 insertions(+), 5 deletions(-) + +diff --git a/xkbcomp-1.2.4/parseutils.c b/parseutils.c +index 253cd9d..a1b6e9e 100644 +--- a/xkbcomp-1.2.4/parseutils.c ++++ b/xkbcomp-1.2.4/parseutils.c +@@ -797,7 +797,7 @@ XKBParseFile(FILE * file, XkbFile ** pRtrn) + { + if (file) + { +- yyin = file; ++ scan_set_file(file); + rtrnValue = NULL; + if (yyparse() == 0) + { +diff --git a/xkbcomp-1.2.4/parseutils.h b/xkbcomp-1.2.4/parseutils.h +index 8b8a6c1..8c381d4 100644 +--- a/xkbcomp-1.2.4/parseutils.h ++++ b/xkbcomp-1.2.4/parseutils.h +@@ -198,11 +198,10 @@ extern int yywrap(void); + + extern int yylex(void); + extern int yyparse(void); ++extern void scan_set_file(FILE *file); + + extern int setScanState(char * /* file */ , + int /* line */ + ); + +-extern FILE *yyin; +- + #endif /* XKBPARSE_H */ +diff --git a/xkbcomp-1.2.4/xkbcomp.c b/xkbcomp-1.2.4/xkbcomp.c +index 063ae87..116bcfa 100644 +--- a/xkbcomp-1.2.4/xkbcomp.c ++++ b/xkbcomp-1.2.4/xkbcomp.c +@@ -883,7 +883,7 @@ main(int argc, char *argv[]) + XkbFileInfo result; + Status status; + +- yyin = stdin; ++ scan_set_file(stdin); + uSetEntryFile(NullString); + uSetDebugFile(NullString); + uSetErrorFile(NullString); +diff --git a/xkbcomp-1.2.4/xkbscan.c b/xkbcomp-1.2.4/xkbscan.c +index 22a034f..a05d569 100644 +--- a/xkbcomp-1.2.4/xkbscan.c ++++ b/xkbcomp-1.2.4/xkbscan.c +@@ -37,7 +37,7 @@ + + unsigned int scanDebug; + +-FILE *yyin = NULL; ++static FILE *yyin; + + static char scanFileBuf[1024] = {0}; + char *scanFile = scanFileBuf; +@@ -269,6 +269,14 @@ tokText(int tok) + } + #endif + ++void ++scan_set_file(FILE *file) ++{ ++ readBufLen = 0; ++ readBufPos = 0; ++ yyin = file; ++} ++ + static int + scanchar(void) + { +-- +1.7.11.7 + diff --git a/xorg-x11-xkb-utils.spec b/xorg-x11-xkb-utils.spec index e181728..4d72679 100644 --- a/xorg-x11-xkb-utils.spec +++ b/xorg-x11-xkb-utils.spec @@ -15,6 +15,8 @@ Source2: ftp://ftp.x.org/pub/individual/app/xkbevd-1.1.3.tar.bz2 Source3: ftp://ftp.x.org/pub/individual/app/xkbprint-1.0.3.tar.bz2 Source4: ftp://ftp.x.org/pub/individual/app/setxkbmap-1.3.0.tar.bz2 +Patch01: 0001-Reset-scan-state-when-opening-a-new-file.patch + BuildRequires: pkgconfig BuildRequires: byacc BuildRequires: libxkbfile-devel @@ -56,6 +58,7 @@ X.Org X11 xkb gadgets %prep %setup -q -c %{name}-%{version} -a1 -a2 -a3 -a4 +%patch01 -p1 %build export CFLAGS="$RPM_OPT_FLAGS -DHAVE_STRCASECMP -Os" @@ -105,6 +108,10 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/xkbcomp.pc %changelog +* Tue Nov 13 2012 Peter Hutterer 7.7-3 +- xkbcomp: Fix generation of XKB directory listing, missing reset on file + handler caused parse errors and incomplete directory listings + * Tue Aug 28 2012 Peter Hutterer 7.7-2 - Remove duplicate sources