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

File::Find on WSL

Thread Next
From:
Thorsten Behrens
Date:
December 3, 2016 19:53
Subject:
File::Find on WSL
Message ID:
SN1PR14MB04931A173F06244E2038CEEACD810@SN1PR14MB0493.namprd14.prod.outlook.com
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.

Yours
Thorsten


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