summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-25 01:35:26 +0000
committerKarl Berry <karl@freefriends.org>2008-11-25 01:35:26 +0000
commit051c31ba4a14da0a9ad05b48a63ee5b31052441c (patch)
treeff2b94a1a895dfeb2a2501965951c0a528858f0b
parent956d952d37799fbddfb2cd354c60dfeabbef3d7d (diff)
use effective uid to make temp file names more robust
git-svn-id: svn://tug.org/texlive/trunk@11416 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/tlpkg/bin/place19
1 files changed, 10 insertions, 9 deletions
diff --git a/Master/tlpkg/bin/place b/Master/tlpkg/bin/place
index de23064f46c..f2bcb217e01 100755
--- a/Master/tlpkg/bin/place
+++ b/Master/tlpkg/bin/place
@@ -36,6 +36,7 @@ $package = $ARGV[0];
$newpackage = 0;
%dirs = (); # dirs we make changes in
$TMP = $ENV{"TMPDIR"} || "/tmp";
+$tmpfile = "$TMP/$>.tlplace"; # use effective uid in temp file names
$cooked = getcwd(); # ctan2tl invokes us in the cooked dire
-d "$cooked/$package" || die "$0: No such package in $cooked: $package\n";
@@ -106,22 +107,22 @@ if (!defined($tlpold)) {
} else {
print "new vs. present $package (present is indented)\n";
my @oldfiles = $tlpold->all_files;
- `rm -f $TMP/tlplace.old`;
+ `rm -f $tmpfile.old`;
foreach (sort @oldfiles) {
- `echo $_ >> $TMP/tlplace.old`;
+ `echo $_ >>$tmpfile.old`;
}
my @newfiles = $tlpnew->all_files;
- `rm -f $TMP/tlplace.new`;
+ `rm -f $tmpfile.new`;
foreach (sort @newfiles) {
- `echo $_ >> $TMP/tlplace.new`;
+ `echo $_ >>$tmpfile.new`;
}
- print `comm -3 $TMP/tlplace.new $TMP/tlplace.old`;
- my @difffiles = `comm -12 $TMP/tlplace.new $TMP/tlplace.old`;
+ print `comm -3 $tmpfile.new $tmpfile.old`;
+ my @difffiles = `comm -12 $tmpfile.new $tmpfile.old`;
chomp (@difffiles);
my $sum = 0;
my $identical = 0;
#
- my $diff_file = "$TMP/tlplace.diff";
+ my $diff_file = "$tmpfile.diff";
unlink ($diff_file);
my $diff_cmd = "diff --text --strip-trailing-cr --ignore-all-space -U 0 -s";
#
@@ -143,7 +144,7 @@ if (!defined($tlpold)) {
#
my $changed = $nrcommfiles - $identical;
print "$nrcommfiles common files, $changed changed, ~$sum lines different ($diff_file)\n\n\f\n";
- #`rm -f $TMP/tlplace.new $TMP/tlplace.old $diff_file`;
+ #`rm -f $tmpfile.*`
}
&xchdir ("$cooked/$package");
@@ -199,7 +200,7 @@ $dirs{"$M/tlpkg/tlpsrc/$package.tlpsrc"}++;
#
# also write dir list to a separate file, for easy passing to a commit.
#
-$DIRLIST = ">$TMP/tlplace.dirs";
+$DIRLIST = ">$tmpfile.dirs";
open (DIRLIST) || die "open($DIRLIST) failed: $!";
#
print "place: directories are:\n";