summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm16
1 files changed, 7 insertions, 9 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index a4144fa0d8a..4f8e467ee37 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -413,11 +413,8 @@ on UNIX systems. On Windows, C<(-l $file)> will certainly never
return 'C<true>' and symlinks will be copied as regular files.
C<copy> invokes C<mkdirhier> if target directories do not exist.
-These directories are created with mode C<0755>. Because the files
-are copied from a read-only media with all write permissions removed,
-the write flag is set for the current user, quite similar to
-
- chmod u+w $target_dir/`basename $file`
+Files have mode C<0777>-I<umask> if they are execuatble and
+C<0666>-I<umask> otherwise.
=cut
@@ -433,9 +430,6 @@ sub copy {
my $dirmode=0755;
my $blocksize=2048;
- @stat=lstat "$infile";
- $mode=$stat[2];
-
mkdirhier ("$destdir") unless -d "$destdir";
$filename=basename "$infile";
@@ -448,7 +442,10 @@ sub copy {
or die "Can't open '$infile': $!\n";
binmode IN;
- sysopen OUT, "$outfile", (O_CREAT|O_WRONLY)
+ $mode=(-x "$infile")? oct("0777"):oct("0666");
+ $mode-=umask;
+
+ sysopen OUT, "$outfile", (O_CREAT|O_WRONLY), $mode
or die "Can't open '$outfile': $!\n";
binmode OUT;
@@ -464,6 +461,7 @@ sub copy {
}
close OUT;
close IN;
+ @stat=lstat "$infile";
utime $stat[8], $stat[9], "$outfile";
}
}