Mailing List Archive

Cwd.pm - overzealous checking
I just had Cwd.pm (and hence Tk::FileSelect) fail because in a parent
directory I have a link to a 'dead' file system:

lstat(../../disk9): Stale NFS file handle at /usr/local/lib/perl5.new/Cwd.pm line 116.

unless (@tst = lstat("$dotdots/$dir"))
{
warn "lstat($dotdots/$dir): $!";
closedir(PARENT);
return '';
}

Just because I can't lstat a member of the directory does not mean
I won't find the dev/inode pair Cwd is looking for in an entry I can
lstat.

I would like it to be :

next unless (@tst = lstat("$dotdots/$dir"));

But it is a do { } while () loop so next does not work so
I propose this patch:

*** /home/road10/free-sw/perl5/perl5.002beta1/lib/Cwd.pm Tue Nov 14 04:01:38 1995
--- /home/auspex4/local/share/lib/perl5.new/Cwd.pm Tue Nov 28 18:02:08 1995
***************
*** 111,122 ****
closedir(PARENT);
return '';
}
! unless (@tst = lstat("$dotdots/$dir"))
! {
! warn "lstat($dotdots/$dir): $!";
! closedir(PARENT);
! return '';
! }
}
while ($dir eq '.' || $dir eq '..' || $tst[0] != $pst[0] ||
$tst[1] != $pst[1]);
--- 111,117 ----
closedir(PARENT);
return '';
}
! $tst[0] = $pst[0]+1 unless (@tst = lstat("$dotdots/$dir"))
}
while ($dir eq '.' || $dir eq '..' || $tst[0] != $pst[0] ||
$tst[1] != $pst[1]);