NetBSD Problem Report #19024
Received: (qmail 26596 invoked by uid 605); 12 Nov 2002 14:20:44 -0000
Message-Id: <200211121420.gACEKdT09758@gargoyle.cs.uni-sb.de>
Date: Tue, 12 Nov 2002 15:20:39 +0100 (CET)
From: thesing@cs.uni-sb.de
Sender: gnats-bugs-owner@netbsd.org
Reply-To: thesing@cs.uni-sb.de
To: gnats-bugs@gnats.netbsd.org
Subject: ogle_gui doesn't work due to wrong error handling of dlsym()
X-Send-Pr-Version: 3.95
>Number: 19024
>Category: lib
>Synopsis: ogle_gui-0.8.5nb1 doesn't work due to error handling of dlsym()
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: nathanw
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 12 14:21:00 +0000 2002
>Closed-Date: Thu Nov 14 21:21:20 +0000 2002
>Last-Modified: Mon Mar 29 23:32:03 +0000 2004
>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:
From: "Nathan J. Williams" <nathanw@wasabisystems.com>
To: thesing@cs.uni-sb.de
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/19024: ogle_gui doesn't work due to wrong error handling of dlsym()
Date: 13 Nov 2002 17:31:55 -0500
thesing@cs.uni-sb.de writes:
> 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....
The analysis of what happens is correct, but the finger-pointing is
not; ogle is correct here, and NetBSD is wrong. The dlerror() function
is specified to return NULL if there has been no error since the last
call to dlerror().
I'm working on a fix for this in the dynamic linker.
- Nathan
From: Nathan J Williams <nathanw@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:
Subject: pr/19024 CVS commit: basesrc/libexec/ld.elf_so
Date: Thu, 14 Nov 2002 23:07:47 +0200 (EET)
Module Name: basesrc
Committed By: nathanw
Date: Thu Nov 14 21:07:46 UTC 2002
Modified Files:
basesrc/libexec/ld.elf_so: search.c
Log Message:
In _rtld_load_library(), ensure that the old _rtld_error state (a message from
a previous error, or NULL) is preserved if the search eventually succeeds.
Addresses the problem pointed out in PR pkg/19024.
To generate a diff of this commit:
cvs rdiff -r1.15 -r1.16 basesrc/libexec/ld.elf_so/search.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: nathanw
State-Changed-When: Thu Nov 14 13:20:03 PST 2002
State-Changed-Why:
Fixed by revision 1.16 of src/libexec/ld.elf_so/search.c.
Responsible-Changed-From-To: pkg-manager->nathanw
Responsible-Changed-By: nathanw
Responsible-Changed-When: Thu Nov 14 13:20:03 PST 2002
Responsible-Changed-Why:
Took responsibility for this.
From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: pr/19024 CVS commit: pkgsrc/multimedia/ogle_gui
Date: Mon, 29 Mar 2004 23:31:30 +0000 (UTC)
Module Name: pkgsrc
Committed By: wiz
Date: Mon Mar 29 23:31:30 UTC 2004
Modified Files:
pkgsrc/multimedia/ogle_gui: Makefile distinfo
Added Files:
pkgsrc/multimedia/ogle_gui/patches: patch-ab
Log Message:
Add patch that works around PR 19024 for the 1.6 branch; also closes
PR 21890 by Kai Puolamaki.
Bump PKGREVISION to 3.
To generate a diff of this commit:
cvs rdiff -r1.4 -r1.5 pkgsrc/multimedia/ogle_gui/Makefile
cvs rdiff -r1.1 -r1.2 pkgsrc/multimedia/ogle_gui/distinfo
cvs rdiff -r0 -r1.1 pkgsrc/multimedia/ogle_gui/patches/patch-ab
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.