From lev@ftp.translate.ru  Fri Jan  9 08:33:56 2004
Return-Path: <lev@ftp.translate.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D019816A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  9 Jan 2004 08:33:56 -0800 (PST)
Received: from ftp.translate.ru (ftp.translate.ru [195.131.4.140])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 49B2A43D1F
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  9 Jan 2004 08:33:55 -0800 (PST)
	(envelope-from lev@ftp.translate.ru)
Received: from ftp.translate.ru (localhost [127.0.0.1])
	by ftp.translate.ru (8.12.9/8.12.9) with ESMTP id i09GXrHK044051
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 9 Jan 2004 19:33:54 +0300 (MSK)
	(envelope-from lev@ftp.translate.ru)
Received: (from lev@localhost)
	by ftp.translate.ru (8.12.9/8.12.9/Submit) id i09GXrbA044050;
	Fri, 9 Jan 2004 19:33:53 +0300 (MSK)
	(envelope-from lev)
Message-Id: <200401091633.i09GXrbA044050@ftp.translate.ru>
Date: Fri, 9 Jan 2004 19:33:53 +0300 (MSK)
From: "Lev A. Serbryakov" <lev@freebsd.org>
Reply-To: "Lev A. Serbryakov" <lev@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         61133
>Category:       ports
>Synopsis:       When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 09 08:40:12 PST 2004
>Closed-Date:    Tue Jan 20 11:15:39 PST 2004
>Last-Modified:  Tue Jan 20 11:15:39 PST 2004
>Originator:     Lev A. Serbryakov
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD ftp.translate.ru 4.8-STABLE FreeBSD 4.8-STABLE #0: Fri Apr 11 00:25:30 MSD 2003 lev@ftp.translate.ru:/usr/obj/usr/src/sys/FTPTR i386
Ports tree: 9 Jan 2004

>Description:

  INSTALL_AS_USER variable allows to install any port as user, without
root privileges. It is extremly useful for ports maintainers when
they check port installation/deinstallation, etc. 
But even in this case ports system try to run `ldconfig', if
INSTALLS_SHLIB is defined. And ldconfig fails!

  I think, it is good idea to skip ldconfig running, if port is
installed as user. 

  Here is a patch.

>How-To-Repeat:

  Try to install any port with INSTALLS_SHLIB as user.
 
>Fix:
>Release-Note:
--- bsd.port.mk.orig	2003-11-25 14:59:00.000000000 +0300
+++ bsd.port.mk	2004-01-09 19:45:17.218750000 +0300
@@ -3302,9 +3302,13 @@
 .if !target(run-ldconfig)
 run-ldconfig:
 .if defined(INSTALLS_SHLIB)
+.if !defined(INSTALL_AS_USER)
 	@${ECHO_MSG} "===>   Running ldconfig"
 	${LDCONFIG} -m ${LDCONFIG_RUNLIST}
 .else
+	@${ECHO_MSG} "===>   Install as user: skipping ldconfig"
+.endif
+.else
 	@${DO_NADA}
 .endif
 .endif
@@ -4472,7 +4476,7 @@
 .if !defined(NO_MTREE)
 	@${ECHO_CMD} "@unexec if [ -f %D/info/dir ]; then if sed -e '1,/Menu:/d' %D/info/dir | grep -q '^[*] '; then true; else rm %D/info/dir; fi; fi" >> ${TMPPLIST}
 .endif
-.if defined(INSTALLS_SHLIB)
+.if defined(INSTALLS_SHLIB) && !defined(INSTALL_AS_USER)
 	@${ECHO_CMD} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST}" >> ${TMPPLIST}
 	@${ECHO_CMD} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST}
 .endif
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: lev 
Responsible-Changed-When: Fri Jan 9 08:50:14 PST 2004 
Responsible-Changed-Why:  
It is whole-port-subsystem change. 


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

From: Lev Serebryakov <lev@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: lev@FreeBSD.org
Subject: Re: ports/61133: When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
Date: Fri, 9 Jan 2004 19:42:57 +0300

 Hello, ! How are you?
 
   Here are proper patch:
 
 --- bsd.port.mk.orig    2003-11-25 14:59:00.000000000 +0300
 +++ bsd.port.mk 2004-01-09 19:38:45.421875000 +0300
 @@ -3302,9 +3302,13 @@
  .if !target(run-ldconfig)
  run-ldconfig:
  .if defined(INSTALLS_SHLIB)
 +.if !defined(INSTALL_AS_USER)
         @${ECHO_MSG} "===>   Running ldconfig"
         ${LDCONFIG} -m ${LDCONFIG_RUNLIST}
  .else
 +       @${ECHO_MSG} "===>   Install as user: skipping ldconfig"
 +.fi
 +.else
         @${DO_NADA}
  .endif
  .endif
 @@ -4472,7 +4476,7 @@
  .if !defined(NO_MTREE)
         @${ECHO_CMD} "@unexec if [ -f %D/info/dir ]; then if sed -e '1,/Menu:/d' %D/info/dir | grep -q '^[*] '; then true; else rm %D/info/dir; fi; fi" >> ${TMPPLIST}
  .endif
 -.if defined(INSTALLS_SHLIB)
 +.if defined(INSTALLS_SHLIB) && !defined(INSTALL_AS_USER)
         @${ECHO_CMD} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST}" >> ${TMPPLIST}
         @${ECHO_CMD} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST}
  .endif
   
 
 --
                Lev Serebryakov
 

From: Lev Serebryakov <lev@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: lev@FreeBSD.org
Subject: Re: ports/61133: When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
Date: Fri, 9 Jan 2004 19:46:23 +0300

 Hello, ! How are you?
 
   Surely, today is not my best day :(
   Here is PROPER patch:
 
 --- bsd.port.mk.orig    2003-11-25 14:59:00.000000000 +0300
 +++ bsd.port.mk 2004-01-09 19:38:45.421875000 +0300
 @@ -3302,9 +3302,13 @@
  .if !target(run-ldconfig)
  run-ldconfig:
  .if defined(INSTALLS_SHLIB)
 +.if !defined(INSTALL_AS_USER)
         @${ECHO_MSG} "===>   Running ldconfig"
         ${LDCONFIG} -m ${LDCONFIG_RUNLIST}
  .else
 +       @${ECHO_MSG} "===>   Install as user: skipping ldconfig"
 +.endif
 +.else
         @${DO_NADA}
  .endif
  .endif
 @@ -4472,7 +4476,7 @@
  .if !defined(NO_MTREE)
         @${ECHO_CMD} "@unexec if [ -f %D/info/dir ]; then if sed -e '1,/Menu:/d' %D/info/dir | grep -q '^[*] '; then true; else rm %D/info/dir; fi; fi" >> ${TMPPLIST}
  .endif
 -.if defined(INSTALLS_SHLIB)
 +.if defined(INSTALLS_SHLIB) && !defined(INSTALL_AS_USER)
         @${ECHO_CMD} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST}" >> ${TMPPLIST}
         @${ECHO_CMD} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST}
  .endif
   
 
 --
                Lev Serebryakov
 

From: Edwin Groothuis <edwin@mavetju.org>
To: freebsd-gnats-submit@FreeBSD.org, lev@freebsd.org
Cc:  
Subject: Re: ports/61133 - When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
Date: Mon, 12 Jan 2004 13:05:13 +1100

 And what if the user is root to start with?
 
 I personally think that a call to ldconfig should be made error-safe
 by adding a - to it:
 
 +.if !defined(INSTALL_AS_USER)
         @${ECHO_MSG} "===>   Running ldconfig"
 	${LDCONFIG} -m ${LDCONFIG_RUNLIST}
 +.else
 +       @${ECHO_MSG} "===>   Running ldconfig (errors are ignored)"
 +	-${LDCONFIG} -m ${LDCONFIG_RUNLIST}
 +.endif
 
 
 Edwin
 
 -- 
 Edwin Groothuis      |            Personal website: http://www.mavetju.org
 edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/

From: Edwin Groothuis <edwin@freebsd.org>
To: Cc: portmgr@FreeBSD.org,
	FreeBSD Gnats Submit <freebsd-gnats-submit@freebsd.org>
Subject: Re: ports/61133 - When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
Date: Mon, 12 Jan 2004 15:44:26 +1100

 On Sun, Jan 11, 2004 at 10:56:30PM -0500, Joe Marcus Clarke wrote:
 > On Sun, 2004-01-11 at 21:10, Edwin Groothuis wrote:
 > > The following reply was made to PR ports/61133; it has been noted by GNATS.
 > > 
 > > From: Edwin Groothuis <edwin@mavetju.org>
 > > To: freebsd-gnats-submit@FreeBSD.org, lev@freebsd.org
 > > Cc:  
 > > Subject: Re: ports/61133 - When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
 > > Date: Mon, 12 Jan 2004 13:05:13 +1100
 > > 
 > >  And what if the user is root to start with?
 > 
 > If the user is already root, they shouldn't be setting INSTALL_AS_USER. 
 > That variable is only there to override the calls to su[do].  This
 > allows users to install ports into an alternate PREFIX in environments
 > when they do not have root access.  Calling ldconfig and ignoring errors
 > isn't going to buy them anything.
 
 True. Except that some people do need the call to ldconfig, even
 if they're not root.
 
 ldconfig is used to determine if a shared library is installed.
 Without an entry for a library in the hints file, the build will
 stop. So being unable to run ldconfig for new shared libraries will
 stop users to be able to build ports which require shared libraries
 which are not in the default hints file. So actually you're throwing
 away the possibility to install new shared libraries to save an
 error message.
 
 For myself, as a commiter, I have an account on the FreeBSD ports
 cluster. I can build the ports on every platform, see what goes
 wrong etc. But, it is all as a normal user. In the past I had two
 possibilities to install shared libraries: run a homebrewn ldconfig
 which emulates the ldconfig commands (-m -r -R etc) and setting
 LDCONFIG to myhomebrewnldconfig or setting LDCONFIG to /sbin/ldconfig
 -f /home/edwin/etc/hints.ldconfig
 
 Both solutions worked fine, but will stop working fine because
 of this. That isn't buying me much. I prefer setting LDCONFIG to
 something smart which doesn't break too much.
 
 Edwin
 -- 
 Edwin Groothuis      |            Personal website: http://www.mavetju.org
 edwin@freebsd.org    |          Weblog: http://weblog.barnet.com.au/edwin/

From: Joe Marcus Clarke <marcus@marcuscom.com>
To: Edwin Groothuis <edwin@freebsd.org>
Cc: portmgr@freebsd.org,
	FreeBSD Gnats Submit <freebsd-gnats-submit@freebsd.org>
Subject: Re: ports/61133 - When INSTALL_AS_USER is specified, `ldconfig'
	stage of port installation should be ommited
Date: Sun, 11 Jan 2004 23:47:30 -0500

 --=-mW3WX/05o6OlP6va5n83
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 On Sun, 2004-01-11 at 23:44, Edwin Groothuis wrote:
 > On Sun, Jan 11, 2004 at 10:56:30PM -0500, Joe Marcus Clarke wrote:
 > > On Sun, 2004-01-11 at 21:10, Edwin Groothuis wrote:
 > > > The following reply was made to PR ports/61133; it has been noted by =
 GNATS.
 > > >=20
 > > > From: Edwin Groothuis <edwin@mavetju.org>
 > > > To: freebsd-gnats-submit@FreeBSD.org, lev@freebsd.org
 > > > Cc: =20
 > > > Subject: Re: ports/61133 - When INSTALL_AS_USER is specified, `ldconf=
 ig' stage of port installation should be ommited
 > > > Date: Mon, 12 Jan 2004 13:05:13 +1100
 > > >=20
 > > >  And what if the user is root to start with?
 > >=20
 > > If the user is already root, they shouldn't be setting INSTALL_AS_USER.=
 =20
 > > That variable is only there to override the calls to su[do].  This
 > > allows users to install ports into an alternate PREFIX in environments
 > > when they do not have root access.  Calling ldconfig and ignoring error=
 s
 > > isn't going to buy them anything.
 >=20
 > True. Except that some people do need the call to ldconfig, even
 > if they're not root.
 >=20
 > ldconfig is used to determine if a shared library is installed.
 > Without an entry for a library in the hints file, the build will
 > stop. So being unable to run ldconfig for new shared libraries will
 > stop users to be able to build ports which require shared libraries
 > which are not in the default hints file. So actually you're throwing
 > away the possibility to install new shared libraries to save an
 > error message.
 >=20
 > For myself, as a commiter, I have an account on the FreeBSD ports
 > cluster. I can build the ports on every platform, see what goes
 > wrong etc. But, it is all as a normal user. In the past I had two
 > possibilities to install shared libraries: run a homebrewn ldconfig
 > which emulates the ldconfig commands (-m -r -R etc) and setting
 > LDCONFIG to myhomebrewnldconfig or setting LDCONFIG to /sbin/ldconfig
 > -f /home/edwin/etc/hints.ldconfig
 >=20
 > Both solutions worked fine, but will stop working fine because
 > of this. That isn't buying me much. I prefer setting LDCONFIG to
 > something smart which doesn't break too much.
 
 Why don't you just set LD_LIBRARY_PATH for your environment?  I still
 don't see how your patch, as-is, solves this problem.
 
 Joe
 
 >=20
 > Edwin
 --=20
 PGP Key : http://www.marcuscom.com/pgp.asc
 
 --=-mW3WX/05o6OlP6va5n83
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.4 (FreeBSD)
 
 iD8DBQBAAibhb2iPiv4Uz4cRAnAzAKCVQfqY2UbW0UAqMlenxXwqStpMjgCcC6Pj
 kvUGp9Xr2FiI7TwfA3VqwBA=
 =VShI
 -----END PGP SIGNATURE-----
 
 --=-mW3WX/05o6OlP6va5n83--
 

From: Edwin Groothuis <edwin@mavetju.org>
To: portmgr@freebsd.org,
	FreeBSD Gnats Submit <freebsd-gnats-submit@freebsd.org>
Cc:  
Subject: Re: ports/61133 - When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
Date: Mon, 12 Jan 2004 16:07:22 +1100

 On Sun, Jan 11, 2004 at 11:47:30PM -0500, Joe Marcus Clarke wrote:
 > Why don't you just set LD_LIBRARY_PATH for your environment?  I still
 > don't see how your patch, as-is, solves this problem.
 
 Please check this part of bsd.port.mk, fifth line 5:
 
 lib-depends:
     [...]
     @for i in ${LIB_DEPENDS}; do \
 	[..]
         if ${LDCONFIG} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e
 "-l$$pattern"; then \
             ${ECHO_MSG} " - found"; \
             if [ ${_DEPEND_ALWAYS} = 1 ]; then \
                 ${ECHO_MSG} "       (but building it anyway)"; \
                 notfound=1; \
             else \
                 notfound=0; \
             fi; \
         else \
             ${ECHO_MSG} " - not found"; \
             notfound=1; \
         fi; \
 
 If I'm not able to run LDCONFIG (whatever it does, whatever it is
 pointing to), the output of LDCONFIG in line 5 is always empty,
 making the expression false, causing it to print "not found" and
 starting to build the library, again! The library-port reinstalls
 the package (or complains it already exists), afterwards LDCONFIG
 is run again (not in the example) and the library is still not in
 the hints file, and the make aborts.
 
 So far for "INSTALL_AS_USER"...
 
 My patch didn't resolve the problem neither, but at least didn't
 break it more. The only solution clean way out of this is to make
 a smart replacement for /sbin/ldconfig in LDCONFIG when installing
 as an user.
 
 Edwin
 
 -- 
 Edwin Groothuis      |            Personal website: http://www.mavetju.org
 edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/

From: Joe Marcus Clarke <marcus@marcuscom.com>
To: Edwin Groothuis <edwin@mavetju.org>
Cc: portmgr@freebsd.org,
	FreeBSD Gnats Submit <freebsd-gnats-submit@freebsd.org>
Subject: Re: ports/61133 - When INSTALL_AS_USER is specified, `ldconfig'
	stage of port installation should be ommited
Date: Mon, 12 Jan 2004 00:19:19 -0500

 --=-oiDQa7aG03VYZ2z7siO2
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 On Mon, 2004-01-12 at 00:07, Edwin Groothuis wrote:
 > On Sun, Jan 11, 2004 at 11:47:30PM -0500, Joe Marcus Clarke wrote:
 > > Why don't you just set LD_LIBRARY_PATH for your environment?  I still
 > > don't see how your patch, as-is, solves this problem.
 >=20
 > Please check this part of bsd.port.mk, fifth line 5:
 
 I thought I had used LD_LIBRARY_PATH in the past, but I must have been
 wrong.  Perhaps we should enable support for that in lib-depends.  It
 should be easy enough to add.
 
 >=20
 > My patch didn't resolve the problem neither, but at least didn't
 > break it more. The only solution clean way out of this is to make
 > a smart replacement for /sbin/ldconfig in LDCONFIG when installing
 > as an user.
 
 Or add support for LD_LIBRARY_PATH in the lib-depends target.  I think
 that is the most standard way of specifying a non-standard library
 search path.
 
 Joe
 
 >=20
 > Edwin
 --=20
 PGP Key : http://www.marcuscom.com/pgp.asc
 
 --=-oiDQa7aG03VYZ2z7siO2
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.4 (FreeBSD)
 
 iD8DBQBAAi5Wb2iPiv4Uz4cRAm+IAJ9LwRRW1hxhst+QowPYV7GZUoGSugCfSQz6
 N/RBSYf3eRiDKjt3LQJPE58=
 =Qa1h
 -----END PGP SIGNATURE-----
 
 --=-oiDQa7aG03VYZ2z7siO2--
 

From: Lev Serebryakov <lev@FreeBSD.org>
To: Edwin Groothuis <edwin@mavetju.org>
Cc: freebsd-gnats-submit@FreeBSD.org, lev@FreeBSD.org
Subject: Re[2]: ports/61133 - When INSTALL_AS_USER is specified, `ldconfig' stage of port installation should be ommited
Date: Mon, 12 Jan 2004 12:14:57 +0300

 Hello, Edwin!
 Monday, January 12, 2004, 5:05:13 AM, you wrote:
 
 EG> I personally think that a call to ldconfig should be made error-safe
 EG> by adding a - to it:
 EG> +.if !defined(INSTALL_AS_USER)
 EG>         @${ECHO_MSG} "===>   Running ldconfig"
 EG>         ${LDCONFIG} -m ${LDCONFIG_RUNLIST}
 EG> +.else
 EG> +       @${ECHO_MSG} "===>   Running ldconfig (errors are ignored)"
 EG> +       -${LDCONFIG} -m ${LDCONFIG_RUNLIST}
 EG> +.endif
 
  We should don't add @unexec/@exec pair to plist too in such case, to
 allow proper deinstallation.
 
 --
                Lev Serebryakov
 
State-Changed-From-To: open->analyzed 
State-Changed-By: marcus 
State-Changed-When: Tue Jan 13 20:20:34 PST 2004 
State-Changed-Why:  
This is currently being tested on bento. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=61133 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Tue Jan 20 11:15:14 PST 2004 
State-Changed-Why:  
A modification by edwin was committed to handle the case where a user may have 
their own ldconfig wrapper. 

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