File cvs-tmp-races.diff of Package cvs-stable
diff -ru cvs-1.11.23-orig/configure cvs-1.11.23/configure
--- cvs-1.11.23-orig/configure 2008-05-07 22:12:30.000000000 +0200
+++ cvs-1.11.23/configure 2008-05-12 01:54:18.000000000 +0200
@@ -9232,31 +9232,6 @@
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_sys_long_file_names=yes
-# Test for long file names in all the places we know might matter:
-# . the current directory, where building will happen
-# $prefix/lib where we will be installing things
-# $exec_prefix/lib likewise
-# $TMPDIR if set, where it might want to write temporary files
-# /tmp where it might want to write temporary files
-# /var/tmp likewise
-# /usr/tmp likewise
-for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib"; do
- # Skip $TMPDIR if it is empty or bogus, and skip $exec_prefix/lib
- # in the usual case where exec_prefix is '${prefix}'.
- case $ac_dir in #(
- . | /* | ?:[\\/]*) ;; #(
- *) continue;;
- esac
- test -w "$ac_dir/." || continue # It is less confusing to not echo anything here.
- ac_xdir=$ac_dir/cf$$
- (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue
- ac_tf1=$ac_xdir/conftest9012345
- ac_tf2=$ac_xdir/conftest9012346
- touch "$ac_tf1" 2>/dev/null && test -f "$ac_tf1" && test ! -f "$ac_tf2" ||
- ac_cv_sys_long_file_names=no
- rm -f -r "$ac_xdir" 2>/dev/null
- test $ac_cv_sys_long_file_names = no && break
-done
fi
{ echo "$as_me:$LINENO: result: $ac_cv_sys_long_file_names" >&5
echo "${ECHO_T}$ac_cv_sys_long_file_names" >&6; }
@@ -12317,17 +12292,7 @@
{ echo "$as_me:$LINENO: checking for temporary directory" >&5
echo $ECHO_N "checking for temporary directory... $ECHO_C" >&6; }
if test -z "$with_tmpdir" || test yes = "$with_tmpdir"; then
- for with_tmpdir in /tmp /var/tmp no; do
- if test -d "$with_tmpdir" && test -x "$with_tmpdir" \
- && test -w "$with_tmpdir" && test -r "$with_tmpdir"; then
- break
- fi
- done
- if test no = "$with_tmpdir"; then
- { echo "$as_me:$LINENO: WARNING: Failed to find usable temporary directory. Using '/tmp'." >&5
-echo "$as_me: WARNING: Failed to find usable temporary directory. Using '/tmp'." >&2;}
- with_tmpdir=/tmp
- fi
+ with_tmpdir=/tmp
{ echo "$as_me:$LINENO: result: $with_tmpdir" >&5
echo "${ECHO_T}$with_tmpdir" >&6; }
elif ! echo "$with_tmpdir" |grep '^[\\/]'; then
Only in cvs-1.11.23: configure~
diff -ru cvs-1.11.23-orig/contrib/check_cvs.in cvs-1.11.23/contrib/check_cvs.in
--- cvs-1.11.23-orig/contrib/check_cvs.in 2003-06-20 22:21:37.000000000 +0200
+++ cvs-1.11.23/contrib/check_cvs.in 2008-05-12 01:50:54.000000000 +0200
@@ -99,7 +99,7 @@
#
# 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,20 @@
$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" );
+ if (chdir( "tmp" ))
+ {
+ $ret_code = 0xffff & system( "cvs 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 );
}
######################################################################
Only in cvs-1.11.23/contrib: check_cvs.in~
diff -ru cvs-1.11.23-orig/contrib/cvs2vendor.sh cvs-1.11.23/contrib/cvs2vendor.sh
--- cvs-1.11.23-orig/contrib/cvs2vendor.sh 2005-07-12 15:53:55.000000000 +0200
+++ cvs-1.11.23/contrib/cvs2vendor.sh 2008-05-12 01:48:33.000000000 +0200
@@ -48,11 +48,12 @@
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'
Only in cvs-1.11.23/contrib: cvs2vendor.sh~
diff -ru cvs-1.11.23-orig/contrib/debug_check_log.sh cvs-1.11.23/contrib/debug_check_log.sh
--- cvs-1.11.23-orig/contrib/debug_check_log.sh 2005-07-12 15:55:25.000000000 +0200
+++ cvs-1.11.23/contrib/debug_check_log.sh 2008-05-12 01:48:09.000000000 +0200
@@ -22,7 +22,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 ()
{
@@ -99,13 +102,13 @@
# 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
@@ -113,8 +116,8 @@
# 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
@@ -122,34 +125,34 @@
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' <$dcl_f >/tmp/dclp$$
+ mv /tmp/dclp$$ $dcl_f
# 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
}
###
Only in cvs-1.11.23/contrib: debug_check_log.sh~
diff -ru cvs-1.11.23-orig/contrib/pvcs2rcs.in cvs-1.11.23/contrib/pvcs2rcs.in
--- cvs-1.11.23-orig/contrib/pvcs2rcs.in 2008-05-07 03:15:43.000000000 +0200
+++ cvs-1.11.23/contrib/pvcs2rcs.in 2008-05-12 01:44:59.000000000 +0200
@@ -146,9 +146,6 @@
# 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;
@@ -827,8 +824,6 @@
$wtr->print ("\n") unless ($comment{$revision} =~ /\n$/s);
$wtr->print (".\n");
$wtr->close;
- # $ci_output = `$ci_command`;
- # $ci_output = `cat $tmpdir/ci.out`;
$first_time = 0 if ($first_time);
} # foreach revision
Only in cvs-1.11.23/contrib: pvcs2rcs.in~
diff -ru cvs-1.11.23-orig/contrib/rcs2log.sh cvs-1.11.23/contrib/rcs2log.sh
--- cvs-1.11.23-orig/contrib/rcs2log.sh 2005-07-12 15:58:23.000000000 +0200
+++ cvs-1.11.23/contrib/rcs2log.sh 2008-05-12 01:49:03.000000000 +0200
@@ -96,7 +96,6 @@
# defaults
: ${MKTEMP="@MKTEMP@"}
: ${AWK=awk}
-: ${TMPDIR=/tmp}
changelog=ChangeLog # change log file name
datearg= # rlog date option
@@ -199,11 +198,12 @@
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
Only in cvs-1.11.23/contrib: rcs2log.sh~
diff -ru cvs-1.11.23-orig/contrib/sccs2rcs.in cvs-1.11.23/contrib/sccs2rcs.in
--- cvs-1.11.23-orig/contrib/sccs2rcs.in 2005-09-01 14:13:31.000000000 +0200
+++ cvs-1.11.23/contrib/sccs2rcs.in 2008-05-12 01:49:50.000000000 +0200
@@ -96,18 +96,19 @@
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
+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 = /tmp/sccs2rcs_$$_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 = (\
Only in cvs-1.11.23/contrib: sccs2rcs.in~
diff -ru cvs-1.11.23-orig/doc/cvs.texinfo cvs-1.11.23/doc/cvs.texinfo
--- cvs-1.11.23-orig/doc/cvs.texinfo 2008-05-07 03:15:46.000000000 +0200
+++ cvs-1.11.23/doc/cvs.texinfo 2008-05-12 01:38:35.000000000 +0200
@@ -12642,8 +12642,8 @@
@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
@@ -14023,8 +14023,6 @@
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).
@@ -14224,7 +14222,7 @@
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.
Only in cvs-1.11.23/doc: cvs.texinfo~
diff -ru cvs-1.11.23-orig/FAQ cvs-1.11.23/FAQ
--- cvs-1.11.23-orig/FAQ 2006-08-25 17:48:46.000000000 +0200
+++ cvs-1.11.23/FAQ 2008-05-12 01:56:10.000000000 +0200
@@ -4956,30 +4956,30 @@
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_
Only in cvs-1.11.23: FAQ~
diff -ru cvs-1.11.23-orig/INSTALL cvs-1.11.23/INSTALL
--- cvs-1.11.23-orig/INSTALL 2006-08-25 17:48:46.000000000 +0200
+++ cvs-1.11.23/INSTALL 2008-05-12 01:54:56.000000000 +0200
@@ -335,9 +335,7 @@
The --with-tmpdir argument to configure may be used to set a
specific directory for use as a default temporary directory. If not
- set, configure will pick the first directory it finds which it has
- read, write, and execute permissions to from $TMPDIR, $TMP, $TEMP,
- /tmp, and /var/tmp, in that order. Failing that, it will use /tmp.
+ set, configure will use /tmp.
The --with-umask argument to configure can be used to change
the default umask used by the CVS server executable.
Only in cvs-1.11.23: INSTALL~
diff -ru cvs-1.11.23-orig/man/cvsbug.8 cvs-1.11.23/man/cvsbug.8
--- cvs-1.11.23-orig/man/cvsbug.8 2001-11-27 17:24:58.000000000 +0100
+++ cvs-1.11.23/man/cvsbug.8 2008-05-12 01:39:30.000000000 +0200
@@ -201,12 +201,11 @@
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
Only in cvs-1.11.23/man: cvsbug.8~
diff -ru cvs-1.11.23-orig/src/filesubr.c cvs-1.11.23/src/filesubr.c
--- cvs-1.11.23-orig/src/filesubr.c 2008-05-07 17:57:34.000000000 +0200
+++ cvs-1.11.23/src/filesubr.c 2008-05-12 01:44:37.000000000 +0200
@@ -705,7 +705,7 @@
error (1, errno, "Failed to create temporary file %s",
fn ? fn : "(null)");
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;
}
@@ -758,9 +758,10 @@
{
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
@@ -772,14 +773,15 @@
/* 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);
@@ -790,6 +792,7 @@
* linking to and not chmod for 2.0.7+
*/
else chmod (fn, 0600);
+ errno = save_errno;
}
Only in cvs-1.11.23/src: filesubr.c~
diff -ru cvs-1.11.23-orig/src/logmsg.c cvs-1.11.23/src/logmsg.c
--- cvs-1.11.23-orig/src/logmsg.c 2008-05-07 17:57:34.000000000 +0200
+++ cvs-1.11.23/src/logmsg.c 2008-05-12 01:40:03.000000000 +0200
@@ -210,14 +210,9 @@
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:
errno = 0; /* Standard C doesn't require errno be set on error */
- 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)
Only in cvs-1.11.23/src: logmsg.c~
diff -ru cvs-1.11.23-orig/TODO cvs-1.11.23/TODO
--- cvs-1.11.23-orig/TODO 2006-08-25 19:14:00.000000000 +0200
+++ cvs-1.11.23/TODO 2008-05-12 01:55:32.000000000 +0200
@@ -654,27 +654,27 @@
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:
Only in cvs-1.11.23: TODO~