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 04:23
Subject:
RE: File::Find on WSL
Message ID:
SN1PR14MB0493DDE56B6158C20CB70670CD800@SN1PR14MB0493.namprd14.prod.outlook.com
Hi Uri,

That's good feedback. @kid51 was in touch and is directing me to work with the maintainers of perl on Ubuntu, and once I can satisfy that group, they can submit it upstream to P5P. I am grateful for the help in steering me through how you maintain perl as well as with the code.


?  no need to explicitly close $pv as it is declared in a tight scope and will be closed upon scope exit.

Yes. I wasn't sure whether "the perl way" was to rely an automatic close or be explicit. That clears that up. :)


?  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.

Good question on the die. I think that could be argued either way, but yes, /proc/version being gone would be pretty dire, so - sure. I'll suggest it to the perl maintainers over at Ubuntu with the changes you recommend, which makes it:

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

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