develooper Front page | perl.perl5.porters | Postings from December 2016

Re: File::Find on WSL

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
December 6, 2016 21:25
Subject:
Re: File::Find on WSL
Message ID:
CAHhgV8h-wEAtszCr7q1WNfz4rS7Y=0apRDVsADqZiD1YHXhzWg@mail.gmail.com
On Sat, Dec 3, 2016 at 8:53 PM, Thorsten Behrens <tbehrens@outlook.com>
wrote:

> Howdy,
>
>
>
> As per discussion here https://github.com/Microsoft/
> BashOnWindows/issues/186, WSL confuses File::Find. WSL is the “Windows
> Subsystem for Linux”, which runs Ubuntu on top of Windows 10.
>
>
>
> File::Find sees that $^O is ‘linux’ and uses nlink, which doesn’t work.
> After some discussion, this code added to Find.pm special-cases for WSL and
> solves the issue:
>
>
>
> # Special-case for WSL by reading /proc/version
>
> if ($^O eq 'linux') {
>
>     open my $lv, '<', '/proc/version';
>
>     if (index(<$lv>,'Windows') || index(<$lv>,'WSL')) {
>
>         $File::Find::dont_use_nlink = 1;
>
>     }
>
>     close $lv;
>
> }
>
>
>
> This would likely go right after the “hard-coded for now” section that
> handles VMS and MSWin32.
>
>
>
> @genio kindly pointed me to this mailing list for further discussion. If
> that code above is acceptable, I can follow instructions in
> http://perldoc.perl.org/perlhack.html and issue a pull request.
>
>
It appears Microsoft already fixed this in the latest development release
of WSL (by making the link count of directories return something less than
2, triggering our don't-optimize heuristic).

That would mean this change isn't necessary anymore :-)

Leon

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About