Closed p5pRT closed 20 years ago
When building perl5.005_63 with shared lib support on OpenBSD/i386\, LD_LIBRARY_PATH gets set to "`pwd`:" when there is no existing LD_LIBRARY_PATH in the environment. This confuses the OpenBSD ld.so and thus miniperl is run with /usr/lib/libperl.so instead of the freshly built libperl.so. While I do think that OpenBSD's ld.so should behave reasonably in this case\, it also seems that having a NUL component in LD_LIBRARY_PATH is wrong too. It's not clear what this *should* mean. In sh\, an empty PATH element mean cwd so perhaps that would be reasonable behavior. However\, even if ld.so did behave that way it would still be undesirable. In short\, I think that ldlibpth in Makefile.SH should only append to LD_LIBRARY_PATH if LD_LIBRARY_PATH is already set\, else it should just set LD_LIBRARY_PATH. Unfortunately\, this is easier said than done due to use of eval. In this case it is easier to just strip off errant :'s. Here's a simple patch against perl5.005_63. You may choose to do something more elegant...
ld.so should behave reasonably in this case\, it also seems that having a NUL component in LD_LIBRARY_PATH is wrong too. It's not clear what this *should* mean. In sh\, an empty PATH element mean cwd so perhaps that would be reasonable behavior. However\, even if ld.so did behave that way it would still be undesirable.
POSIX 1003.1 says that open/opendir on a null must fail\, contrary to some existing practices\, but a fine idea nonetheless.
POSIX 1003.2 says that a null path component is considered the cwd.
I wonder whether this has anything to do with the icky problems I had getting Perl to make install on openbsd due to the netbsd-derived loader search bug that Sarathy sent a patch for.
Minor note: _64 just snuckered out the door.
--tom
In message \13497\.949524439@​chthon so spake Tom Christiansen (tchrist):
POSIX 1003.2 says that a null path component is considered the cwd.
Yup\, and I have a patch to the OpenBSD ld.so that makes it behave in that manner. Something should get committed in the next day or so. However\, other OS's may get bitten by this as well so I do think it is worth chopping off the extra ':' in Makefile.SH.
- todd
On Wed\, 2 Feb 2000\, Todd C. Miller wrote:
In message \13497\.949524439@​chthon so spake Tom Christiansen (tchrist):
POSIX 1003.2 says that a null path component is considered the cwd.
Yup\, and I have a patch to the OpenBSD ld.so that makes it behave in that manner. Something should get committed in the next day or so. However\, other OS's may get bitten by this as well so I do think it is worth chopping off the extra ':' in Makefile.SH.
I'd agree with Todd here. The cost of being defensive is zero for us (now that Todd's done the work and produced the patch).
Andy Dougherty doughera@lafayette.edu Dept. of Physics Lafayette College\, Easton PA 18042
On Wed\, 02 Feb 2000 13:42:59 MST\, "Todd C. Miller" wrote:
When building perl5.005_63 with shared lib support on OpenBSD/i386\, LD_LIBRARY_PATH gets set to "`pwd`:" when there is no existing LD_LIBRARY_PATH in the environment. This confuses the OpenBSD ld.so and thus miniperl is run with /usr/lib/libperl.so instead of the freshly built libperl.so. While I do think that OpenBSD's ld.so should behave reasonably in this case\, [...]
There's a OpenBSD-specific fix in v5.5.640 that might help here. Can you try that version? Thanks.
Sarathy gsar@ActiveState.com
In message \200002030321\.TAA25578@​maul\.activestate\.com so spake Gurusamy Sarathy (gsar):
There's a OpenBSD-specific fix in v5.5.640 that might help here. Can you try that version? Thanks.
That's a different bug\, for which I already committed your fix. :-) This one may hit FreeBSD and NetBSD a.out ld.so's too\, so here's the patch I did to fix the problem.
- todd
RCS file: /cvs/src/gnu/usr.bin/ld/shlib.c\,v retrieving revision 1.8 diff -u -r1.8 shlib.c --- shlib.c 2000/01/16 14:31:26 1.8 +++ shlib.c 2000/02/03 02:14:35 @@ -80\,7 +80\,10 @@ n_search_dirs++; search_dirs = (char **) xrealloc(search_dirs\, n_search_dirs * sizeof search_dirs[0]); - search_dirs[n_search_dirs - 1] = strdup(name); + if (*name == '\0') + search_dirs[n_search_dirs - 1] = strdup("."); + else + search_dirs[n_search_dirs - 1] = strdup(name); }
RCS file: /cvs/src/gnu/usr.bin/ld/rtld/rtld.c\,v retrieving revision 1.15 diff -u -r1.15 rtld.c --- rtld/rtld.c 2000/01/11 22:27:07 1.15 +++ rtld/rtld.c 2000/02/03 02:14:32 @@ -1309\,10 +1309\,12 @@ ipath ? ipath : "");
while ((cp = strsep(&dp\, ":")) != NULL) { - cp = findhint(name\, major\, minor\, cp); - if (cp) { - free(lpath); - return cp; + if (*cp) { + cp = findhint(name\, major\, minor\, cp); + if (cp) { + free(lpath); + return cp; + } } } free(lpath);
In message \13497\.949524439@​chthon so spake Tom Christiansen (tchrist):
POSIX 1003.2 says that a null path component is considered the cwd.
Yup\, and I have a patch to the OpenBSD ld.so that makes it behave in that manner. Something should get committed in the next day or so. However\, other OS's may get bitten by this as well so I do think it is worth chopping off the extra ':' in Makefile.SH.
FYI: 1003.2 was only referring to the shell's behavior on the bin PATH envariable\, not all possible pathish vars.
--tom
In message \18369\.949578546@​chthon so spake Tom Christiansen (tchrist):
FYI: 1003.2 was only referring to the shell's behavior on the bin PATH envariable\, not all possible pathish vars.
I understand that\, but I think it makes sense to emulate that behavior. There are two obvious ways to treat an empty element in LD_LIBRARY_PATH a) treat as '.' b) ignore it You could make a case for either one and I'm still a bit undecided which is best.
- todd
Migrated from rt.perl.org#2071 (status was 'resolved')
Searchable as RT2071$