This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
correct error returns from _perl_abs_path()
authorZefram <zefram@fysh.org>
Sun, 24 Dec 2017 11:09:54 +0000 (11:09 +0000)
committerZefram <zefram@fysh.org>
Sun, 24 Dec 2017 11:09:54 +0000 (11:09 +0000)
commitd2e38af7de734aa1e317de7166c6995e432e2f30
tree8b86a58283f68240c1a396dc803ba2c8f466e11e
parente7e8ce8540f1612023d46e27e60ff002d8ab5dd7
correct error returns from _perl_abs_path()

The perl implementation of abs_path(), and hence of getcwd(), was
returning an empty string on error, and sending a diagnostic to stderr.
The diagnostic for failing to find a directory in its parent included a
bogus $! value.  This differed from the XS version, which returns undef
with $! set appropriately.  The documentation, not explicit on the topic,
suggests that errors should be signalled more like what the XS was doing.

Resolve the discrepancy by changing the perl implementation to signal
errors by returning undef with $! set appropriately.  Document getcwd()
and abs_path() as doing this.

Fixes [perl #132648].
13 files changed:
MANIFEST
dist/PathTools/Cwd.pm
dist/PathTools/lib/File/Spec.pm
dist/PathTools/lib/File/Spec/AmigaOS.pm
dist/PathTools/lib/File/Spec/Cygwin.pm
dist/PathTools/lib/File/Spec/Epoc.pm
dist/PathTools/lib/File/Spec/Functions.pm
dist/PathTools/lib/File/Spec/Mac.pm
dist/PathTools/lib/File/Spec/OS2.pm
dist/PathTools/lib/File/Spec/Unix.pm
dist/PathTools/lib/File/Spec/VMS.pm
dist/PathTools/lib/File/Spec/Win32.pm
dist/PathTools/t/cwd_enoent.t [new file with mode: 0644]