Bug 189911 - [rtld] [patch] LD_LIBMAP has no effect on rtld
Summary: [rtld] [patch] LD_LIBMAP has no effect on rtld
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2014-05-18 15:10 UTC by wjenkner
Modified: 2017-12-31 22:23 UTC (History)
1 user (show)

See Also:

file.diff (645 bytes, patch)
2014-05-18 15:10 UTC, wjenkner
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description wjenkner 2014-05-18 15:10:00 UTC
Mapping a shared library to another - existing or not existing - library
via LD_LIBMAP, as described in rtld(1), has no effect (but it does work
when done in libmap.conf).

Fix: The following patch is against 10-STABLE, but should apply to HEAD as

It seems that, due to an oversight in HEAD r232862, lmc_parse() was
passed wrong arguments in the libmap_override case.
How-To-Repeat: $ LD_LIBMAP=libncurses.so.8=libncurses.so.5 ldd /bin/ls
	libutil.so.9 => /lib/libutil.so.9 (0x800823000)
	libncurses.so.8 => /lib/libncurses.so.8 (0x800a35000)
	libc.so.7 => /lib/libc.so.7 (0x800c82000)

On the other hand, with

$ cat /etc/libmap.conf
libncurses.so.8 libncurses.so.5

we get

$ ldd /bin/ls
	libutil.so.9 => /lib/libutil.so.9 (0x800823000)
	libncurses.so.8 => /usr/local/lib/libncurses.so.5 (0x800a35000)
	libc.so.7 => /lib/libc.so.7 (0x800c53000)
	libtinfo.so.5.9 => /usr/local/lib/libtinfo.so.5.9 (0x800ffa000)

if  libncurses.so.5 from the devel/ncurses port exists.

Otherwise, we get

$ ldd /bin/ls
	libutil.so.9 => /lib/libutil.so.9 (0x800823000)
	libncurses.so.8 => not found (0)
	libc.so.7 => /lib/libc.so.7 (0x800a35000)
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:34 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped