From 3005247e2c1ff3be0b9c184c43f1f0aee1bc9e95 Mon Sep 17 00:00:00 2001 From: Reinhard Kotucha Date: Sun, 11 Nov 2007 22:35:18 +0000 Subject: TLUtils.pm: fixed permissions in copy(). git-svn-id: svn://tug.org/texlive/trunk@5404 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLUtils.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'Master') 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' and symlinks will be copied as regular files. C invokes C 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 if they are execuatble and +C<0666>-I 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"; } } -- cgit v1.2.3