bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: update gettext to handle expat-2.0.0


From: Bruno Haible
Subject: Re: update gettext to handle expat-2.0.0
Date: Tue, 4 Apr 2006 13:43:39 +0200
User-agent: KMail/1.5

Hello,

Mike Frysinger wrote:
> i'm not sure if this has been discussed at all as i cant seem to find any
> mailing list archives for this list ...
>
> expat-2.0.0 was released recently and this version changed ABI #'s ... so
> it now installs as libexpat.so.1 instead of libexpat.so.0

Thanks for making me aware of this!

> the trouble is the x-glade.c file tries to dlopen "libexpat.so.0" which
> will obviously fail on systems that only have expat-2.0.0 ... would it be
> safe to change the code to just dlopen("libexpat.so") or should it be
> changed to read something like:
> void *handle = dlopen ("libexpat.so.1", RTLD_LAZY);
> if (handle == NULL)
>       handle = dlopen ("libexpat.so.0", RTLD_LAZY);

There is a reason why they changed the major version number of the library:
Its binary API changed (functions were removed or function signatures changed
or function return types were changed). You cannot simply ignore these changes
and use whatever version of the library is found - except if by luck gettext
was not using the API portions that were changed (which is not the case).

Find attached a patch.

Bruno


2006-04-03  Bruno Haible  <address@hidden>

        * x-glade.c (p_XML_GetCurrentLineNumber, p_XML_GetCurrentColumnNumber):
        Declare differently for expat >= 2.0.0.
        (load_libexpat): Search for a differently library name for expat >=
        2.0.0.
        (do_extract_glade): Update.
        Reported by Mike Frysinger <address@hidden>.

diff -r -c3 --exclude='*.po*' --exclude='*.info*' --exclude='*_*.html' 
--exclude='*.*.html' --exclude='*.[13]' --exclude='*.1.in' 
--exclude=Makefile.in --exclude=aclocal.m4 --exclude=configure 
--exclude=version.texi --exclude=stamp-vti --exclude='po-*-gen*.[ch]' 
--exclude='*.o' --exclude='*.lo' --exclude='*.gmo' --exclude=ABOUT-NLS 
--exclude='javadoc[12]' --exclude=CVS gettext-cvs/gettext-tools/src/x-glade.c 
gettext-6/gettext-tools/src/x-glade.c
*** gettext-cvs/gettext-tools/src/x-glade.c     Sat Apr  1 23:40:50 2006
--- gettext-6/gettext-tools/src/x-glade.c       Tue Apr  4 02:47:32 2006
***************
*** 125,132 ****
--- 125,137 ----
  static void (*p_XML_SetCommentHandler) (XML_Parser parser, XML_CommentHandler 
handler);
  static int (*p_XML_Parse) (XML_Parser parser, const char *s, int len, int 
isFinal);
  static enum XML_Error (*p_XML_GetErrorCode) (XML_Parser parser);
+ #if XML_MAJOR_VERSION >= 2
+ static XML_Size (*p_XML_GetCurrentLineNumber) (XML_Parser parser);
+ static XML_Size (*p_XML_GetCurrentColumnNumber) (XML_Parser parser);
+ #else
  static int (*p_XML_GetCurrentLineNumber) (XML_Parser parser);
  static int (*p_XML_GetCurrentColumnNumber) (XML_Parser parser);
+ #endif
  static void (*p_XML_ParserFree) (XML_Parser parser);
  static const XML_LChar * (*p_XML_ErrorString) (int code);
  
***************
*** 148,154 ****
  {
    if (libexpat_loaded == 0)
      {
!       void *handle = dlopen ("libexpat.so.0", RTLD_LAZY);
        if (handle != NULL
          && (p_XML_ParserCreate = dlsym (handle, "XML_ParserCreate")) != NULL
          && (p_XML_SetElementHandler = dlsym (handle, 
"XML_SetElementHandler")) != NULL
--- 153,166 ----
  {
    if (libexpat_loaded == 0)
      {
!       void *handle;
!       /* Be careful to use exactly the version of libexpat that matches the
!        binary interface declared in <expat.h>.  */
! #if XML_MAJOR_VERSION >= 2
!       handle = dlopen ("libexpat.so.1", RTLD_LAZY);
! #else
!       handle = dlopen ("libexpat.so.0", RTLD_LAZY);
! #endif
        if (handle != NULL
          && (p_XML_ParserCreate = dlsym (handle, "XML_ParserCreate")) != NULL
          && (p_XML_SetElementHandler = dlsym (handle, 
"XML_SetElementHandler")) != NULL
***************
*** 413,428 ****
        }
  
        if (XML_Parse (parser, buf, count, 0) == 0)
!       error (EXIT_FAILURE, 0, _("%s:%d:%d: %s"), logical_filename,
!              XML_GetCurrentLineNumber (parser),
!              XML_GetCurrentColumnNumber (parser) + 1,
               XML_ErrorString (XML_GetErrorCode (parser)));
      }
  
    if (XML_Parse (parser, NULL, 0, 1) == 0)
!     error (EXIT_FAILURE, 0, _("%s:%d:%d: %s"), logical_filename,
!          XML_GetCurrentLineNumber (parser),
!          XML_GetCurrentColumnNumber (parser) + 1,
           XML_ErrorString (XML_GetErrorCode (parser)));
  
    XML_ParserFree (parser);
--- 425,440 ----
        }
  
        if (XML_Parse (parser, buf, count, 0) == 0)
!       error (EXIT_FAILURE, 0, _("%s:%lu:%lu: %s"), logical_filename,
!              (unsigned long) XML_GetCurrentLineNumber (parser),
!              (unsigned long) XML_GetCurrentColumnNumber (parser) + 1,
               XML_ErrorString (XML_GetErrorCode (parser)));
      }
  
    if (XML_Parse (parser, NULL, 0, 1) == 0)
!     error (EXIT_FAILURE, 0, _("%s:%lu:%lu: %s"), logical_filename,
!          (unsigned long) XML_GetCurrentLineNumber (parser),
!          (unsigned long) XML_GetCurrentColumnNumber (parser) + 1,
           XML_ErrorString (XML_GetErrorCode (parser)));
  
    XML_ParserFree (parser);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]