From 164336fe285a406eec3a30a591ac139619af9e11 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Thu, 1 May 2003 12:33:44 +0000 Subject: [PATCH] OS X test tweak. p4raw-id: //depot/perl@19374 --- ext/Cwd/t/cwd.t | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ext/Cwd/t/cwd.t b/ext/Cwd/t/cwd.t index 2a8df24..834a399 100644 --- a/ext/Cwd/t/cwd.t +++ b/ext/Cwd/t/cwd.t @@ -63,6 +63,21 @@ SKIP: { skip("'$pwd_cmd' failed, nothing to test against", 4) if $?; skip("/afs seen, paths unlikely to match", 4) if $start =~ m|/afs/|; + # Darwin's getcwd(3) (which Cwd.xs:bsd_realpath() uses which + # Cwd.pm:getcwd uses) has some magic related to the PWD + # environment variable: if PWD is set to a directory that + # looks about right (guess: has the same (dev,ino) as the '.'?), + # the PWD is returned. However, if that path contains + # symlinks, the path will not be equal to the one returned by + # /bin/pwd (which probably uses the usual walking upwards in + # the path -trick). This situation is easy to reproduce since + # /tmp is a symlink to /private/tmp. Therefore we invalidate + # the PWD to force getcwd(3) to (re)compute the cwd in full. + # Admittedly fixing this in the Cwd module would be better + # long-term solution but deleting $ENV{PWD} should not be + # done light-heartedly. --jhi + delete $ENV{PWD} if $^O eq 'darwin'; + my $cwd = cwd; my $getcwd = getcwd; my $fastcwd = fastcwd; -- 2.7.4