Undesirable nul file with tlmgr.bat under Windows
Torsten Schuetze
torsten.schuetze at gmx.net
Thu Jul 18 19:54:54 CEST 2019
Hi Norbert,
On 17/07/2019 04:21, Norbert Preining wrote:
> Hmm, so this should come from the following code in TLUtils.pm:
> my $cmd = "$wget $mirror/ --timeout=$NetworkTimeout -O "
> . (win32() ? "nul" : "/dev/null")
> . " 2>" . (win32() ? "nul" : "/dev/null");
>
> Where $wget = "wget" and win32() checks $^0 for /^MSWin/i
> So in your case, as it returns cygwin, it shoud expand to
> wget .../ --timeout=... -O /dev/null 2>/dev/null
> and no "nul" file should be created ... very strange.
>
> Can you please **edit** TLUtils.pm (in TLROOT/tlpkg/TeXLive/)
> and around line 3775 add the following printf so that it looks like
> this:
> my $cmd = "$wget $mirror/ --timeout=$NetworkTimeout -O "
> . (win32() ? "nul" : "/dev/null")
> . " 2>" . (win32() ? "nul" : "/dev/null");
> print STDERR "DEBUG cmd = $cmd\n"; ####### ADDED LINE !!!!
> my $ret = system($cmd);
I first added the debug output in line 3775 and it didn't work with $
tlmgr.bat --repository ctan update --list
Then I added it in 3714 and then it prints
DEBUG cmd = wget http://mirror.ctan.org --timeout=30 -O nul 2>&1
and creates the nul file.
$ diff -c TLUtils.pm TLUtils.pm.orig
*** TLUtils.pm Thu Jul
18 19:24:41 2019
--- TLUtils.pm.orig Fri Jul 12 08:50:34 2019
***************
*** 3711,3717 ****
my $mirror = $TeXLiveServerURL;
my $cmd = "$wget $mirror --timeout=$NetworkTimeout -O "
. (win32() ? "nul" : "/dev/null") . " 2>&1";
! print STDERR "DEBUG cmd = $cmd\n"; ####### ADDED LINE !!!!
#
# since we are reading the output of wget to find a mirror
# we have to make sure that the locale is unset
--- 3711,3717 ----
my $mirror = $TeXLiveServerURL;
my $cmd = "$wget $mirror --timeout=$NetworkTimeout -O "
. (win32() ? "nul" : "/dev/null") . " 2>&1";
!
#
# since we are reading the output of wget to find a mirror
# we have to make sure that the locale is unset
***************
*** 3773,3779 ****
my $cmd = "$wget $mirror/ --timeout=$NetworkTimeout -O "
. (win32() ? "nul" : "/dev/null")
. " 2>" . (win32() ? "nul" : "/dev/null");
- print STDERR "DEBUG cmd = $cmd\n"; ####### ADDED LINE !!!!
my $ret = system($cmd);
# if return value is not zero it is a failure, so switch the meanings
return ($ret ? 0 : 1);
--- 3773,3778 ----
So, the offending code is line 3712. And this looks slightly different
than line 3773. If you change my $cmd at line 3712 into
DEBUG cmd = wget http://mirror.ctan.org --timeout=30 -O nul 2>&1 >nul
than it seems to work. At least for this test case. Here is the diff
$ diff -c TLUtils.pm TLUtils.pm.orig
*** TLUtils.pm Thu Jul 18 19:44:34 2019
--- TLUtils.pm.orig Fri Jul 12 08:50:34 2019
***************
*** 3710,3718 ****
# do not reduce retries here, but timeout still seems desirable.
my $mirror = $TeXLiveServerURL;
my $cmd = "$wget $mirror --timeout=$NetworkTimeout -O "
! . (win32() ? "nul" : "/dev/null")
! . " 2>&1 >" . (win32() ? "nul" : "/dev/null");
! print STDERR "DEBUG cmd = $cmd\n"; ####### ADDED LINE !!!!
#
# since we are reading the output of wget to find a mirror
# we have to make sure that the locale is unset
--- 3710,3717 ----
# do not reduce retries here, but timeout still seems desirable.
my $mirror = $TeXLiveServerURL;
my $cmd = "$wget $mirror --timeout=$NetworkTimeout -O "
! . (win32() ? "nul" : "/dev/null") . " 2>&1";
!
#
# since we are reading the output of wget to find a mirror
# we have to make sure that the locale is unset
***************
*** 3774,3780 ****
my $cmd = "$wget $mirror/ --timeout=$NetworkTimeout -O "
. (win32() ? "nul" : "/dev/null")
. " 2>" . (win32() ? "nul" : "/dev/null");
- print STDERR "DEBUG cmd = $cmd\n"; ####### ADDED LINE !!!!
my $ret = system($cmd);
# if return value is not zero it is a failure, so switch the meanings
return ($ret ? 0 : 1);
--- 3773,3778 ----
I hope that the patched lines 3713/3714 solve the problem of the
undesirable nul file. I don't know why -O nul is not sufficient, but the
Linux/Cygwin 2>&1 >nul solution works (for me).
Ciao
Torsten
PS: If you want that I test a patch (may be other places are also
affected) before release I would be happy to do this.
More information about the tex-live
mailing list