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

Re: File::Find on WSL

Thread Previous | Thread Next
From:
James E Keenan
Date:
December 3, 2016 21:14
Subject:
Re: File::Find on WSL
Message ID:
20161203211353.13011.qmail@lists-nntp.develooper.com
On 12/03/2016 03:25 PM, Thorsten Behrens wrote:
> I need to apologize. My heart's in the right place, my coding skills are not, and I'm spamming you. The code I sent so far is nonsense. That's not how index() works. This, after some testing, works. Attempt #3:
>
> 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:
>
> # These are hard-coded for now, but may move to hint files.
> if ($^O eq 'VMS') {
>     $Is_VMS = 1;
>     $File::Find::dont_use_nlink  = 1;
> }
> elsif ($^O eq 'MSWin32') {
>     $Is_Win32 = 1;
> }
> elsif ($^O eq 'linux') {
>     open my $lv, '<', '/proc/version';
>     if (index(<$lv>,'Microsoft') != -1 || index(<$lv>,'WSL') != -1) {
>         $File::Find::dont_use_nlink = 1;
>     }
>     close $lv;
> }
>

Can you supply the content of /proc/version on a typical WSL system?

On that same system, can you supply the output of 'uname -a'?

Likewise, on that same system, can you supply the output of 'perl -V'?

I note that on a "typical" Ubuntu, the first two requests above output:

#####
$ cat /proc/version
Linux version 4.4.0-51-generic (buildd@lcy01-08) (gcc version 5.4.0 
20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #72-Ubuntu SMP Thu Nov 24 
18:29:54 UTC 2016

$ uname -a
Linux zareason 4.4.0-51-generic #72-Ubuntu SMP Thu Nov 24 18:29:54 UTC 
2016 x86_64 x86_64 x86_64 GNU/Linux
#####

Thank you very much.

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