Subject: RE: (C<readdir> broken ?) pb with Cwd::getcwd() ! [perl 5.005_02 / Cygwin32 B.20.1]
From: "Rick Rankin" <[email-masked]>
To: "Todd Goodman" <[email-masked]>, "'Sebastien Barre'" <[email-masked]>
Cc: <[email-masked]>
Date: Fri, 26 Feb 1999 21:12:53 -0700

The code in Cwd.pm, specifically in abs_path, is based on the fact that
under Unix, when you stat '.', then cd .., then stat the name of the
directory you just came from, you get the same inode number. That apparently
doesn't happen under Cygwin. Because of that, a loop in abs_path doesn't
terminate properly, and abs_path fails. Todd's fix works, and I have a
little different one that looks like this:

--- CUT HERE ---
*** Cwd.pm      Fri Feb 26 21:09:26 1999
--- Cwd.pm.save Fri Feb 26 21:09:06 1999
***************
*** 371,384 ****
          *abs_path     = \&_qnx_abs_path;
          *fast_abs_path        = \&_qnx_abs_path;
      }
-     elsif ($^O =~ /cygwin/) {
-               *cwd            = \&_backtick_pwd;
-               *getcwd         = \&_backtick_pwd;
-               *fastgetcwd     = \&_backtick_pwd;
-               *fastcwd        = \&_backtick_pwd;
-               *abs_path       = \&_backtick_pwd;
-               *fast_abs_path  = \&_backtick_pwd;
-       }
  }

  # package main; eval join('',<DATA>) || die $@;       # quick test
--- CUT HERE ---

Rick
--
Rick Rankin
[email-masked]

> -----Original Message-----
> From: [email-masked]
> [mailto:[email-masked]]On Behalf Of Todd Goodman
> Sent: Friday, February 26, 1999 7:59 PM
> To: 'Sebastien Barre'
> Cc: [email-masked]
> Subject: RE: (C<readdir> broken ?) pb with Cwd::getcwd() ! [perl
> 5.005_02 / Cygwin32 B.20.1]
>
>
> I don't have any problem with readdir and getcwd from my
> perl source directory works fine:
>
> /usr/local/src/perl5.005_02> perl -e 'use Cwd; print getcwd() . "\n";'
> /usr/local/src/perl5.005_02
> /usr/local/src/perl5.005_02>
>
> Did you patch Cwd.pm as in the different instructions for
> building Perl?
>
> This is my change in Cwd.pm:
>
> --- cwd.pm	Fri Feb 26 21:52:42 1999
> +++ cwd.pm.orig	Fri Jan 22 20:49:54 1999
> @@ -208,8 +208,6 @@
>      my $start = @_ ? shift : '.';
>      my($dotdots, $cwd, @pst, @cst, $dir, @tst);
>
> -    return cwd() if ( $^O =~ /cygwin/ );
> -
>      unless (@cst = stat( $start ))
>      {
>  	carp "stat($start): $!";
>
> > -----Original Message-----
> > From: Sebastien Barre [mailto:[email-masked]]
> > Sent: Friday, February 26, 1999 1:56 AM
> > To: Todd Goodman
> > Cc: [email-masked]
> > Subject: RE: (C<readdir> broken ?) pb with Cwd::getcwd() ! [perl
> > 5.005_02 / Cygwin32 B.20.1]
> >
> >
> > At 23:04 25/02/99 -0500, Todd Goodman wrote:
> >
> > >I don't quite understand what you're saying below, but I believe the
> > >problem you're seeing is because the runpod2man subroutine
> > in installman
> >
> > No, it does not seem to be a Perl pb : the Perl getcwd() command (see
> > Cwd.pm) just seems not to work, and seems related to
> > readdir() : is there a
> > known bug with readdir() ?
> >
> > >> Use ::Cwd;
> > >> print getcwd();
> >
> > By the way, there is a typo, that was :
> >
> > >> Use Cwd;
> > >> print getcwd();
> >
> >
> > ______________________________________________________________
> > Sebastien Barre                  http://www.hds.utc.fr/~barre/
> >
>
> --
> Want to unsubscribe from this list?
> Send a message to [email-masked]
>

--
Want to unsubscribe from this list?
Send a message to [email-masked]