Subject: pkg/19024: ogle_gui doesn't work due to wrong error handling of dlsym()
To: None <gnats-bugs@gnats.netbsd.org>
From: None <thesing@cs.uni-sb.de>
List: netbsd-bugs
Date: 11/12/2002 15:20:39
>Number: 19024
>Category: pkg
>Synopsis: ogle_gui-0.8.5nb1 doesn't work due to error handling of dlsym()
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 12 06:21:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Stephan Thesing
>Release: NetBSD 1.6K
>Organization:
Saarland University
>Environment:
System: NetBSD gargoyle.cs.uni-sb.de 1.6K NetBSD 1.6K (Gargoyle) #7: Tue Nov 5 16:22:59 CET 2002 thesing@gargoyle.cs.uni-sb.de:/usr/src/sys/arch/i386/compile/Gargoyle i386
Architecture: i386
Machine: i386
>Description:
When installing graphics/ogle_gui (ogle_gui-0.8.5nb1) from
pkgsrc, every invocation of it will fail with a message of the form:
Error during dlsym of glade_init: Cannot open "/usr/pkg/lib/ogle/libxml.so.9"
This is due to a bug in the function my_dlsym() in the file src/my_glade.c
There, it is checked if dlsym() returned an error by calling dlerror()
afterwards and checking if the resulting error string is != NULL.
But on NetBSD, dlsym() will return NULL on failure. If it doesn't fail,
the result of a succeeding dlerror() call is the last error that occured
_before_. In this case, it is the error that ld.elf_so encountered while
searching for libxml.so.9 in its search path....
>How-To-Repeat:
Install graphics/ogle_gui and try to invoke `ogle -u gui' :-)
>Fix:
The attached fix invokes dlerror() before the call to dlsym(), clearing it.
--- src/my_glade.c.orig Tue Nov 12 14:51:10 2002
+++ src/my_glade.c Tue Nov 12 14:52:03 2002
@@ -36,8 +36,11 @@
#else
new_symbol = g_strdup(symbol);
#endif
+#if defined(__NetBSD__)
+ error = dlerror();
+#endif
fun = dlsym(handle, new_symbol);
error = dlerror();
if(error != NULL) {
fprintf(stderr, "Error during dlsym of %s: %s\n", new_symbol, error);
>Release-Note:
>Audit-Trail:
>Unformatted: