Page MenuHomeFreeBSD

rc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_paths
ClosedPublic

Authored by john_saltant.com on Nov 12 2023, 10:57 PM.
Tags
Referenced Files
Unknown Object (File)
Sun, Nov 24, 8:43 PM
Unknown Object (File)
Mon, Nov 18, 2:34 AM
Unknown Object (File)
Mon, Nov 18, 2:25 AM
Unknown Object (File)
Mon, Nov 11, 4:37 PM
Unknown Object (File)
Tue, Nov 5, 11:42 PM
Unknown Object (File)
Tue, Nov 5, 11:42 PM
Unknown Object (File)
Tue, Nov 5, 11:42 PM
Unknown Object (File)
Tue, Nov 5, 11:28 PM
Subscribers

Details

Summary

Ensure that ldconfig-managed elf and elf32 hints always include the standard library paths that are known independently to rtld.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

libexec/rc/rc.d/ldconfig
6

I suppose FILESYSTEMS makes /usr/bin available, am I right?

25

I prefer the $() syntax, and I see no reason not to use it there. machine_arch below is assigned this way.

45

Besides checking the arch, we need to check that /libexec/ld-elf32.so.1 is present and is executable. System might have been installed without compat32 userspace tools.

libexec/rc/rc.d/ldconfig
6

FILESYSTEMS is a "dummy" dependency that requires root, mountcritlocal, cleanvar, and tmp. The rc.d scripts that explicitly invoke tools in /usr/bin (in main as of just now) are bluetooth, iscsictl, jail, opensm, sendmail, and sshd. Four of the six also REQUIRE: FILESYSTEMS, and no other REQUIRE target is at least as common within that subset. mountcritlocal mounts everything except (nominally) NFS and SMB. Without further analysis/testing, evidence implies that /usr/bin is available to the ldconfig script.

25

Four existing assignments use backticks (_files and ldconfig_paths in the initial loop, and _files_ and ldconfig32_paths in the "64" case). One existing assignment uses $(). I will be glad to use which ever style you think is best, and would appreciate any insight about what underlies each style and your preference.

libexec/rc/rc.d/ldconfig
25

$() is better than backticks because it allows to clearly parse the nesting, and clearly see the missed delimiter. Single \` could mean either missed starting backtick, or missed closed backtick. Also backticks cannot nest.

I believe this was the reason why ksh added $().

Incorporated feedback.

  • $() instead of backticks
  • Test for presence and executability of ld-elf32.so.1

Please send me the git-formatted patch, with the metadata filled in. Most important, please set the author field to appropriate name/email.

This revision is now accepted and ready to land.Nov 13 2023, 3:00 PM