diff -upk.orig cvs-1.11.20.orig/FAQ cvs-1.11.20/FAQ --- cvs-1.11.20.orig/FAQ 2005-09-29 12:52:06 +0000 +++ cvs-1.11.20/FAQ 2005-09-29 12:52:41 +0000 @@ -1546,7 +1546,8 @@ You can branch a branch. After running "make" you might try running the "sanity.sh" script: ./src/sanity.sh `pwd`/src/cvs - It writes into /tmp/cvs-sanity by default. + By default, it writes into a temporary directory it creates under + $TMPDIR or under /tmp if $TMPDIR is not set. Finish reading the INSTALL file and test out the system. @@ -4933,30 +4934,30 @@ kingdon@cyclic.com than the recovery step described below. Let's assume your original import procedure was: (We assume there is - enough disk space in /tmp.) + enough disk space in ~/tmp.) cd - cvs import -m 'xyz 1.3' gnu/xyz GNU GNUXYZ_1_3 | tee /tmp/IMP + cvs import -m 'xyz 1.3' gnu/xyz GNU GNUXYZ_1_3 | tee ~/tmp/IMP To import just the files ignored by "import", I would do this: Create a list of the ignored files to import: - cd awk '/^I / {print $2}' /tmp/IMP | sed - 's|^gnu/xyz/||' > /tmp/IG [Edit the IG file to contain just the files + cd awk '/^I / {print $2}' ~/tmp/IMP | sed + 's|^gnu/xyz/||' > ~/tmp/IG [Edit the IG file to contain just the files you want.] Then create a sparse directory by handing your list to the GNU version of "tar", installed in many places as "gtar": - mkdir /tmp/FIXUP gtar -T /tmp/IG -c -f - . | (cd /tmp/FIXUP; gtar xvBf + mkdir ~/tmp/FIXUP gtar -T ~/tmp/IG -c -f - . | (cd ~/tmp/FIXUP; gtar xvBf -) Then rerun the import. Use the exact same command, but execute it in the sparse directory tree you just created. And this time, tell it not to ignore anything. - cd /tmp/FIXUP + cd ~/tmp/FIXUP cvs import -I ! -m 'xyz 1.3' gnu/xyz GNU GNUXYZ_1_3 Last modified: _6/13/1997_ diff -upk.orig cvs-1.11.20.orig/TESTS cvs-1.11.20/TESTS --- cvs-1.11.20.orig/TESTS 2004-11-11 22:30:36 +0000 +++ cvs-1.11.20/TESTS 2005-09-29 12:52:41 +0000 @@ -13,10 +13,10 @@ Also note that you must be logged in as WARNING: This test can take quite a while to run, esp. if your disks are slow or over-loaded. -The tests work in /tmp/cvs-sanity (which the tests create) by default. -If for some reason you want them to work in a different directory, you -can set the TESTDIR environment variable to the desired location -before running them. +By default, the tests create and use a temporary directory under +$TMPDIR or under /tmp if $TMPDIR is not set. If for some reason you +want them to work in a different directory, you can set the TESTDIR +environment variable to the desired location before running them. The tests use a number of tools (awk, expr, id, tr, etc.) that are not required for running CVS itself. In most cases, the standard vendor- diff -upk.orig cvs-1.11.20.orig/TODO cvs-1.11.20/TODO --- cvs-1.11.20.orig/TODO 2004-11-11 22:30:36 +0000 +++ cvs-1.11.20/TODO 2005-09-29 12:52:41 +0000 @@ -665,27 +665,27 @@ space than it could, typically. working directory is not a CVS-controlled directory with the correct CVSROOT. For example, the following will fail: - cd /tmp + cd ~/tmp cvs -d /repos co foo cd / - cvs update /tmp/foo + cvs update ~/tmp/foo It is possible to read the CVSROOT from the administrative files in the directory specified by the absolute pathname argument to update. In that case, the last command above would be equivalent to: - cd /tmp/foo + cd ~/tmp/foo cvs update . This can be problematic, however, if we ask CVS to update two directories with different CVSROOTs. Currently, CVS has no way of changing CVSROOT mid-stream. Consider the following: - cd /tmp + cd ~/tmp cvs -d /repos1 co foo cvs -d /repos2 co bar cd / - cvs update /tmp/foo /tmp/bar + cvs update ~/tmp/foo ~/tmp/bar To make that example work, we need to think hard about: diff -upk.orig cvs-1.11.20.orig/contrib/cvs2vendor.sh cvs-1.11.20/contrib/cvs2vendor.sh --- cvs-1.11.20.orig/contrib/cvs2vendor.sh 2004-11-11 22:30:40 +0000 +++ cvs-1.11.20/contrib/cvs2vendor.sh 2005-09-29 12:52:40 +0000 @@ -36,11 +36,18 @@ fi tsrcdir=$1 tdstdir=$2 -revfile=/tmp/cvs2vendor_$$_rev -rm -f $revfile - -commentfile=/tmp/cvs2vendor_$$_comment -rm -f $commentfile +revfile= +commentfile= +exit_handler() +{ + local rc=$? + trap - EXIT + rm -f -- "$revfile" "$commentfile" + exit $rc +} +trap exit_handler EXIT HUP INT QUIT TERM +revfile="`mktemp -t cvs2vendor.rev.XXXXXXXXXX`" || exit +commentfile="`mktemp -t cvs2vendor.comment.XXXXXXXXXX`" || exit if sort -k 1,1 /dev/null 2>/dev/null then sort_each_field='-k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9' diff -upk.orig cvs-1.11.20.orig/contrib/debug_check_log.sh cvs-1.11.20/contrib/debug_check_log.sh --- cvs-1.11.20.orig/contrib/debug_check_log.sh 2003-01-31 20:15:07 +0000 +++ cvs-1.11.20/contrib/debug_check_log.sh 2005-09-29 12:52:41 +0000 @@ -19,8 +19,16 @@ # Contributed by Derek R. Price # - - +dcldir= +exit_handler() +{ + local rc=$? + trap - EXIT + rm -rf -- "$dcldir" + exit $rc +} +trap exit_handler EXIT HUP PIPE INT QUIT TERM +dcldir="`mktemp -td dcl.XXXXXXXXXX`" || exit usage () { echo "\ @@ -96,13 +104,13 @@ process_check_log () # file contains a second regex if test $dcl_dofirst -eq 1; then # get the first pattern - sed -ne '/^\*\* expected: $/,/^\*\* or: $/p' <$1 >/tmp/dcle$$ - dcl_exprfiles="$dcl_exprfiles /tmp/dcle$$" + sed -ne '/^\*\* expected: $/,/^\*\* or: $/p' <$1 >$dcldir/e + dcl_exprfiles="$dcl_exprfiles $dcldir/e" fi if test $dcl_doalternate -eq 1; then # get the alternate pattern - sed -ne '/^\*\* or: $/,/^\*\* got: $/p' <$1 >/tmp/dclo$$ - dcl_exprfiles="$dcl_exprfiles /tmp/dclo$$" + sed -ne '/^\*\* or: $/,/^\*\* got: $/p' <$1 >$dcldir/o + dcl_exprfiles="$dcl_exprfiles $dcldir/o" else echo "WARNING: Ignoring alternate pattern in file: $1" >&2 fi @@ -110,8 +118,8 @@ process_check_log () # file doesn't contain a second regex if test $dcl_dofirst = 1; then # get the only pattern - sed -ne '/^\*\* expected: $/,/^\*\* got: $/p' <$1 >/tmp/dcle$$ - dcl_exprfiles="$dcl_exprfiles /tmp/dcle$$" + sed -ne '/^\*\* expected: $/,/^\*\* got: $/p' <$1 >$dcldir/e + dcl_exprfiles="$dcl_exprfiles $dcldir/e" fi if test $dcl_doalternate -eq 1; then echo "WARNING: No alternate pattern in file: $1" >&2 @@ -119,34 +127,34 @@ process_check_log () fi # and get the actual output - sed -ne '/^\*\* got: $/,$p' <$1 >/tmp/dclg$$ + sed -ne '/^\*\* got: $/,$p' <$1 >$dcldir/g sed -ne '1D $D -p' /tmp/dclh$$ - mv /tmp/dclh$$ /tmp/dclg$$ +p' <$dcldir/g >$dcldir/h + mv $dcldir/h $dcldir/g # compare the output against each pattern requested for dcl_f in $dcl_exprfiles; do sed -ne '1D $D -p' <$dcl_f >/tmp/dclp$$ - mv /tmp/dclp$$ $dcl_f +p' <$dcl_f >$dcldir/p + mv $dcldir/p $dcl_f case $dcl_f in - /tmp/dcle*) + $dcldir/e) echo "********** $1 : Primary **********" ;; - /tmp/dclo*) + $dcldir/o) echo "********** $1 : Alternate **********" ;; esac - expr_line_by_line /tmp/dclg$$ $dcl_f + expr_line_by_line $dcldir/g $dcl_f rm $dcl_f done - rm /tmp/dclg$$ + rm $dcldir/g } ### diff -upk.orig cvs-1.11.20.orig/contrib/rcs-to-cvs.sh cvs-1.11.20/contrib/rcs-to-cvs.sh --- cvs-1.11.20.orig/contrib/rcs-to-cvs.sh 2005-09-29 12:52:06 +0000 +++ cvs-1.11.20/contrib/rcs-to-cvs.sh 2005-09-29 12:52:41 +0000 @@ -32,7 +32,16 @@ usage="Usage: rcs-to-cvs [-v] [-m message] [-f message_file] repository" vbose=0 message="" -if [ -d /var/tmp ]; then message_file=/var/tmp/checkin.$$; else message_file=/usr/tmp/checkin.$$; fi +message_file= +exit_handler() +{ + local rc=$? + trap - EXIT + rm -f -- "$message_file" + exit $rc +} +trap exit_handler EXIT HUP INT QUIT TERM +message_file="`mktemp -t checkin.XXXXXXXXXX`" || exit got_one=0 if [ $# -lt 1 ]; then diff -upk.orig cvs-1.11.20.orig/contrib/rcs2log.sh cvs-1.11.20/contrib/rcs2log.sh --- cvs-1.11.20.orig/contrib/rcs2log.sh 2004-11-11 22:30:40 +0000 +++ cvs-1.11.20/contrib/rcs2log.sh 2005-09-29 12:52:41 +0000 @@ -56,9 +56,6 @@ under the terms of the GNU General Publi For more information about these matters, see the files named COPYING. Author: Paul Eggert ' -# functions -@MKTEMP_SH_FUNCTION@ - # Use the traditional C locale. LANG=C LANGUAGE=C @@ -82,9 +79,7 @@ nl=' # Parse options. # defaults -: ${MKTEMP="@MKTEMP@"} : ${AWK=awk} -: ${TMPDIR=/tmp} changelog=ChangeLog # change log file name datearg= # rlog date option @@ -187,11 +182,17 @@ month_data=' m[9]="Oct"; m[10]="Nov"; m[11]="Dec" ' -logdir=`$MKTEMP -d $TMPDIR/rcs2log.XXXXXX` -test -n "$logdir" || exit +logdir= +exit_handler() +{ + local rc=$? + trap - EXIT + rm -rf -- "$logdir" + exit $rc +} +trap exit_handler EXIT HUP INT QUIT TERM +logdir="`mktemp -td rcs2log.XXXXXXXXXX`" || exit llogout=$logdir/l -trap exit 1 2 13 15 -trap "rm -fr $logdir 2>/dev/null" 0 # If no rlog-format log file is given, generate one into $rlogfile. case $rlogfile in diff -upk.orig cvs-1.11.20.orig/contrib/rcs2sccs.sh cvs-1.11.20/contrib/rcs2sccs.sh --- cvs-1.11.20.orig/contrib/rcs2sccs.sh 2004-11-11 22:30:40 +0000 +++ cvs-1.11.20/contrib/rcs2sccs.sh 2005-09-29 12:52:41 +0000 @@ -9,20 +9,25 @@ if [ ! -d SCCS ] ; then mkdir SCCS fi -logfile=/tmp/rcs2sccs_$$_log -rm -f $logfile -tmpfile=/tmp/rcs2sccs_$$_tmp -rm -f $tmpfile -emptyfile=/tmp/rcs2sccs_$$_empty -echo -n "" > $emptyfile -initialfile=/tmp/rcs2sccs_$$_init +rcs2sccsdir= +exit_handler() +{ + local rc=$? + trap - EXIT + rm -rf -- "$rcs2sccsdir" + exit $rc +} +trap exit_handler EXIT HUP INT QUIT TERM +rcs2sccsdir="`mktemp -td rcs2sccs.XXXXXXXXXX`" || exit +logfile="$rcs2sccsdir/log" +tmpfile="$rcs2sccsdir/tmp" +emptyfile="$rcs2sccsdir/empty" +> $emptyfile +initialfile="$rcs2sccsdir/init" echo "Initial revision" > $initialfile -sedfile=/tmp/rcs2sccs_$$_sed -rm -f $sedfile -revfile=/tmp/rcs2sccs_$$_rev -rm -f $revfile -commentfile=/tmp/rcs2sccs_$$_comment -rm -f $commentfile +sedfile="$rcs2sccsdir/sed" +revfile="$rcs2sccsdir/rev" +commentfile="$rcs2sccsdir/comment" # create the sed script cat > $sedfile << EOF diff -upk.orig cvs-1.11.20.orig/contrib/sccs2rcs.in cvs-1.11.20/contrib/sccs2rcs.in --- cvs-1.11.20.orig/contrib/sccs2rcs.in 2004-11-11 22:30:40 +0000 +++ cvs-1.11.20/contrib/sccs2rcs.in 2005-09-29 12:52:41 +0000 @@ -84,18 +84,24 @@ endif sccs clean -set logfile = /tmp/sccs2rcs_$$_log -rm -f $logfile -set tmpfile = /tmp/sccs2rcs_$$_tmp -rm -f $tmpfile -set emptyfile = /tmp/sccs2rcs_$$_empty -echo -n "" > $emptyfile -set initialfile = /tmp/sccs2rcs_$$_init +sccs2rcsdir= +exit_handler() +{ + local rc=$? + trap - EXIT + rm -rf -- "$sccs2rcsdir" + exit $rc +} +trap exit_handler EXIT HUP INT QUIT TERM +sccs2rcsdir="`mktemp -td sccs2rcs.XXXXXXXXXX`" || exit +logfile="$sccs2rcsdir/log" +tmpfile="$sccs2rcsdir/tmp" +emptyfile="$sccs2rcsdir/empty" +: > $emptyfile +set initialfile = "$sccs2rcsdir/init" echo "Initial revision" > $initialfile -set sedfile = /tmp/sccs2rcs_$$_sed -rm -f $sedfile -set revfile = /tmp/sccs2rcs_$$_rev -rm -f $revfile +sedfile="$sccs2rcsdir/sed" +revfile="$sccs2rcsdir/rev" # the quotes surround the dollar signs to fool RCS when I check in this script set sccs_keywords = (\ diff -upk.orig cvs-1.11.20.orig/doc/cvs.texinfo cvs-1.11.20/doc/cvs.texinfo --- cvs-1.11.20.orig/doc/cvs.texinfo 2005-09-29 12:52:06 +0000 +++ cvs-1.11.20/doc/cvs.texinfo 2005-09-29 12:52:41 +0000 @@ -12344,8 +12344,8 @@ cvs import -I ! -W "*.exe -k 'b'" first- @c :::::::::::::::::: @c : @c [ -f $1 ] || exit 1 -@c zcat $1 > /tmp/.#$1.$$ -@c mv /tmp/.#$1.$$ $1 +@c zcat $1 > $1.gunzipcp.$$ +@c mv $1.gunzipcp.$$ $1 @c @c :::::::::::::::::: @c gzipcp @@ -13705,8 +13705,6 @@ Directory in which temporary files are l The @sc{cvs} server uses @code{TMPDIR}. @xref{Global options}, for a description of how to specify this. -Some parts of @sc{cvs} will always use @file{/tmp} (via -the @code{tmpnam} function provided by the system). On Windows NT, @code{TMP} is used (via the @code{_tempnam} function provided by the system). @@ -13906,7 +13904,7 @@ more subtle cause, which is that the tem directory on the server is set to a subdirectory of the root (which is also not allowed). If this is the problem, set the temporary directory to somewhere else, -for example @file{/var/tmp}; see @code{TMPDIR} in +for example @file{$HOME/tmp}; see @code{TMPDIR} in @ref{Environment variables}, for how to set the temporary directory. diff -upk.orig cvs-1.11.20.orig/man/cvsbug.8 cvs-1.11.20/man/cvsbug.8 --- cvs-1.11.20.orig/man/cvsbug.8 2005-09-29 12:52:06 +0000 +++ cvs-1.11.20/man/cvsbug.8 2005-09-29 12:52:41 +0000 @@ -201,12 +201,11 @@ Submit small code samples with the PR. instructions on submitting larger test cases and problematic source code. .SH FILES -.ta \w'/tmp/pbad$$ 'u -/tmp/p$$ copy of PR used in editing session +$TMPDIR/p.XXXXXXXXXX copy of PR used in editing session .br -/tmp/pf$$ copy of empty PR form, for testing purposes +$TMPDIR/pf.XXXXXXXXXX copy of empty PR form, for testing purposes .br -/tmp/pbad$$ file for rejected PRs +$TMPDIR/pbad.XXXXXXXXXX file for rejected PRs .SH INSTALLATION AND CONFIGURATION See .B INSTALL diff -upk.orig cvs-1.11.20.orig/src/cvsbug.in cvs-1.11.20/src/cvsbug.in --- cvs-1.11.20.orig/src/cvsbug.in 2005-09-29 12:52:06 +0000 +++ cvs-1.11.20/src/cvsbug.in 2005-09-29 12:52:41 +0000 @@ -48,10 +48,6 @@ DEFAULT_ORGANIZATION="net" ## # Newer config information? ## [ -f ${GNATS_ROOT}/gnats-adm/config ] && . ${GNATS_ROOT}/gnats-adm/config -# Hack mktemp on systems that don't have it. -@MKTEMP_SH_FUNCTION@ -MKTEMP="@MKTEMP@" - # What mailer to use. This must come after the config file, since it is # host-dependent. SENDMAIL="@SENDMAIL@" @@ -84,11 +80,18 @@ fi # -[ -z "$TMPDIR" ] && TMPDIR=/tmp +# $xs kludge apparently needed by Sun /bin/sh (and is relied upon by the +# rest of this script, on all platforms). +xs=0 -TEMP="`$MKTEMP $TMPDIR/p.XXXXXX`" -BAD="`$MKTEMP $TMPDIR/pbad.XXXXXX`" -REF="`$MKTEMP $TMPDIR/pf.XXXXXX`" +TEMP= +BAD= +REF= +trap 'rm -f -- "$TEMP" "$BAD" "$REF"; exit $xs' EXIT +trap 'trap - EXIT; rm -f -- "$TEMP" "$BAD" "$REF"; exit 1' HUP INT QUIT TERM +TEMP="`mktemp -t cvsbug.p.XXXXXXXXXX`" || exit +BAD="`mktemp -t cvsbug.pbad.XXXXXXXXXX`" || exit +REF="`mktemp -t cvsbug.pf.XXXXXXXXXX`" || exit if [ -z "$LOGNAME" -a -n "$USER" ]; then LOGNAME=$USER @@ -110,14 +113,12 @@ elif [ -f /bin/domainname ]; then "$YPCAT" passwd 2>/dev/null | cat - /etc/passwd | grep "^$LOGNAME:" | cut -f5 -d':' | sed -e 's/,.*//' > $TEMP ORIGINATOR="`cat $TEMP`" - rm -f $TEMP fi fi if [ "$ORIGINATOR" = "" ]; then grep "^$LOGNAME:" /etc/passwd | cut -f5 -d':' | sed -e 's/,.*//' > $TEMP ORIGINATOR="`cat $TEMP`" - rm -f $TEMP fi if [ -n "$ORGANIZATION" ]; then @@ -266,11 +267,6 @@ DESCRIPTION_C='/dev/null` - if test $? != 0; then - echo "$CVS_RSH $remotehost failed." >&2 - exit 1 - fi -else - tmp=`(cd /tmp; /bin/pwd || pwd) 2>/dev/null` -fi # Now: # 1) Set TESTDIR if it's not set already @@ -336,18 +309,32 @@ fi # 3) Create $TESTDIR # 4) Normalize TESTDIR with `cd && (/bin/pwd || pwd)` # (This will match CVS output later) -: ${TESTDIR=$tmp/cvs-sanity} +if [ -n "$TESTDIR" ]; then # clean any old remnants (we need the chmod because some tests make # directories read-only) -if test -d ${TESTDIR}; then + if test -d ${TESTDIR}; then chmod -R a+wx ${TESTDIR} rm -rf ${TESTDIR} -fi + fi # These exits are important. The first time I tried this, if the `mkdir && cd` # failed then the build directory would get blown away. Some people probably # wouldn't appreciate that. -mkdir ${TESTDIR} || exit 1 + mkdir ${TESTDIR} || exit 1 +fi +if ! $keep; then + trap 'cd "$TESTDIR/.." && rm -rf -- "$TESTDIR"' EXIT + trap 'trap - EXIT; cd "$TESTDIR/.." && rm -rf -- "$TESTDIR"; exit 1' HUP INT QUIT TERM +fi +if [ -z "$TESTDIR" ]; then + TESTDIR="`mktemp -td cvs-sanity.XXXXXXXXXX`" || exit +fi cd ${TESTDIR} || exit 1 +touch $TESTDIR/cvs-sanity-testdir +TESTDIR=`(/bin/pwd || pwd) 2>/dev/null` +if ! test -e $TESTDIR/cvs-sanity-testdir; then + echo "Unable to expand any possible symlinks in TESTDIR." >&2 + exit 1 +fi # Ensure $TESTDIR is absolute if echo "${TESTDIR}" |grep '^[^/]'; then # Don't resolve this unless we have to. This keeps symlinks intact. This @@ -361,7 +348,6 @@ if test -z "${TESTDIR}" || echo "${TESTD echo "Unable to resolve TESTDIR to an absolute directory." >&2 exit 1 fi -cd ${TESTDIR} # Now set $TMPDIR if the user hasn't overridden it. # @@ -29076,8 +29062,4 @@ if $keep; then exit 0 fi -# Remove the test directory, but first change out of it. -cd `dirname ${TESTDIR}` -rm -rf ${TESTDIR} - # end of sanity.sh