Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory-handling failure with absolute paths #36

Open
dmacks opened this issue Sep 16, 2023 · 0 comments
Open

Directory-handling failure with absolute paths #36

dmacks opened this issue Sep 16, 2023 · 0 comments

Comments

@dmacks
Copy link

dmacks commented Sep 16, 2023

After upgrading my ExtUtils::Install from 2.18 to 2.22, 'make install' started failing for various other packages. For example, when the fink tries to install Locale-gettext-1.07 to the staging directory:

make install PREFIX=/sw INSTALLPRIVLIB=/sw/lib/perl5/5.18.2 INSTALLARCHLIB=/sw/lib/perl5/5.18.2/darwin-thread-multi-2level INSTALLSITELIB=/sw/lib/perl5/5.18.2 INSTALLSITEARCH=/sw/lib/perl5/5.18.2/darwin-thread-multi-2level INSTALLMAN1DIR=/sw/share/man/man1 INSTALLMAN3DIR=/sw/share/man/man3 INSTALLSITEMAN1DIR=/sw/share/man/man1 INSTALLSITEMAN3DIR=/sw/share/man/man3 INSTALLBIN=/sw/bin INSTALLSITEBIN=/sw/bin INSTALLSCRIPT=/sw/bin INSTALLSITESCRIPT=/sw/bin DESTDIR=/sw/build.build/root-locale-gettext-pm5182-1.07-1
"/usr/bin/arch" -x86_64 perl5.18 -MExtUtils::Command::MM -e 'cp_nonempty' -- gettext.bs /sw/build.build/locale-gettext-pm5182-1.07-1/Locale-gettext-1.07/blib/arch/auto/Locale/gettext/gettext.bs 644
Manifying 1 pod document
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Couldn't chdir to '/sw/build.build/locale-gettext-pm5182-1.07-1/Locale-gettext-1.07//sw/build.build/locale-gettext-pm5182-1.07-1/Locale-gettext-1.07/blib/arch/auto/Locale/gettext': No such file or directory
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 at /System/Library/Perl/5.18/File/Find.pm line 790.
make: *** [pure_site_install] Error 2

I narrowed it down to a regression in 2.18 -> 2.20, where the failure is triggered by a change in how an absolute path is handled. Notice the error message has a double-slash in the middle and then a full path beyond it. The intent is surely what follows that to be an absolute path, not a relative path to what comes before it.

The specific code change that triggers it is around line 753 in Install.pm, in code that is commented "the target is relative". That's clearly an invalid assumption here, and it's not surprising that:

my $save_cwd = File::Spec->catfile($cwd, $sourcedir);
_chdir($cwd);
...
_chdir($save_cwd);

gives this wrong result when $sourcedir is absolute. The easy solution is to only prepend $cwd if $sourcedir is relative:

-            my $save_cwd = File::Spec->catfile($cwd, $sourcedir);
+            my $save_cwd = File::Spec->file_name_is_absolute($sourcedir)
+			? $sourcedir
+			: File::Spec->catfile($cwd, $sourcedir);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant