Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.98k stars 560 forks source link

Cwd::cwd() fails during perl-5.8.0 compilation #6634

Closed p5pRT closed 11 years ago

p5pRT commented 21 years ago

Migrated from rt.perl.org#23011 (status was 'rejected')

Searchable as RT23011$

p5pRT commented 21 years ago

From vrihad@myway.com

I am compiling perl-5.8.0 in chrooted environment where many system tools are not in its proper places. In my case shell utility "pwd" is in /usr/local/bin.

While compiling perl\, Cwd​::cwd() fails. After some probing I found that /usr/local/bin is not in the lists of locations where "pwd" is searched. Once I made a symlink of /usr/local/bin/pwd to /usr/bin/pwd\, the compilation proceeded smoothly. I am not sure whether /usr/local/bin is not searched intentionally. If so\, then it is not a bug. Else please fix this module.

Thanks vrihad

_______________________________________________ No banners. No pop-ups. No kidding. Introducing My Way - http​://www.myway.com

p5pRT commented 21 years ago

From @eserte

"vrihad@​myway.com (via RT)" \perlbug\-followup@​perl\.org writes​:

# New Ticket Created by vrihad@​myway.com # Please include the string​: [perl #23011] # in the subject line of all future correspondence about this issue. # \<URL​: http​://rt.perl.org/rt2/Ticket/Display.html?id=23011 >

I am compiling perl-5.8.0 in chrooted environment where many system tools are not in its proper places. In my case shell utility "pwd" is in /usr/local/bin.

While compiling perl\, Cwd​::cwd() fails. After some probing I found that /usr/local/bin is not in the lists of locations where "pwd" is searched. Once I made a symlink of /usr/local/bin/pwd to /usr/bin/pwd\, the compilation proceeded smoothly. I am not sure whether /usr/local/bin is not searched intentionally. If so\, then it is not a bug. Else please fix this module.

Cwd.pm should check $ENV{PATH} for an executable pwd\, hence you should set your PATH variable appropriately. As an alternative\, you can use fastcwd() instead\, which on many systems use an cwd implementation which does not need external tools.

Regards\,   Slaven

-- Slaven Rezic - slaven@​rezic.de   babybike - routeplanner for cyclists in Berlin   handheld (e.g. Compaq iPAQ with Linux) version of bbbike   http​://bbbike.sourceforge.net

p5pRT commented 21 years ago

From vrihad@myway.com

Hi!

I am compiling perl-5.8.0 in chrooted environment where many system tools are not in its proper places. --snip--

Cwd.pm should check $ENV{PATH} for an executable pwd\, hence you should set your PATH variable appropriately. I think it is not happening with Cwd.pm available in lib/Cwd.pm in perl source tree. I checked the file and though I am not a perl expert\, the path for /usr/bin/pwd and /bin/pwd is checked explicitly here. And my PATH variable contains /usr/local/bin.

As an alternative\, you can use fastcwd() instead\, which on many systems use an cwd implementation which does not need external tools. I don't know how to use it. I am talking about the perl configuration script which uses Cwd​::cwd() and it was failing in my case. Anyway the problem is solved by providing a symlink of /usr/local/bin/pwd to /usr/bin/pwd.

Thanks and regards vrihad

_______________________________________________ No banners. No pop-ups. No kidding. Introducing My Way - http​://www.myway.com

p5pRT commented 21 years ago

From @eserte

"Vrihad Shoonya" \vrihad@&#8203;myway\.com wrote​:

Hi!

I am compiling perl-5.8.0 in chrooted environment where many system tools are not in its proper places. --snip--

Cwd.pm should check $ENV{PATH} for an executable pwd\, hence you should set your PATH variable appropriately. I think it is not happening with Cwd.pm available in lib/Cwd.pm in perl source tree. I checked the file and though I am not a perl expert\, the path for /usr/bin/pwd and /bin/pwd is checked explicitly here. And my PATH variable contains /usr/local/bin.

This is the code (beginning at line 211)​:

unless(defined &cwd) {   # The pwd command is not available in some chroot(2)'ed environments   if( $^O eq 'MacOS' || (defined $ENV{PATH} &&   grep { -x "$_/pwd" } split('​:'\, $ENV{PATH})) )   {   *cwd = \&_backtick_pwd; ...

As an alternative\, you can use fastcwd() instead\, which on many systems use an cwd implementation which does not need external tools. I don't know how to use it. I am talking about the perl configuration script which uses Cwd​::cwd() and it was failing in my case. Anyway the problem is solved by providing a symlink of /usr/local/bin/pwd to /usr/bin/pwd.

  perl -MCwd=fastcwd -e 'warn fastcwd'

or to still retain calling cwd()\, but using fastcwd() under the hood​:

  perl -MCwd= -e '*cwd=\&Cwd​::fastcwd; warn cwd'

Regards\,   Slaven

p5pRT commented 11 years ago

From @jkeenan

On Mon Jul 21 05​:32​:27 2003\, slaven@​rezic.de wrote​:

"Vrihad Shoonya" \vrihad@&#8203;myway\.com wrote​:

Hi!

I am compiling perl-5.8.0 in chrooted environment where many system tools are not in its proper places. --snip--

Cwd.pm should check $ENV{PATH} for an executable pwd\, hence you should set your PATH variable appropriately. I think it is not happening with Cwd.pm available in lib/Cwd.pm in perl source tree. I checked the file and though I am not a perl expert\, the path for /usr/bin/pwd and /bin/pwd is checked explicitly here. And my PATH variable contains /usr/local/bin.

This is the code (beginning at line 211)​:

unless(defined &cwd) { # The pwd command is not available in some chroot(2)'ed environments if( $^O eq 'MacOS' || (defined $ENV{PATH} && grep { -x "$_/pwd" } split('​:'\, $ENV{PATH})) ) { *cwd = \&_backtick_pwd; ...

As an alternative\, you can use fastcwd() instead\, which on many systems use an cwd implementation which does not need external tools. I don't know how to use it. I am talking about the perl configuration script which uses Cwd​::cwd() and it was failing in my case. Anyway the problem is solved by providing a symlink of /usr/local/bin/pwd to /usr/bin/pwd.

perl -MCwd=fastcwd -e 'warn fastcwd'

or to still retain calling cwd()\, but using fastcwd() under the hood​:

perl -MCwd= -e '*cwd=\&Cwd​::fastcwd; warn cwd'

Regards\, Slaven

I reviewed this older ticket tonight. Slaven appears to have provided a reasonable response to the original poster's concerns. I am taking this ticket for the purpose of closing it in seven days\, unless someone else wants to take it over.

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @jkeenan

On Sun Feb 24 15​:52​:52 2013\, jkeenan wrote​:

I reviewed this older ticket tonight. Slaven appears to have provided a reasonable response to the original poster's concerns. I am taking this ticket for the purpose of closing it in seven days\, unless someone else wants to take it over.

Thank you very much. Jim Keenan

Closing as per schedule.

p5pRT commented 11 years ago

@jkeenan - Status changed from 'open' to 'rejected'