[tex-live] bug with file copying in tlpkg/TeXLive/TLUtils.pm
Jukka Salmi
j+tex-live at 2009.salmi.ch
Tue Sep 1 17:25:52 CEST 2009
Daniel Villeneuve --> tex-live (2009-08-31 21:15:09 -0400):
> Hi,
>
> Maybe this is a known bug, but I got caught another time with this
> behavior so I thought I'd report it.
>
> In the sub copy of TLUtils.pm are two lines for determining the
> right mode argument given to chmod:
>
> $mode=(-x "$infile")? oct("0777"):oct("0666");
> $mode-=umask;
Indeed, this looks wrong. A fix is attached.
Regards, Jukka
> If umask is set as 027, then the subtraction yields 0637, which is a
> quite bizarre permissions setting.
> A fix could be to write
>
> my $mask = (-x "$infile")? oct("0777"):oct("0666");
> $mode = $mask - (umask() & $mask);
>
> which yields 0640 (more usual).
>
> Regards,
> --
> Daniel Villeneuve
--
This email fills a much-needed gap in the archives.
-------------- next part --------------
Index: Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- Master/tlpkg/TeXLive/TLUtils.pm (revision 14980)
+++ Master/tlpkg/TeXLive/TLUtils.pm (working copy)
@@ -771,8 +771,8 @@ C<(-l $file)> will never return 'C<true>' and so s
(uselessly) copied as regular files.
C<copy> invokes C<mkdirhier> if target directories do not exist. Files
-have mode C<0777>-I<umask> if they are executable and C<0666>-I<umask>
-otherwise.
+have mode C<0777> if they are executable and C<0666> otherwise, with the
+set bits in I<umask> cleared in each case.
C<$file> can begin with a file:/ prefix.
@@ -824,7 +824,7 @@ sub copy
binmode IN;
$mode = (-x "$infile") ? oct("0777") : oct("0666");
- $mode -= umask;
+ $mode &= ~umask;
open (OUT, ">$outfile") || die "open(>$outfile) failed: $!";
binmode OUT;
More information about the tex-live
mailing list