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

Jan Netík netikja at gmail.com
Thu Feb 10 20:52:40 CET 2022


OK, I have the final solution. First, we should really write to "nul:"
(with single or double quotes and a colon), as Philip wrote and Zdeněk
confirmed. Second, line (
https://tug.org/svn/texlive/trunk/Master/tlpkg/TeXLive/TLUtils.pm?revision=61960&view=markup#l4083
)

my $warg = (win32() ? "-w %{url_effective} " : "-w '%{url_effective}' ");


*should have quotes* also around the first %{url_effective} (it works fine
without them with recent curl shipped with Windows, but may fail with
various curl versions, e.g. that shipped with R/rtools40, in my case). The
thing is %url_effective is returned as $url, not any mirror. Maybe the
ifelse is not necessary after all?

Best,
Jan



čt 10. 2. 2022 v 12:48 odesílatel Jan Netík <netikja at gmail.com> napsal:

> 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/820c54f1/attachment-0001.html>


More information about the tex-live mailing list.