NetBSD Problem Report #9481

Received: (qmail 12257 invoked from network); 24 Feb 2000 22:03:31 -0000
Message-Id: <200002242203.QAA20426@jdarrowpiii.wheaton.edu>
Date: Thu, 24 Feb 2000 16:03:27 -0600 (CST)
From: John.P.Darrow@wheaton.edu
Reply-To: John.P.Darrow@wheaton.edu
To: gnats-bugs@gnats.netbsd.org
Cc: John.P.Darrow@wheaton.edu
Subject: shells/bash2 dlsym patch should be conditional on !__ELF__
X-Send-Pr-Version: 3.95

>Number:         9481
>Category:       pkg
>Synopsis:       shells/bash2 dlsym patch should be conditional on !__ELF__
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 24 14:06:01 +0000 2000
>Closed-Date:    Thu Feb 24 23:04:31 +0000 2000
>Last-Modified:  Thu Feb 24 23:04:55 +0000 2000
>Originator:     John Darrow
>Release:        pkgsrc up to at least today (2000-02-24)
>Organization:
	Computing Services
	Wheaton College, Wheaton, IL
>Environment:
System: NetBSD jdarrowpiii.wheaton.edu 1.4T NetBSD 1.4T (JDARROW) #0: Thu Feb 24 13:51:53 CST 2000 jdarrow@jdarrowpiii.wheaton.edu:/var/src/sys/arch/i386/compile/JDARROW i386


>Description:
pkgsrc/shells/bash2/patches contains the following patch, patch-ae:

$NetBSD: patch-ae,v 1.3 1998/08/07 11:13:53 agc Exp $

--- builtins/enable.def.orig	Fri Jul 18 15:55:00 1997
+++ builtins/enable.def	Tue Aug  4 21:18:05 1998
@@ -290,9 +290,10 @@
       name = list->word->word;

       size = strlen (name);
-      struct_name = xmalloc (size + 8);
-      strcpy (struct_name, name);
-      strcpy (struct_name + size, "_struct");
+      struct_name = xmalloc (size + 9);
+      *struct_name = '_';
+      strcpy (struct_name + 1, name);
+      strcpy (struct_name + size + 1, "_struct");

       b = (struct builtin *)dlsym (handle, struct_name);
       if (b == 0)

This patch adds an underscore to the beginning of certain symbols
which are then fed to dlsym.  The patch comes all the way from the
initial import of the FreeBSD bash2 port.  While it is correct for
a.out systems, ELF does not use the initial underscore, and thus
the enable builtin's "load from shared library" function will not work.

(are there other old patches laying around which do the same sort of
thing for other packages?)

>How-To-Repeat:
Examine code.
>Fix:
Either
1. conditionalize the application of the patch on show-shlib-type, or
2. make a conditional within the patch itself, something like this:
(This assumes that anything !ELF requires the underscore... do we build
on anything other than a.out and ELF (e.g. COFF)?)

$NetBSD: patch-ae,v 1.3 1998/08/07 11:13:53 agc Exp $

--- builtins/enable.def.orig	Fri Jul 18 15:55:00 1997
+++ builtins/enable.def	Tue Aug  4 21:18:05 1998
@@ -290,9 +290,16 @@
       name = list->word->word;

       size = strlen (name);
+#ifdef __ELF__
       struct_name = xmalloc (size + 8);
       strcpy (struct_name, name);
       strcpy (struct_name + size, "_struct");
+#else
+      struct_name = xmalloc (size + 9);
+      *struct_name = '_';
+      strcpy (struct_name + 1, name);
+      strcpy (struct_name + size + 1, "_struct");
+#endif

       b = (struct builtin *)dlsym (handle, struct_name);
       if (b == 0)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tron 
State-Changed-When: Thu Feb 24 15:04:31 PST 2000 
State-Changed-Why:  
Patch applied, thanks. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.