[EXT] Re: TLUtils::check_on_working_mirror creates nul file on Windows

Jan Netík netikja at gmail.com
Thu Feb 10 12:48:33 CET 2022


I have some news. Found out that in the standard PowerShell or CMD in
Windows, there is no problem at all. I use tlmgr from R or RStudio terminal
pane (which should use cmd.exe). If you have R installed, try to run tlmgr
command in system2(). Furthermore, I tweaked the TLUtils.pm a bit to see
what is going on step by step, with a few sleep():

sub query_ctan_mirror_curl {
>   my $max_trial = 3;
>   my $warg = (win32() ? "-w %{url_effective} " : "-w '%{url_effective}' ");
>   for (my $i = 1; $i <= $max_trial; $i++) {
>     # -L -> follow redirects
>     # -s -> silent
>     # -w -> what to output after completion
>     my $cmd = "$::progs{'curl'} -Ls "
>               . "-o " . nulldev() . " "
>               . $warg
>               . "--connect-timeout $NetworkTimeout "
>               . "--max-time $NetworkTimeout "
>               . $TeXLiveServerURL;
>     ddebug("query_ctan_mirror_curl: cmd: $cmd\n");
>     debug("\n\n\n____this cmd wil be run in 10 sec:\n$cmd\n________");
> sleep(10);
>     my $url = `$cmd`;
> debug("____nul file should appear now____\n");
> debug("____url was: $url ______\n");
> debug("____sleep now for 20 sec______\n");
> sleep(20);
>     if (length $url) {
>       # remove trailing slashes
>       $url =~ s,/*$,,;
>       ddebug("query_ctan_mirror_curl: returning url: $url\n");
>       return $url;
>     }
>     sleep(1);
>   }
>   return;
> }
>

 In system shell, URL reads proper mirror URL, in RStudio or with system2
it reads %url_effective. Pretty interesting.

JN


čt 10. 2. 2022 v 11:11 odesílatel Zdenek Wagner <zdenek.wagner at gmail.com>
napsal:

> As Philip wrote, the null device should be nul: with a colon, it is
> consistent with drive letters. It probably used to work without the
> colon in previous versions and has been changed recently. I have only
> Windows XP and Windows 7 thus I cannot check whether -O nul: helps.
>
> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
>
> čt 10. 2. 2022 v 11:01 odesílatel Jan Netík <netikja at gmail.com> napsal:
> >
> > Interestingly, under Windows 11, when I run `wget ctan.org -O nul` in
> CMD with wget.exe shipped with texlive, I got no nul file. JN
> >
> > čt 10. 2. 2022 v 10:25 odesílatel Philip Taylor (Royal Holloway) <
> P.Taylor at rhul.ac.uk> napsal:
> >>
> >> On 10/02/2022 00:38, Norbert Preining wrote:
> >> > ..
> >> > Siep, anyone on Windows, can you confirm that a "nul" file is
> generated
> >> > when calling wget -O nul ... ?
> >>
> >> Not here, not under Windows 7.  But I believe that the "null" device
> >> should actually be specified as "nul:", not just "nul".  As in "con:".
> >> etc. Maybe try adding the colon.
> >>
> >>
> >>
> >> This email, its contents and any attachments are intended solely for
> the addressee and may contain confidential information. In certain
> circumstances, it may also be subject to legal privilege. Any unauthorised
> use, disclosure, or copying is not permitted. If you have received this
> email in error, please notify us and immediately and permanently delete it.
> Any views or opinions expressed in personal emails are solely those of the
> author and do not necessarily represent those of Royal Holloway, University
> of London. It is your responsibility to ensure that this email and any
> attachments are virus free.
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20220210/f08508ed/attachment.html>


More information about the tex-live mailing list.