From laszlof@ritamari.vonostingroup.com  Wed Nov  2 03:14:28 2005
Return-Path: <laszlof@ritamari.vonostingroup.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 98E7116A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  2 Nov 2005 03:14:28 +0000 (GMT)
	(envelope-from laszlof@ritamari.vonostingroup.com)
Received: from ritamari.vonostingroup.com (ritamari.vonostingroup.com [216.144.193.230])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4134143D45
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  2 Nov 2005 03:14:28 +0000 (GMT)
	(envelope-from laszlof@ritamari.vonostingroup.com)
Received: from laszlof by ritamari.vonostingroup.com with local (Exim 4.54 (FreeBSD))
	id 1EX951-0004bi-GV; Tue, 01 Nov 2005 22:14:27 -0500
Message-Id: <E1EX951-0004bi-GV@ritamari.vonostingroup.com>
Date: Tue, 01 Nov 2005 22:14:27 -0500
From: Frank Laszlo <laszlof@vonostingroup.com>
Reply-To: Frank Laszlo <laszlof@vonostingroup.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: mark@uplink.dk
Subject: [PATCH]: etc/rc.d/ldconfig:does not properly handle ld{-elf}.so.conf
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         88383
>Category:       conf
>Synopsis:       [PATCH]: etc/rc.d/ldconfig:does not properly handle ld{-elf}.so.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    matteo
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 02 03:20:18 GMT 2005
>Closed-Date:    Sat Jan 21 13:02:19 GMT 2006
>Last-Modified:  Sat Jan 21 13:02:19 GMT 2006
>Originator:     Frank Laszlo
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD ritamari.vonostingroup.com 5.4-STABLE FreeBSD 5.4-STABLE #0: Thu Jun 9 22:20:56 EDT 2005 laszlof@ritamari.vonostingroup.com:/usr/obj/usr/src/sys/RITAMARI i386


	
>Description:
	etc/rc.d/ldconfig currently is supposed to add files from rc.conf defined
	by ldconfig_paths as well as paths *within* /etc/ld.so.conf and /etc/ld-elf.so.conf 
	respectively. This is not the case, as the code processes /etc/ld{-elf}.so.conf as a path
	to be passed to ldconfig. The attached patch will fix this segment of code.

>How-To-Repeat:
	Add a library path to /etc/ld.so.conf or /etc/ld-elf.so.conf and rerun /etc/rc.d/ldconfig.
	
>Fix:

	

--- rc.d-ldconfig.diff begins here ---
--- etc/rc.d/ldconfig.orig	Tue Nov  1 21:57:47 2005
+++ etc/rc.d/ldconfig	Tue Nov  1 22:04:39 2005
@@ -22,11 +22,18 @@
 	checkyesno ldconfig_insecure && _ins="-i"
 	if [ -x "${ldconfig_command}" ]; then
 		_LDC="/lib /usr/lib"
-		for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
+		for i in ${ldconfig_paths}; do
 			if [ -r "${i}" ]; then
 				_LDC="${_LDC} ${i}"
 			fi
 		done
+		if [ -r /etc/ld-elf.so.conf ]; then
+			for i in `cat /etc/ld-elf.so.conf`; do
+				if [ -r "${i}" ]; then
+					_LDC="${_LDC} ${i}"
+				fi
+			done
+		fi	
 		echo 'ELF ldconfig path:' ${_LDC}
 		${ldconfig} -elf ${_ins} ${_LDC}
 
@@ -36,11 +43,18 @@
 			# Default the a.out ldconfig path.
 			: ${ldconfig_paths_aout=${ldconfig_paths}}
 			_LDC=/usr/lib/aout
-			for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
+			for i in ${ldconfig_paths_aout}; do
 				if [ -r "${i}" ]; then
 					_LDC="${_LDC} ${i}"
 				fi
 			done
+			if [ -r /etc/ld.so.conf ]; then
+				for i in `cat /etc/ld.so.conf`; do
+					if [ -r "${i}" ]; then
+						_LDC="${_LDC} ${i}"
+					fi
+				done
+			fi
 			echo 'a.out ldconfig path:' ${_LDC}
 			${ldconfig} -aout ${_ins} ${_LDC}
 			;;
--- rc.d-ldconfig.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Mon Dec 5 09:28:01 GMT 2005 
Responsible-Changed-Why:  

Bring this to the attention of the list 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88383 

From: Florent Thoumie <flz@xbsd.org>
To: bug-followup@freebsd.org
Cc: Frank Laszlo <laszlof@vonostingroup.com>
Subject: Re: conf/88383
Date: Mon, 19 Dec 2005 12:24:45 +0100

 --=-1a1EXwkAs1HStI9vuMwo
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 	I'm quite sure the current version of rc.d/ldconfig does what=20
 	you want.
 
 	Try this and you'll see  :
 
 	# cat >> /root/foo.so.conf
 	/lib
 	/usr/lib
 	^D
 	# ldconfig /var/empty
 	# ldconfig -r
 	# ldconfig /root/foo.so.conf
 	# ldconfig -r
 
 	Look at src/sbin/ldconfig/ldconfig.c and you'll see :
 
 	if (S_ISREG(stbuf.st_mode))
 		rval |=3D dofile(argv[i], 0);
 	else
 		add_search_path(argv[i]);
 
 --=20
 Florent Thoumie
 flz@FreeBSD.org
 FreeBSD committer
 
 --=-1a1EXwkAs1HStI9vuMwo
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.2 (FreeBSD)
 
 iD8DBQBDpph8MxEkbVFH3PQRAj6fAJ9Tg7HZ833FhRlpB15N6UVF5ZgO9gCfThyJ
 unm3kW/Av8qV7PX8NKEfSIU=
 =0ipU
 -----END PGP SIGNATURE-----
 
 --=-1a1EXwkAs1HStI9vuMwo--
 
State-Changed-From-To: open->closed 
State-Changed-By: matteo 
State-Changed-When: Sat Jan 21 13:01:26 UTC 2006 
State-Changed-Why:  
The current version of ldconfig works as expected. 


Responsible-Changed-From-To: freebsd-rc->matteo 
Responsible-Changed-By: matteo 
Responsible-Changed-When: Sat Jan 21 13:01:26 UTC 2006 
Responsible-Changed-Why:  
The current version of ldconfig works as expected. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88383 
>Unformatted:
