libaacs | branch: master | Ian Campbell <[email protected]> | Fri Dec 17 
15:13:26 2010 +0200| [f5c5b88f843d5dcb6ebe8cd01044d04f276985ea] | committer: 
npzacs 

Fixed run-time linking problems:

When using libaacs with mythtv I was getting the following crash:
  Program received signal SIGSEGV, Segmentation fault.
  0xb052085a in yylex () from /usr/lib/dri/i965_dri.so
  (gdb) bt
  #0  0xb052085a in yylex () from /usr/lib/dri/i965_dri.so
  #1  0xafe1529a in yyparse (scanner=0xafd24b48, dklist=0xafd3fa60, 
pklist=0xae054a70, clist=0xafd39af8, celist=0xae086908, dkplist=0x0) at 
keydbcfg-parser.c:1537
        #2  0xafe15a22 in keydbcfg_parse_config (cfgfile=0xae036898, 
path=0xae0517c8 "/var/lib/mythtv/.mythtv/KEYDB.cfg") at 
file/keydbcfg-parser.y:440

Obviously the linker has picked the wrong yylex.

I solved this with the following patch which renames all the yy* symbols
to libaacs_yy*.

> http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=f5c5b88f843d5dcb6ebe8cd01044d04f276985ea
---

 src/Makefile.am            |    2 +-
 src/file/keydbcfg-lexer.l  |    2 ++
 src/file/keydbcfg-parser.y |   12 ++++++------
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index cb7983c..8d9dba3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,7 +15,7 @@ SET_INCLUDES = -I$(top_srcdir) -Ifile
 
 AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_WARNINGS) $(SET_OPTIMIZATIONS) \
        $(SET_DEBUG_OPTS) $(SET_INCLUDES) $(LIBGCRYPT_CFLAGS)
-AM_YFLAGS = -d
+AM_YFLAGS = -d -p libaacs_yy
 CFLAGS=$(shell test -z "$$CFLAGS" || echo "$$CFLAGS")
 
 lib_LTLIBRARIES = libaacs.la
diff --git a/src/file/keydbcfg-lexer.l b/src/file/keydbcfg-lexer.l
index 74635a4..99b0713 100644
--- a/src/file/keydbcfg-lexer.l
+++ b/src/file/keydbcfg-lexer.l
@@ -38,6 +38,8 @@ static char *trim_string(const char *string);
 %option noinput
 %option nounput
 %option yylineno
+%option outfile="lex.yy.c"
+%option prefix="libaacs_yy"
 
 %s TITLE_STATE
 
diff --git a/src/file/keydbcfg-parser.y b/src/file/keydbcfg-parser.y
index d716a09..a3d31df 100644
--- a/src/file/keydbcfg-parser.y
+++ b/src/file/keydbcfg-parser.y
@@ -81,7 +81,7 @@ static int add_date_entry(title_entry_list *list, unsigned 
int year,
 void yyerror (void *scanner, dk_list *dklist, pk_list *pklist, cert_list 
*clist,
               title_entry_list *celist, digit_key_pair_list *dkplist,
               const char *msg);
-extern int yyget_lineno  (void *scanner);
+extern int libaacs_yyget_lineno  (void *scanner);
 
 /* uncomment the line below for debugging */
 // int yydebug = 1;
@@ -162,7 +162,7 @@ config_entry
   | error NEWLINE
     {
       fprintf(stderr, "bad entry at or around line %d\n",
-              yyget_lineno(scanner) - 1);
+              libaacs_yyget_lineno(scanner) - 1);
       yyerrok;
     }
   ;
@@ -435,11 +435,11 @@ int keydbcfg_parse_config(config_file *cfgfile, const 
char *path)
   digit_key_pair_list *dkplist = NULL;
 
   void *scanner;
-  yylex_init(&scanner);
-  yyset_in(fp, scanner);
+  libaacs_yylex_init(&scanner);
+  libaacs_yyset_in(fp, scanner);
   int retval = yyparse(scanner, head_dklist, head_pklist, head_clist,
                        head_celist, dkplist);
-  yylex_destroy(scanner);
+  libaacs_yylex_destroy(scanner);
 
   cfgfile->dkl = head_dklist;
   cfgfile->pkl = head_pklist;
@@ -735,5 +735,5 @@ void yyerror (void *scanner, dk_list *dklist, pk_list 
*pklist, cert_list *clist,
               title_entry_list *celist, digit_key_pair_list *dkplist,
               const char *msg)
 {
-  fprintf(stderr, "%s: line %d\n", msg, yyget_lineno(scanner));
+  fprintf(stderr, "%s: line %d\n", msg, libaacs_yyget_lineno(scanner));
 }

_______________________________________________
libaacs-devel mailing list
[email protected]
http://mailman.videolan.org/listinfo/libaacs-devel

Reply via email to