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

Re: File::Find on WSL

Thread Previous | Thread Next
From:
Thorsten Behrens
Date:
December 4, 2016 12:51
Subject:
Re: File::Find on WSL
Message ID:
SN1PR14MB04930F9C2E6835EE429C76E9CD800@SN1PR14MB0493.namprd14.prod.outlook.com
Leon,


> It is possible (but unusual) for /proc not to exist. Dieing is plain wrong, and warning is more likely to be erroneous than legitimate.


Okay. And given that this only impacts WSL and should not cause trouble in any other system, that makes a lot of sense to me. The added elsif then becomes:


# 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') {
    if (open my $pv, '<', '/proc/version') {
        my $lv = <$pv>;
        if (index($lv,'Microsoft') != -1 || index($lv,'WSL') != -1) {
            $File::Find::dont_use_nlink = 1;
        }
    }
}


________________________________
From: Leon Timmermans <fawaka@gmail.com>
Sent: Sunday, December 4, 2016 12:29:56 PM
To: Uri Guttman
Cc: Thorsten Behrens; perl5-porters@perl.org
Subject: Re: File::Find on WSL

On Sun, Dec 4, 2016 at 5:12 AM, Uri Guttman <uri@stemsystems.com<mailto:uri@stemsystems.com>> wrote:
do you want that to be a warn or a die? i would call die as that means the $^O is misleading or something made /proc/version disappear. a warning does little good there as the typical caller of file::find won't understand what is wrong.

It is possible (but unusual) for /proc not to exist. Dieing is plain wrong, and warning is more likely to be erroneous than legitimate.

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