Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Dec 2006 19:03:31 GMT
From:      "Steffen M. Boelaars"<boelaars@flatrock.eu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/106613: Installation of misc/ldconfig_compat as non-root on freebsd < 600101 but > 500037 does not respect $PREFIX env var
Message-ID:  <200612111903.kBBJ3VF7061308@www.freebsd.org>
Resent-Message-ID: <200612111910.kBBJA4OJ004899@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         106613
>Category:       ports
>Synopsis:       Installation of misc/ldconfig_compat as non-root on freebsd < 600101 but > 500037 does not respect $PREFIX env var
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 11 19:10:03 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Steffen M. Boelaars
>Release:        6.0-RELEASE
>Organization:
Flat Rock ICT Services
>Environment:
FreeBSD hidden.hidden 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Mon Dec 12 23:29:47 CET 2005 hidden@hidden.hidden:/usr/obj/usr/src/sys/GENERIC i386
>Description:
The Makefile for misc/ldconfig_compat does not respect the $PREFIX env variable when installing this port on freebsd with OSVERSION less than 600101 but greater than 500037, and thus fails to install for non-root users, as shown in the following output:


===== CONSOLE OUTPUT START =====
===>  Installing for ldconfig_compat-1.0_8
===>   Generating temporary packing list
===>  Checking if misc/ldconfig_compat already installed
Warning: not superuser, you may get some errors during installation.
Warning: not superuser, can't run mtree.
You may want to become root and try again to ensure correct permissions.
install: /etc/rc.d/ldconfig_compat: Permission denied
*** Error code 71

Stop in /home/users/whiter/ports/misc/ldconfig_compat.
===== CONSOLE OUTPUT END =====


The error is in the following code in the Makefile:

===== MAKEFILE SNIPPET START =====
do-install:
.if ${OSVERSION} >= 600101
        @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh ${PREFIX}/etc/rc.d/ldconfig_compat
        @${ECHO_CMD} "etc/rc.d/ldconfig_compat" >> ${TMPPLIST}
.elif ${OSVERSION} >= 500037
        @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh /etc/rc.d/ldconfig_compat
        @${ECHO_CMD} "@cwd /" >> ${TMPPLIST}
        @${ECHO_CMD} "etc/rc.d/ldconfig_compat" >> ${TMPPLIST}
.else
        @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh ${PREFIX}/etc/rc.d/000.ldconfig_compat.sh
        @${ECHO_CMD} "etc/rc.d/000.ldconfig_compat.sh" >> ${TMPPLIST}
.endif
===== MAKEFILE SNIPPET START =====

As can be seen, $PREFIX is not used when jumping into the ".elif ${OSVERSION} >= 500037" block, resulting in the crash.
>How-To-Repeat:
Set your env to contain everything as pasted below, and do a make install in the mist/ldconfig_compat ports folder. (For more information read the article on ports as non root on my website at http://www.white-russian.nl/?page=/blog/2006/07/installing_free.html )

# Set the main path to include the apps in our homedir
PATH=${HOME}/apps/bin:${HOME}/apps/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin; export PATH;

# Set the different variables that define where packages are installed
LOCALBASE=${HOME}/apps
X11BASE=${LOCALBASE}
PREFIX=${LOCALBASE}

# Set the paths to the folders the ports mechanism works in:
WRKDIR=${HOME}/tmp
PKG_DBDIR=${LOCALBASE}/var/db/pkg
PORT_DBDIR=${LOCALBASE}/var/db/ports
DISTDIR=${HOME}/distfiles

# Set user and group variables to ourself
BINOWN=`whoami`
BINGRP=`id -G -n ${BINOWN}`
SHAREOWN=${BINOWN}
SHAREGRP=${BINGRP}
MANOWN=${BINOWN}
MANGRP=${BINGRP}

# Make sure we don't really try to become root, but just execute everything as ourselves
SU_CMD="sh -c"

# Make sure that the main ports folder is checked for distfiles first, saving on download time
CD_MOUNTPTS=/usr

# If distfile found in $CD_MOUNTPTS, symlink to it, instead of copy
FETCH_SYMLINK_DISTFILES=YES

# Make sure the systemdefault make.conf is not read
__MAKE_CONF=${LOCALBASE}/etc/make.conf

# Do not try to chown files to root or other users
INSTALL_AS_USER=true

# Keep our own version of ldconfig hints
LDCONFIG="/sbin/ldconfig -i -f ${LOCALBASE}/var/run/ld-elf.so.hints"

# Set application specific variables to make sure it doesn't pick up things from the main system
APXS=${LOCALBASE}/sbin/apxs
PERL=${LOCALBASE}/bin/perl
PERL5=${PERL}
SITE_PERL=${LOCALBASE}/lib/perl5/site_perl/5.8.8
SITE_PERL5=${SITE_PERL}
PERL_VERSION=5.8.8
PERL_VER=${PERL_VERSION}
>Fix:
Apply the following patch:

--- /usr/ports/misc/ldconfig_compat/Makefile    Mon Jun 26 16:38:56 2006
+++ Makefile    Mon Dec 11 19:58:41 2006
@@ -48,7 +48,7 @@
        @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh ${PREFIX}/etc/rc.d/ldconfig_compat
        @${ECHO_CMD} "etc/rc.d/ldconfig_compat" >> ${TMPPLIST}
 .elif ${OSVERSION} >= 500037
-       @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh /etc/rc.d/ldconfig_compat
+       @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh ${PREFIX}/etc/rc.d/ldconfig_compat
        @${ECHO_CMD} "@cwd /" >> ${TMPPLIST}
        @${ECHO_CMD} "etc/rc.d/ldconfig_compat" >> ${TMPPLIST}
 .else

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612111903.kBBJ3VF7061308>