diff options
author | A. Sinan Unur <sinan@unur.com> | 2022-07-28 10:21:10 +0200 |
---|---|---|
committer | xenu <me@xenu.pl> | 2022-08-02 02:20:10 +0200 |
commit | 414f14df98cb1c9a20f92c5c54948b67c09f072d (patch) | |
tree | e8aaeaaa580321dd607af8bfb7e845f539a0a539 /cpan/AutoLoader | |
parent | 2fcaad36c709e83c97f2f0995f00b46abcd4c24c (diff) | |
download | perl-414f14df98cb1c9a20f92c5c54948b67c09f072d.tar.gz |
File::Find: fix "follow => 1" on Windows
File::Find's code expects unix-style paths and it manipulates them using
basic string operations. That code is very fragile, and ideally we
should make it use File::Spec, but that would involve rewriting almost
the whole module.
Instead, we made it convert backslashes to slashes and handle drive
letters.
Note from xenu: this commit was adapted from the PR linked in this
blogpost[1]. I have squashed it, written the commit message and slightly
modified the code.
[1] - https://www.nu42.com/2021/09/canonical-paths-file-find-way-forward.html
Fixes #19995
Diffstat (limited to 'cpan/AutoLoader')
-rw-r--r-- | cpan/AutoLoader/t/02AutoSplit.t | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cpan/AutoLoader/t/02AutoSplit.t b/cpan/AutoLoader/t/02AutoSplit.t index f220a76cdc..b50c6f2d0c 100644 --- a/cpan/AutoLoader/t/02AutoSplit.t +++ b/cpan/AutoLoader/t/02AutoSplit.t @@ -149,8 +149,12 @@ foreach (@tests) { if ($args{Files}) { $args{Files} =~ s!/!:!gs if $^O eq 'MacOS'; + $args{Files} =~ s!\\!/!g if $^O eq 'MSWin32'; my (%missing, %got); - find (sub {$got{$File::Find::name}++ unless -d $_}, $dir); + find( + sub { (my $f = $File::Find::name) =~ s!\\!/!g; $got{$f}++ unless -d $_ }, + $dir + ); foreach (split /\n/, $args{Files}) { next if /^#/; $_ = lc($_) if $Is_VMS_lc; |