From jdp@polstra.com  Mon Jun 25 14:38:22 2001
Return-Path: <jdp@polstra.com>
Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74])
	by hub.freebsd.org (Postfix) with ESMTP id AD3A037B406
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 25 Jun 2001 14:38:21 -0700 (PDT)
	(envelope-from jdp@polstra.com)
Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13])
	by wall.polstra.com (8.11.3/8.11.1) with ESMTP id f5PLb5233964;
	Mon, 25 Jun 2001 14:37:05 -0700 (PDT)
	(envelope-from jdp@polstra.com)
Message-Id: <XFMail.010625143705.jdp@polstra.com>
Date: Mon, 25 Jun 2001 14:37:05 -0700 (PDT)
From: John Polstra <jdp@polstra.com>
To: Chris BeHanna <behanna@topperwein.dyndns.org>
Cc: FreeBSD-gnats-submit@freebsd.org
In-Reply-To: <200106160649.f5G6nqP89676@topperwein.dyndns.org>
Subject: RE: rtld-elf apparently ignores LD_LIBRARY_PATH

>Number:         28406
>Category:       bin
>Synopsis:       RE: rtld-elf apparently ignores LD_LIBRARY_PATH
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    greid
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 25 14:40:02 PDT 2001
>Closed-Date:    Mon Jul 2 11:17:07 PDT 2001
>Last-Modified:  Thu Jan 24 04:25:15 PST 2002
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 We have been here before.  Here's the relevant log message from
 "src/libexec/rtld-elf/rtld.c":
 
 revision 1.21
 date: 1999/04/09 06:42:00;  author: jdp;  state: Exp;  lines: +4 -4
 The ELF specification says that the RPATH in the executable or
 shared object takes precedence over LD_LIBRARY_PATH.  Make the
 dynamic linker do it that way.
 
 John
 
 Chris BeHanna wrote:
 > 
 >>Submitter-Id: current-users
 >>Originator:   Chris BeHanna
 >>Organization: 
 >>Confidential: no 
 >>Synopsis:     rtld-elf ignores LD_LIBRARY_PATH
 >>Severity:     critical
 >>Priority:     medium
 >>Category:     bin
 >>Class:                sw-bug
 >>Release:      FreeBSD 4.3-STABLE i386
 >>Environment:
 > System: FreeBSD topperwein.dyndns.org 4.3-STABLE FreeBSD 4.3-STABLE #0: Tue Jun 12
 > 09:06:55 EDT 2001 root@topperwein.dyndns.org:/usr/obj/usr/src/sys/TOPPERWEIN i386
 > 
 >     CPU:  AMD Athlon, 1.333 GHz (AMD K-7)
 >     Affected file:  /usr/libexec/ld-elf.so.1
 >>Description:
 >     The XFree86 4.1.0_4 port fails on this box when attempting to
 >     build the Type 1 fonts.  In particular, this line fails:
 > 
 > LD_LIBRARY_PATH=../../../exports/lib XFT_CONFIG=../../../lib/Xft/XftConfig
 > ../../../exports/bin/xftcache   .
 > /usr/libexec/ld-elf.so.1: ../../../exports/bin/xftcache: Undefined symbol
 > "XftDirSave"
 > 
 >     where `pwd` is /usr/ports/x11/XFree86-4/work/xc/programs/xftcache.
 > 
 >     According to rtld(1), LD_LIBRARY_PATH should supercede the default
 >     search path except for setuid and setgid executables, of which
 >     xftcache is neither.
 > 
 >     I verified this problem by running the command by hand and by
 >     doing  "LD_LIBRARY_PATH=../../../exports/lib ldd xftcache".  The
 >     output pointed to the installed /usr/X11R6/lib/libXft.so instead of
 >     the one within the XFree86 build tree and, indeed the installed
 >     libXft.so doesn't have the symbol XftDirSave, but the one in the build
 >     tree does.
 > 
 >     Note that ldconfig -r reveals an entry for libXft.so that does
 >     indeed point to /usr/X11R6/lib/libXft.so.  That said, if I can't
 >     selectively override that by setting LD_LIBRARY_PATH on the command
 >     line, that's a big problem.
 > 
 >     From the comment from find_library(), I see that the executable's
 >     RPATH entry takes precedence over LD_LIBRARY_PATH.  If that's the
 >     case, then how can LD_LIBRARY_PATH be used to force an executable to
 >     bootstrap itself from a build tree?
 > 
 >>How-To-Repeat:
 >     Attempt to build XFree86 4.1.0_4 on an Athlon running 4.3-STABLE
 >     from the date indicated in uname -a, above.
 >>Fix:
 >     Change find_library() to look in LD_LIBRARY_PATH before RPATH for
 >     non-setuid, non-setgid executables:
 > 
 > --- rtld.c    Mon May 14 01:01:35 2001
 > +++ rtld.c.new        Sat Jun 16 02:45:03 2001
 > @@ -803,8 +803,8 @@
 >      dbg(" Searching for \"%s\"", name);
 >  
 >      if ((refobj != NULL &&
 > -      (pathname = search_library_path(name, refobj->rpath)) != NULL) ||
 >        (pathname = search_library_path(name, ld_library_path)) != NULL ||
 > +      (pathname = search_library_path(name, refobj->rpath)) != NULL) ||
 >        (pathname = search_library_path(name, gethints())) != NULL ||
 >        (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL)
 >       return pathname;
 > 
 > If I completely misunderstand, please let me know, and I'll raise no
 > fuss about closing this PR.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: greid 
State-Changed-When: Mon Jul 2 11:17:07 PDT 2001 
State-Changed-Why:  
Mailing list message; not a PR 


Responsible-Changed-From-To: gnats-admin->greid 
Responsible-Changed-By: greid 
Responsible-Changed-When: Mon Jul 2 11:17:07 PDT 2001 
Responsible-Changed-Why:  
Misfiled 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28406 
>Unformatted:
