Subject: | t/info.t fails if non-absolute path for perl interp |
Date: | Mon, 09 Jan 2012 16:46:13 -0500 |
To: | bug-Tcl [...] rt.cpan.org |
From: | "Daniel Macks" <dmacks [...] netspace.org> |
Packaging Tcl-1.02 for fink (OS X package-manager), I get a self-test failure. Note that I call perl as "perl5.10.0" to make sure I get this version rather than other perl-versions I have. It happens to be in /usr/bin (vendor-supplied perl) for me but I'm not calling it that so that my build recipe is portable to systems that have that interp somewhere earlier in PATH via a third party supplier. I'm also using fink's own tcl specifically rather than stubs (different build options than OS X's own and Tcl's darwin framework that would be autoloaded):
ARCHFLAGS="" /usr/bin/arch -i386 perl5.10.0 Makefile.PL PERL="/usr/bin/arch -i386 perl5.10.0" PREFIX=/sw INSTALLPRIVLIB=/sw/lib/perl5/5.10.0 INSTALLARCHLIB=/sw/lib/perl5/5.10.0/darwin-thread-multi-2level INSTALLSITELIB=/sw/lib/perl5/5.10.0 INSTALLSITEARCH=/sw/lib/perl5/5.10.0/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 --tclconfig=/sw/lib/tclConfig.sh --no-usestubsUsing config data in /sw/lib/tclConfig.sh
LIBS = -L/sw/lib -ltcl8.4
INC = -I/sw/include
DEFINE =
[rest of config and 'make' process is uneventful]
make check
PERL_DL_NONLAZY=1 /usr/bin/arch -i386 perl5.10.0 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
[...]
t/info.t ........... 1/6 # Test 2 got: "/usr/bin/perl5.10.0" (t/info.t at line 20)
# Expected: "perl5.10.0"
# t/info.t line 20 is: ok(canonpath($tcl->Eval("info nameofexecutable")), canonpath($^X));
tcl's "info nameofexecutable" appears to be finding the command-line program-name in PATH (consistent with its documentation) whereas perl's $^X just uses whatever was used on the command-line (argv[0], consistent with *its* documentation).
File::Which seems like the solution to use here--it's perl's "find in PATH" function. Seems to fail if passed an absolute path, so its use whould need to be controlled by an explicit test for whether $^X is relative.
The attached patch is what fink is using, works for me in the actual packaging and also if I do use the abs path to the interp.
dan
--
Daniel Macks
dmacks@netspace.org
Message body is not shown because sender requested not to inline it.