Page MenuHomeFreeBSD

ldconfig(8): check for no-args command line after options are parsed

Authored by kib on Fri, Nov 19, 4:20 AM.


Default action for ldconfig is specified as -R AKA 'append', and for
no-args (without options changing default actions), ldconfig should
append empty list of directories to current list.  But because the check
was done before options were parsed out, presence of any option turned
off default rescan.

As result, innocently-looked commands like `ldconfig -v' were interpreted
as setting directory hints list to one specified on the command line,
i.e. empty.

Reported by:

Other changes

ldconfig: use libexec/rtld-elf/rtld_paths.h

instead of duplicating definitions using slighly different macro names.
rtld_paths.h: Provide _PATH_ELF32_HINTS string, unconditionally
ldconfig: start of cleanup

Use bool.
Use local variables instead of static.
Remove non-functional debugging override of hints file path.
Use explicit exit() instead of return from main.
Minor style tweaks.
ldconfig(8): nostd/-s does nothing

Remove the option from man page and summary.  Silently ignore it when
parsing command line for backward compatibility.

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib requested review of this revision.Fri, Nov 19, 4:20 AM
kib edited the summary of this revision. (Show Details)

Remove -s

I confirm, this neutralizes ldconfig -v (no paths) in meson-0.60.1. Tested inside 13.0 amd64 jail after applying a19e14ca2d36 and 33dba3bb0ec2 to fix merge conflicts.

Steps to reproduce:

$ pkg install meson git
$ git clone
$ meson setup libxcvt_build libxcvt
$ meson compile -C libxcvt_build
$ su root -c 'meson install -C libxcvt_build'

Previously it failed with

$ meson Shared object "" not found, required by "python3.8"
$ git Shared object "" not found, required by "git"

but now works fine with

$ meson

ERROR: Must specify at least one directory name.
$ git
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--super-prefix=<path>] [--config-env=<name>=<envvar>]
           <command> [<args>]
emaste added inline comments.

We could probably just delete this comment now


argc == optind is maybe a tiny bit confusing, we could perhaps do if (argc == optind) rescan = true; along with a comment to make it explicit? But I'm fine with this if you think that's too much.

This revision is now accepted and ready to land.Wed, Nov 24, 8:28 PM

Remove a.out comment.
Set rescan to true explicitly.

This revision now requires review to proceed.Wed, Nov 24, 8:49 PM
kib marked 2 inline comments as done.Wed, Nov 24, 8:50 PM
This revision is now accepted and ready to land.Wed, Nov 24, 8:52 PM