[26492] in Source-Commits

home help back first fref pref prev next nref lref last post

Re: /svn/athena r25589 - trunk/debathena/config/reactivate/debian

daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Fri Jun 29 17:57:47 2012

Date: Fri, 29 Jun 2012 17:57:43 -0400 (EDT)
From: Benjamin Kaduk <kaduk@MIT.EDU>
To: Jonathan D Reed <jdreed@MIT.EDU>
cc: source-commits@MIT.EDU
In-Reply-To: <201206291650.q5TGomKl027867@drugstore.mit.edu>
Message-ID: <alpine.GSO.1.10.1206291751460.18441@multics.mit.edu>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1040134744-1341007063=:18441"

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

---559023410-1040134744-1341007063=:18441
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Fri, 29 Jun 2012, Jonathan D Reed wrote:

> Author: jdreed
> Date: 2012-06-29 12:50:48 -0400 (Fri, 29 Jun 2012)
> New Revision: 25589
>
> Added:
>   trunk/debathena/config/reactivate/debian/16killprocs-no-really
> Modified:
>   trunk/debathena/config/reactivate/debian/changelog
>   trunk/debathena/config/reactivate/debian/copyright
>   trunk/debathena/config/reactivate/debian/debathena-reactivate.install
> Log:
> In reactivate:
>  * Update debian/copyright for 3-clause BSD and one GPL'd file
>  * Ship 16killprocs-no-really to end sessions faster (Trac: #775)

I have lost my familiarity with the schroot setup/teardown order, but=20
presume that you have verified that we want 16 and not 14.

>
>
> Added: trunk/debathena/config/reactivate/debian/16killprocs-no-really
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- trunk/debathena/config/reactivate/debian/16killprocs-no-really=09    =
                    (rev 0)
> +++ trunk/debathena/config/reactivate/debian/16killprocs-no-really=092012=
-06-29 16:50:48 UTC (rev 25589)
> @@ -0,0 +1,102 @@
> +#!/bin/sh
> +#
> +# A slightly faster way of ending processes in a chroot.
> +# Copyright (c) 2012 Massachusetts Institute of Technology
> +#
> +# This is a derivative work of, and licensed under the same terms as,
> +# 15killprocs from the schroot (1.4.17-1) package, whose license
> +# information appears below:
> +#
> +# Copyright =C2=A9 2007       Kees Cook <kees@outflux.net>
> +# Copyright =C2=A9 2007-2009  Roger Leigh <rleigh@debian.org>
> +#
> +# schroot is free software: you can redistribute it and/or modify it
> +# under the terms of the GNU General Public License as published by
> +# the Free Software Foundation, either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# schroot is distributed in the hope that it will be useful, but
> +# WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see
> +# <http://www.gnu.org/licenses/>.
> +#
> +#####################################################################
> +
> +set -e
> +
> +. "$SETUP_DATA_DIR/common-data"
> +. "$SETUP_DATA_DIR/common-functions"
> +
> +if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
> +    . "$CHROOT_SCRIPT_CONFIG"
> +elif [ "$STATUS" =3D "ok" ]; then
> +    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
> +fi
> +
> +# Wrapper around kill command. Turns errors into
> +# warnings when running in verbose mode, otherwise
> +# it ignores them.
> +# args: parameters for kill
> +kill_proc()
> +{
> +    if ! kill "$@" 2>/dev/null; then
> +        info "kill $@ failed: process already terminated?"
> +    fi
> +}
> +
> +# Kill all processes that were run from within the chroot environment
> +# $1: mount base location
> +do_kill_all()
> +{
> +    if [ -z "$1" ]; then
> +=09fatal "No path for finding stray processes: not reaping processes in =
chroot"
> +    fi
> +
> +    info "Killing processes run inside $1"
> +    # Don't use a pipe into a read loop, just use a normal for loop
> +    pids=3D
> +    for pid in $(ls /proc | egrep '^[[:digit:]]+$'); do
> +=09# Check if process root are the same device/inode as chroot
> +=09# root (for efficiency)
> +        if [ /proc/"$pid"/root -ef "$1" ]; then
> +=09    # Check if process and chroot root are the same (may be
> +=09    # different even if device/inode match).
> +=09    root=3D$(readlink /proc/"$pid"/root || true)
> +=09    if [ "$root" =3D "$1" ]; then
> +=09=09exe=3D$(readlink /proc/"$pid"/exe || true)
> +=09=09info "Killing left-over pid $pid (${exe##$1})"
> +=09=09info "  Sending SIGTERM to pid $pid"
> +
> +=09=09kill_proc -TERM "$pid"
> +=09=09# Save the pid
> +=09=09pids=3D"$pids $pid"
> +=09    fi
> +=09fi
> +    done
> +    # Wait one second, as most things will respond to TERM gracefully
> +    sleep 1
> +    for pid in $pids; do
> +=09count=3D0
> +=09max=3D5
> +=09while [ -d /proc/"$pid" ]; do

The kernel programmer in me would want to repeat the same-root checks=20
here, for paranoia's sake.

But that may be excessive, here.
-Ben

> +            count=3D$(( $count + 1 ))
> +            info "  Waiting for pid $pid to shut down... ($count/$max)"
> +            sleep 1
> +            # Wait for $max seconds for process to die before -9'ing it
> +            if [ "$count" -eq "$max" ]; then
> +=09=09info "  Sending SIGKILL to pid $pid"
> +=09=09kill_proc -KILL "$pid"
> +=09=09sleep 1
> +=09=09break
> +            fi
> +=09done
> +    done
> +}
> +
> +if [ $STAGE =3D "setup-recover" ] || [ $STAGE =3D "setup-stop" ]; then
> +    do_kill_all "$CHROOT_MOUNT_LOCATION"
> +fi
>
>
> Property changes on: trunk/debathena/config/reactivate/debian/16killprocs=
-no-really
> ___________________________________________________________________
> Added: svn:executable
>   + *
>
> Modified: trunk/debathena/config/reactivate/debian/changelog
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- trunk/debathena/config/reactivate/debian/changelog=092012-06-28 22:59=
:17 UTC (rev 25588)
> +++ trunk/debathena/config/reactivate/debian/changelog=092012-06-29 16:50=
:48 UTC (rev 25589)
> @@ -1,3 +1,10 @@
> +debathena-reactivate (2.0.35) unstable; urgency=3Dlow
> +
> +  * Update debian/copyright for 3-clause BSD and one GPL'd file
> +  * Ship 16killprocs-no-really to end sessions faster (Trac: #775)
> +
> + -- Jonathan Reed <jdreed@mit.edu>  Fri, 29 Jun 2012 12:48:18 -0400
> +
> debathena-reactivate (2.0.34) unstable; urgency=3Dlow
>
>   * dbus-daemon-launch-helper moved in precise
>
> Modified: trunk/debathena/config/reactivate/debian/copyright
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- trunk/debathena/config/reactivate/debian/copyright=092012-06-28 22:59=
:17 UTC (rev 25588)
> +++ trunk/debathena/config/reactivate/debian/copyright=092012-06-29 16:50=
:48 UTC (rev 25589)
> @@ -1,18 +1,36 @@
> -The Athena source code was obtained from the Athena SVN repository at
> -<svn://debathena.mit.edu/athena/trunk>, and is licensed as follows:
> +This package and its Debian packaging are licensed as follows, with
> +the one caveat noted below.
>
> -  Copyright =C2=A9 2008 by the Massachusetts Institute of Technology.
> +Copyright =C2=A9 2008-2012 by the Massachusetts Institute of Technology.
> +All rights reserved.
>
> -  Permission to use, copy, modify, and distribute this software and
> -  its documentation for any purpose and without fee is hereby granted,
> -  provided that the above copyright notice appear in all copies and
> -  that both that copyright notice and this permission notice appear in
> -  supporting documentation, and that the name of M.I.T. not be used in
> -  advertising or publicity pertaining to distribution of the software
> -  without specific, written prior permission.  M.I.T. makes no
> -  representations about the suitability of this software for any
> -  purpose.  It is provided "as is" without express or implied
> -  warranty.
> +Redistribution and use in source and binary forms, with or without
> +modification, are permitted provided that the following conditions are
> +met:
> +    * Redistributions of source code must retain the above copyright
> +      notice, this list of conditions and the following disclaimer.
> +    * Redistributions in binary form must reproduce the above
> +      copyright notice, this list of conditions and the following
> +      disclaimer in the documentation and/or other materials provided
> +      with the distribution.
> +    * Neither the name of the Massachusetts Institute of Technology
> +      nor the names of its contributors may be used to endorse or
> +      promote products derived from this software without specific
> +      prior written permission.
>
> -The Debian packaging is Copyright =C2=A9 2008 Massachusetts Institute of
> -Technology, and has the same license as the original software.
> +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MASSACHUSETTS
> +INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT,
> +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
> +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
> +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> +DAMAGE.
> +
> +Caveat: The file "16killprocs-no-really" has additonal copyright
> +holders and is licensed under the GPLv3.  See that file for complete
> +copyright and license information.
>
> Modified: trunk/debathena/config/reactivate/debian/debathena-reactivate.i=
nstall
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- trunk/debathena/config/reactivate/debian/debathena-reactivate.install=
=092012-06-28 22:59:17 UTC (rev 25588)
> +++ trunk/debathena/config/reactivate/debian/debathena-reactivate.install=
=092012-06-29 16:50:48 UTC (rev 25589)
> @@ -15,3 +15,4 @@
> debian/reactivate usr/lib/debathena-reactivate
> debian/dbus-daemon-launch-helper lib/debathena-reactivate
> debian/90debathena-reactivate etc/schroot/setup.d
> +debian/16killprocs-no-really etc/schroot/setup.d
>
>
---559023410-1040134744-1341007063=:18441--

home help back first fref pref prev next nref lref last post