Bug 189911

Summary: [rtld] [patch] LD_LIBMAP has no effect on rtld
Product: Base System Reporter: wjenkner
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: kib
Priority: Normal Keywords: patch
Version: 10.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

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
well.

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
/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
[ls]
libncurses.so.8 libncurses.so.5
$ 

we get

$ ldd /bin/ls
/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
/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
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:40:56 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>