Репозитории ALT
S: | 1.11.23-alt9 |
5.1: | 1.11.23-alt3.M50P.1 |
4.1: | 1.11.22-alt3 |
4.0: | 1.11.22-alt2 |
+updates: | 1.11.22-alt2 |
3.0: | 1.11.20-alt1 |
Группа :: Разработка/Прочее
Пакет: cvs
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: cvs-1.11.20-owl-alt-tmp.patch
Скачать
Скачать
diff -upk.orig cvs-1.11.20.orig/FAQ cvs-1.11.20/FAQ
--- cvs-1.11.20.orig/FAQ 2005-09-29 20:58:58 +0000
+++ cvs-1.11.20/FAQ 2005-09-29 20:59:12 +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 <head-of-vendor-tree>
- 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 <head-of-vendor-tree> awk '/^I / {print $2}' /tmp/IMP | sed
- 's|^gnu/xyz/||' > /tmp/IG [Edit the IG file to contain just the files
+ cd <head-of-vendor-tree> 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 20:59:12 +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 20:59:12 +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/check_cvs.in cvs-1.11.20/contrib/check_cvs.in
--- cvs-1.11.20.orig/contrib/check_cvs.in 2003-06-20 20:21:37 +0000
+++ cvs-1.11.20/contrib/check_cvs.in 2005-09-29 21:02:37 +0000
@@ -99,7 +99,7 @@ my @ignore_files;
#
# COMMENTS :
# Do not run this script inside the repository. Choose
-# a nice safe spot( like /tmp ) outside of the repository.
+# a nice safe spot outside of the repository.
#
######################################################################
my $directory_to_look_at;
@@ -374,15 +374,21 @@ sub check_revision
$file =~ s/(["\$`\\])/\\$1/g;
my $cwd = getcwd();
- chdir( "/tmp" );
+ my $mkdir_succeeded = mkdir( "tmp", 0700 );
- my $ret_code = 0xffff & system( "cvs co -n -p -r $revision \"$file\" > /dev/null 2>&1" );
+ my $ret_code;
+ if (chdir( "tmp" ))
+ {
+ $ret_code = 0xffff & system( "cvs -l co -n -p -r $revision '$file' > /dev/null 2>&1" );
+ } else {
+ $ret_code = 1;
+ }
- chdir( $cwd );
+ if (chdir( $cwd )) {
+ rmdir( "tmp" ) if ($mkdir_succeeded);
+ }
return( 1 ) if ( $ret_code == 0 );
return( 0 );
-
- return( $ret_code );
}
######################################################################
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 21:06:26 +0000
@@ -36,11 +36,12 @@ fi
tsrcdir=$1
tdstdir=$2
-revfile=/tmp/cvs2vendor_$$_rev
-rm -f $revfile
-
-commentfile=/tmp/cvs2vendor_$$_comment
-rm -f $commentfile
+revfile=
+commentfile=
+trap 'rm -f -- "$revfile" "$commentfile"' EXIT
+trap 'trap - EXIT ; rm -f -- "$revfile" "$commentfile"; exit 1' 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 21:07:58 +0000
@@ -19,7 +19,10 @@
# Contributed by Derek R. Price <derek.price@openavenue.com>
#
-
+dcldir=
+trap 'rm -rf -- "$dcldir"' EXIT
+trap 'trap - EXIT; rm -rf -- "$dcldir"; exit 1' HUP INT QUIT TERM
+dcldir="`mktemp -td dcl.XXXXXXXXXX`" || exit
usage ()
{
@@ -96,13 +99,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 +113,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 +122,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/dclg$$ >/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/pvcs2rcs.in cvs-1.11.20/contrib/pvcs2rcs.in
--- cvs-1.11.20.orig/contrib/pvcs2rcs.in 2004-11-11 22:30:40 +0000
+++ cvs-1.11.20/contrib/pvcs2rcs.in 2005-09-29 21:10:10 +0000
@@ -146,9 +146,6 @@ my %bin_ext =
# The binaries this script is dependant on:
my @bin_dependancies = ("vcs", "vlog", "rcs", "ci");
-# Where we should put temporary files
-my $tmpdir = $ENV{TMPDIR} ? $ENV{TMPDIR} : "/var/tmp";
-
# We use these...
use strict;
@@ -828,7 +825,6 @@ sub execdir
$wtr->print (".\n");
$wtr->close;
# $ci_output = `$ci_command`;
- # $ci_output = `cat $tmpdir/ci.out`;
$first_time = 0 if ($first_time);
} # foreach revision
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 20:58:58 +0000
+++ cvs-1.11.20/contrib/rcs-to-cvs.sh 2005-09-29 21:11:21 +0000
@@ -31,8 +31,11 @@
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=
+message_file=
+trap 'rm -f -- "$message_file"' EXIT
+trap 'trap - EXIT; rm -f -- "$message_file"; exit 1' 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 21:13:19 +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 <eggert@twinsun.com>'
-# 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,11 @@ month_data='
m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
'
-logdir=`$MKTEMP -d $TMPDIR/rcs2log.XXXXXX`
-test -n "$logdir" || exit
+logdir=
+trap 'rm -rf -- "$logdir"' EXIT
+trap 'trap - EXIT; rm -rf -- "$logdir"; exit 1' 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 21:15:11 +0000
@@ -9,20 +9,19 @@ 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=
+trap 'rm -rf -- "$rcs2sccsdir"' EXIT
+trap 'trap - EXIT; rm -rf -- "$rcs2sccsdir"; exit 1' 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 21:16:38 +0000
@@ -84,18 +84,18 @@ 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=
+trap 'rm -rf -- "$sccs2rcsdir"' EXIT
+trap 'trap - EXIT; rm -rf -- "$sccs2rcsdir"; exit 1' 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 20:58:58 +0000
+++ cvs-1.11.20/doc/cvs.texinfo 2005-09-29 20:59:12 +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 20:58:58 +0000
+++ cvs-1.11.20/man/cvsbug.8 2005-09-29 20:59:12 +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 20:58:59 +0000
+++ cvs-1.11.20/src/cvsbug.in 2005-09-29 20:59:12 +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='<precise description of t
HOW_TO_REPEAT_C='<code/input/activities to reproduce the problem (multiple lines)>'
FIX_C='<how to correct or work around the problem, if known (multiple lines)>'
-# Catch some signals. ($xs kludge needed by Sun /bin/sh)
-xs=0
-trap 'rm -f $REF $TEMP; exit $xs' 0
-trap 'echo "$COMMAND: Aborting ..."; rm -f $REF $TEMP; xs=1; exit' 1 2 3 13 15
-
# If they told us to use a specific file, then do so.
if [ -n "$IN_FILE" ]; then
if [ "$IN_FILE" = "-" ]; then
diff -upk.orig cvs-1.11.20.orig/src/filesubr.c cvs-1.11.20/src/filesubr.c
--- cvs-1.11.20.orig/src/filesubr.c 2005-09-29 20:58:58 +0000
+++ cvs-1.11.20/src/filesubr.c 2005-09-29 20:59:12 +0000
@@ -705,7 +705,7 @@ cvs_temp_name ()
if (fp == NULL)
error (1, errno, "Failed to create temporary file");
if (fclose (fp) == EOF)
- error (0, errno, "Failed to close temporary file %s", fn);
+ error (1, errno, "Failed to close temporary file %s", fn);
return fn;
}
@@ -757,9 +757,10 @@ FILE *cvs_temp_file (filename)
{
int fd;
+ int save_errno;
- fn = xmalloc (strlen (Tmpdir) + 11);
- sprintf (fn, "%s/%s", Tmpdir, "cvsXXXXXX" );
+ fn = xmalloc (strlen (Tmpdir) + 12);
+ sprintf (fn, "%s/%s", Tmpdir, "cvs.XXXXXX" );
fd = mkstemp (fn);
/* a NULL return will be interpreted by callers as an error and
@@ -771,24 +772,21 @@ FILE *cvs_temp_file (filename)
/* Attempt to close and unlink the file since mkstemp returned
* sucessfully and we believe it's been created and opened.
*/
- int save_errno = errno;
+ save_errno = errno;
if (close (fd))
- error (0, errno, "Failed to close temporary file %s", fn);
+ error (1, errno, "Failed to close temporary file %s", fn);
if (CVS_UNLINK (fn))
- error (0, errno, "Failed to unlink temporary file %s", fn);
+ error (1, errno, "Failed to unlink temporary file %s", fn);
errno = save_errno;
}
+ save_errno = errno;
if (fp == NULL)
{
free (fn);
fn = NULL;
}
- /* mkstemp is defined to open mode 0600 using glibc 2.0.7+ */
- /* FIXME - configure can probably tell us which version of glibc we are
- * linking to and not chmod for 2.0.7+
- */
- else chmod (fn, 0600);
+ errno = save_errno;
}
diff -upk.orig cvs-1.11.20.orig/src/logmsg.c cvs-1.11.20/src/logmsg.c
--- cvs-1.11.20.orig/src/logmsg.c 2005-09-29 20:58:58 +0000
+++ cvs-1.11.20/src/logmsg.c 2005-09-29 20:59:12 +0000
@@ -214,13 +214,8 @@ do_editor (dir, messagep, repository, ch
if (strcmp (Editor, "") == 0 && !editinfo_editor)
error(1, 0, "no editor defined, must use -e or -m");
- /* Create a temporary file */
- /* FIXME - It's possible we should be relying on cvs_temp_file to open
- * the file here - we get race conditions otherwise.
- */
- fname = cvs_temp_name ();
again:
- if ((fp = CVS_FOPEN (fname, "w+")) == NULL)
+ if ((fp = cvs_temp_file (&fname)) == NULL)
error (1, 0, "cannot create temporary file %s", fname);
if (*messagep)
diff -upk.orig cvs-1.11.20.orig/src/sanity.sh cvs-1.11.20/src/sanity.sh
--- cvs-1.11.20.orig/src/sanity.sh 2005-09-29 20:58:59 +0000
+++ cvs-1.11.20/src/sanity.sh 2005-09-29 20:59:12 +0000
@@ -301,34 +301,7 @@ touch check.log
# causing the test to fail.
[ -n "$DISPLAY" ] && unset DISPLAY
-# The default value of /tmp/cvs-sanity for TESTDIR is dubious,
-# because it loses if two people/scripts try to run the tests
-# at the same time. Some possible solutions:
-# 1. Use /tmp/cvs-test$$. One disadvantage is that the old
-# cvs-test* directories would pile up, because they wouldn't
-# necessarily get removed.
-# 2. Have everyone/everything running the testsuite set
-# TESTDIR to some appropriate directory.
-# 3. Have the default value of TESTDIR be some variation of
-# `pwd`/cvs-sanity. The biggest problem here is that we have
-# been fairly careful to test that CVS prints in messages the
-# actual pathnames that we pass to it, rather than a different
-# pathname for the same directory, as may come out of `pwd`.
-# So this would be lost if everything was `pwd`-based. I suppose
-# if we wanted to get baroque we could start making symlinks
-# to ensure the two are different.
: ${CVS_RSH=rsh}; export CVS_RSH
-if test -n "$remotehost"; then
- # We need to set $tmp on the server since $TMPDIR is compared against
- # messages generated by the server.
- tmp=`$CVS_RSH $remotehost 'cd /tmp; /bin/pwd || pwd' 2>/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