From owner-svn-src-user@FreeBSD.ORG Wed Jun 13 06:19:08 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E7FCE1065672; Wed, 13 Jun 2012 06:19:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D47C98FC12; Wed, 13 Jun 2012 06:19:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D6J8AX000778; Wed, 13 Jun 2012 06:19:08 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D6J8GK000776; Wed, 13 Jun 2012 06:19:08 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206130619.q5D6J8GK000776@svn.freebsd.org> From: Doug Barton Date: Wed, 13 Jun 2012 06:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236996 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 06:19:09 -0000 Author: dougb Date: Wed Jun 13 06:19:08 2012 New Revision: 236996 URL: http://svn.freebsd.org/changeset/base/236996 Log: When calling trap_exit() in a child process we need to signal the parent(s) that we trap'ed so that the various post-run cleanups and updates can still happen properly. In a related change, in safe_exit() remove a shortcut from r214541 that was safe at the time, but isn't any longer because we now have more stuff happening after a run so we still need to update the parent even if the child fail'ed or trap'ed. When we're run by script(1) the parent process is going to be [sh], not $0, so go back to the less efficient but safer method of safeguarding the parent in kill_bad_children(). For -a remove a -v line that is redundant now with the new in-line term_printf() code. In the new in-line printing code for term_printf() use a simpler pattern to match $1 that also catches the following ... In multiport(), update the total number of ports after the first pass to account for ports given on the command line that turn out to be dependencies of other ports given on the command line, and print a summary with the number of parent ports and dependencies prior to the confirmation prompt. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Wed Jun 13 05:47:24 2012 (r236995) +++ user/dougb/portmaster/portmaster Wed Jun 13 06:19:08 2012 (r236996) @@ -73,6 +73,8 @@ trap_exit () { fi if [ "$$" -eq "$PM_PARENT_PID" ]; then + . $IPC_SAVE + local n=0 while ps -axo pid,ppid,command | grep -v egrep | egrep -q "(make -DBATCH checksum|/fetch |\[sh\])"; do @@ -92,6 +94,14 @@ trap_exit () { fi [ -n "$logs" ] && echo '' fi + else + # Signal the parent if a child trap'ed, or read the file if we are + # an intermediate process. + if ! ls ${TMPDIR}/f-${PM_PARENT_PID}-TEAC\.* >/dev/null 2>&1; then + pm_mktemp TEAC # Trap Exit Already Called + else + . $IPC_SAVE + fi fi safe_exit 1 } @@ -109,8 +119,9 @@ kill_bad_children () { *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill -9 $pid ;; esac ;; *) [ $pgid -eq $mypgid ] || continue + [ $pid -eq $PM_PARENT_PID ] && continue case "$command" in - *" $0 "*) [ $pid -ne $PM_PARENT_PID ] && pm_kill $pid ;; + *" $0 "*) pm_kill $pid ;; *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill $pid ;; esac ;; esac @@ -249,8 +260,6 @@ safe_exit () { else [ -n "$grep_deps" ] && pm_unlink $grep_deps - [ -n "$1" ] && exit $1 - # Save state for the parent process to read back in if [ -z "$PM_FIRST_PASS" ]; then > $IPC_SAVE @@ -2223,7 +2232,7 @@ check_fetch_only () { term_printf () { case "$1" in '') [ -n "$PM_MULTI_PORTS" ] && echo -e "\n===>>> ${PM_PARENT_PORT}" ;; - *\>\>*) echo -e "\n===>>> ${PM_PARENT_PORT}${1}" ;; + *\(*) echo -e "\n===>>> ${PM_PARENT_PORT}${1}" ;; esac [ -n "$PM_NO_TERM_TITLE" ] && return @@ -2755,7 +2764,6 @@ multiport () { fi numports=$(( $numports + 1 )) - worklist="$worklist $port" portlist="${portlist}\t${port}\n" PM_MULTI_PORTS="${PM_MULTI_PORTS}${port}:" @@ -2807,6 +2815,8 @@ multiport () { *) numports=$(( $numports - 1 )) ;; esac done + numports=$num + PM_PARENT_PORT="Total parent ports: $numports Total dependencies:" if [ -n "$PM_URB" ]; then unset PM_URB ; PM_URB=pm_urb_post_first_pass @@ -2963,8 +2973,6 @@ all_first_pass () { local iport origin for iport in "$@"; do - pm_v "===>>> $iport" - case "$CUR_DEPS" in *:${iport}:*) continue ;; esac origin=`origin_from_pdb $iport` || {