Skip Menu |

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 29050
Status: resolved
Priority: 0/
Queue: PAR-Packer

Owner: Nobody in particular
Requestors: stanton [...]

Bug Information
Severity: Important
Broken in: 0.976
Fixed in: (no value)

Subject: stand alone binaries fail to resolve cwd properly
distribution: cpan PAR::Packer-0.976 perl version: This is perl, v5.8.8 built for PA-RISC2.0 os version: HP-UX hpux-1 B.11.11 U 9000/800 1348702983 unlimited-user license The attached makefile demonstrates the problem. When you attempt to run 'junk' from the subdirectory, you will get errors similar to the following: IO error: Can't open /net/filer/homes/stanton/tmp/../junk : No such file or directory at -e line 898 IO error: Can't open /net/filer/homes/stanton/tmp/../junk : No such file or directory at -e line 898 Cannot find '/net/filer/homes/stanton/tmp/../junk': No such file or directory at /opt/perl_5.8.8/lib/site_perl/5.8.8/ line 585. It turns out the problem is caused by a bad PWD environment variable. perl's chdir does not update PWD properly, so the process is invoked with a PWD that refers to the starting directory, not 'subdir'. The subprocess invocation works if you invoke it via sh -c, because sh correctly updates PWD. The attached patch file appears to resolve the problem by using Cwd, Win32::GetCwd, or `pwd` to determine the correct value.
text/x-diff 782b
--- /home/stanton/tmp/PAR-Packer-0.976/script/ 2007-07-13 09:39:25.000000000 -0700 +++ script/ 2007-08-28 14:09:20.587164000 -0700 @@ -688,6 +688,7 @@ require PAR::Heavy; require PAR::Dist; require PAR::Filter::PodStrip; + eval { require Cwd }; eval { require Win32 }; eval { require Scalar::Util }; eval { require Archive::Unzip::Burst }; @@ -825,7 +826,7 @@ } # XXX - hack to make PWD work - my $pwd = (defined &Win32::GetCwd) ? Win32::GetCwd() : $ENV{PWD}; - $pwd = `pwd` if !defined $pwd; + my $pwd = (defined &Cwd::getcwd) ? Cwd::getcwd() + : ((defined &Win32::GetCwd) ? Win32::GetCwd() : `pwd`); chomp($pwd); $progname =~ s/^(?=\.\.?\Q$Config{_delim}\E)/$pwd$Config{_delim}/;
Subject: Makefile
Download Makefile
application/octet-stream 123b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 214b
Hi, thanks for the great bug report complete with example that simplifies reproduction and a patch. If only every ticket was that easy to resolve... Patch applied! Thank your for your help! Best regards, Steffen

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to