Date: Mon, 08 Sep 2008 17:19:03 +0200 From: Nick Hibma <nick@anywi.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/127210: chrooted install of a port does not fail when install fails Message-ID: <1220887143.496764.65811.nullmailer@van-laarhoven.org> Resent-Message-ID: <200809081520.m88FK19W015625@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 127210 >Category: ports >Synopsis: chrooted install of a port does not fail when install fails >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 08 15:20:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Nick Hibma >Release: FreeBSD 7.0-STABLE i386 >Organization: AnyWi Technologies >Environment: System: FreeBSD hind.van-laarhoven.org 7.0-STABLE FreeBSD 7.0-STABLE #3: Thu Aug 14 21:10:55 CEST 2008 toor@hind.van-laarhoven.org:/usr/src/sys/i386/compile/HIND i386 >Description: When doing cd /usr/ports/archivers/arj make PREFIX=/path/to/root in an incomplete world, the install fails (of course). But the make mentioned above succeeds. The error code is not passed back. >How-To-Repeat: Create and install a world without a toolchain (using nanobsd for example) that misses gmake, install, strip, or another toolchain necessity. Use cd /usr/ports/archivers/arj make PREFIX=/path/to/root echo errorcode=$? And notice the 0 errorcode. >Fix: The problem is in the following code fragment from bsd.destdir.mk. Notice how it in all cases reaches the exit 0 at the end. The call to chroot should be enclosed in an if statement ${CHROOT} $${_destdir} ${SH} -c "\ cd $${PORTSDIR}${.CURDIR:S|^${PORTSDIR}||}; \ ${SETENV} -i ${DESTDIR_ENV} $${_var_path_list} ${MAKE} ${.TARGETS}" && \ ${ECHO_MSG} "===> Chrooted make in ${DESTDIR} succeeded" || \ ${ECHO_MSG} "===> Chrooted make in ${DESTDIR} failed"; \ ${ECHO_MSG} "===> Cleaning up..."; \ for _entry in $${_mounted_entries_list}; do \ ${UMOUNT} -f $${_entry} || ${TRUE}; \ done; \ for _entry in $${_created_mountpoints_list}; do \ ${RMDIR} $${_entry} || ${TRUE}; \ done; \ exit 0 should be (using an rc variable to return the correct exit value if ${CHROOT} $${_destdir} ${SH} -c "\ cd $${PORTSDIR}${.CURDIR:S|^${PORTSDIR}||}; \ ${SETENV} -i ${DESTDIR_ENV} $${_var_path_list} ${MAKE} ${.TARGETS}"; then \ ${ECHO_MSG} "===> Chrooted make in ${DESTDIR} succeeded" || \ rc=0; \ else; \ ${ECHO_MSG} "===> Chrooted make in ${DESTDIR} failed"; \ rc=$?; \ fi; \ ${ECHO_MSG} "===> Cleaning up..."; \ for _entry in $${_mounted_entries_list}; do \ ${UMOUNT} -f $${_entry} || ${TRUE}; \ done; \ for _entry in $${_created_mountpoints_list}; do \ ${RMDIR} $${_entry} || ${TRUE}; \ done; \ exit $$rc >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1220887143.496764.65811.nullmailer>