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)
Fri, May 3, 9:49 PM
Unknown Object (File)
Mon, Apr 29, 2:02 AM
Unknown Object (File)
Mon, Apr 15, 6:22 PM
Unknown Object (File)
Mon, Apr 15, 6:22 PM
Unknown Object (File)
Mon, Apr 15, 6:21 PM
Unknown Object (File)
Mon, Apr 15, 6:21 PM
Unknown Object (File)
Mon, Apr 15, 2:02 PM
Unknown Object (File)
Sun, Apr 14, 5:33 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