You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

  1. --- a/dist/PathTools/Cwd.pm
  2. +++ b/dist/PathTools/Cwd.pm
  3. @@ -659,6 +659,10 @@ if (exists $METHOD_MAP{$^O}) {
  4. }
  5. }
  6. +# built-in from 5.30
  7. +*getcwd = \&Internals::getcwd
  8. + if !defined &getcwd && defined &Internals::getcwd;
  9. +
  10. # In case the XS version doesn't load.
  11. *abs_path = \&_perl_abs_path unless defined &abs_path;
  12. *getcwd = \&_perl_getcwd unless defined &getcwd;
  13. --- a/dist/PathTools/t/cwd.t
  14. +++ b/dist/PathTools/t/cwd.t
  15. @@ -10,6 +10,7 @@ chdir 't';
  16. use Config;
  17. use File::Spec;
  18. use File::Path;
  19. +use Errno qw(EACCES);
  20. use lib File::Spec->catdir('t', 'lib');
  21. use Test::More;
  22. @@ -208,7 +209,15 @@ SKIP: {
  23. like($abs_path, qr|$want$|i, "Cwd::abs_path produced $abs_path");
  24. like($fast_abs_path, qr|$want$|i, "Cwd::fast_abs_path produced $fast_abs_path");
  25. - like($pas, qr|$want$|i, "Cwd::_perl_abs_path produced $pas") if $EXTRA_ABSPATH_TESTS;
  26. + if ($EXTRA_ABSPATH_TESTS) {
  27. + # _perl_abs_path() can fail if some ancestor directory isn't readable
  28. + if (defined $pas) {
  29. + like($pas, qr|$want$|i, "Cwd::_perl_abs_path produced $pas");
  30. + }
  31. + else {
  32. + is($!+0, EACCES, "check we got the expected error on failure");
  33. + }
  34. + }
  35. rmtree($test_dirs[0], 0, 0);
  36. 1 while unlink $file;