From owner-freebsd-ports Thu Jun 7 10: 0:39 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 35F3737B401 for ; Thu, 7 Jun 2001 10:00:22 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f57H0MZ87953; Thu, 7 Jun 2001 10:00:22 -0700 (PDT) (envelope-from gnats) Date: Thu, 7 Jun 2001 10:00:22 -0700 (PDT) Message-Id: <200106071700.f57H0MZ87953@freefall.freebsd.org> To: freebsd-ports@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: ports/20601: DESTDIR and /etc/shells Reply-To: Peter Pentchev Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR ports/20601; it has been noted by GNATS. From: Peter Pentchev To: lwa@victor.teaser.fr Cc: markp@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org Subject: Re: ports/20601: DESTDIR and /etc/shells Date: Thu, 7 Jun 2001 19:51:36 +0300 On Thu, Jun 07, 2001 at 06:32:14PM +0200, Laurent Wacrenier wrote: > markp@FreeBSD.org wrote: > > Synopsis: DESTDIR and /etc/shells > > > > State-Changed-From-To: open->closed > > State-Changed-By: markp > > State-Changed-When: Thu Jun 7 07:47:11 PDT 2001 > > State-Changed-Why: > > /etc/shells is special, changing ${PREFIX}/etc/shells is invalid. > > > > http://www.FreeBSD.org/cgi/query-pr.cgi?pr=20601 > > I does not understand how special it is to allow wrong informations in > its contents. > > I did not wrote about ${PREFIX} but ${DESTDIR} wich are different > macros with different semantics. DESTDIR is, for example, a chroot > jail or a NFS mounted system. Updating /etc/shell is an Bad Thing in > all case when DESTDIR is defined and is not "/". > > According /usr/share/mk/bsd.README : > > The variable DESTDIR works as before. It's not set anywhere but will change > the tree where the file gets installed. > > According /usr/src/etc/Makefile, /etc/shells is not special > in the FreeBSD source tree : > > BIN1= ... shells ... > > distribution: > ... > ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc; > ... This is a valid complaint. However, the problem lies much deeper - it's not just /etc/shells. Many things in the Ports collection assume that ${DESTDIR} is not set, many things break if ${DESTDIR} is set to something else. For example, a lot of ports pass paths relative to ${PREFIX} as absolute paths to their configure scripts and similar. In case ${DESTDIR} is defined, these paths would be incorrect inside a jail, because they would contain ${DESTDIR} at the start. A very simplistic fix for the case of shells is attached. It's made for the shells/bash2 port, but it could be applied (with a little tweaking) to many other ports of shells. This shall resolve this particular problem, but leave the bigger one - of relative/absolute paths hardcoded in built programs and config files and such - still open. G'luck, Peter -- I am the meaning of this sentence. Index: ports/shells/bash2/Makefile =================================================================== RCS file: /home/ncvs/ports/shells/bash2/Makefile,v retrieving revision 1.49 diff -u -r1.49 Makefile --- ports/shells/bash2/Makefile 2001/04/10 10:47:48 1.49 +++ ports/shells/bash2/Makefile 2001/06/07 16:50:41 @@ -24,9 +24,11 @@ MAN1= bash.1 bashbug.1 post-install: - ${CP} /etc/shells /etc/shells.bak - (${GREP} -v ${PREFIX}/bin/bash /etc/shells.bak; ${ECHO} ${PREFIX}/bin/bash) >/etc/shells - ${RM} /etc/shells.bak + ${MKDIR} ${DESTDIR}/etc + ${TOUCH} ${DESTDIR}/etc/shells + ${CP} ${DESTDIR}/etc/shells ${DESTDIR}/etc/shells.bak + (${GREP} -v ${PREFIX:C,^${DESTDIR},,}/bin/bash ${DESTDIR}/etc/shells.bak; ${ECHO} ${PREFIX:C,^${DESTDIR},,}/bin/bash) >${DESTDIR}/etc/shells + ${RM} ${DESTDIR}/etc/shells.bak .if !defined(NOPORTDOCS) ${MKDIR} ${PREFIX}/share/doc/bash ${INSTALL_MAN} \ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message