[Bug 263086] ldconfig(8) behaviour doesn't match documentation

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 06 Apr 2022 12:52:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263086

            Bug ID: 263086
           Summary: ldconfig(8) behaviour doesn't match documentation
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: daniel_eisele@gmx.de

ldconfig(8) has a few cases of inconsistent/weird behavior. One problem
(ldconfig -v clears the whole linker search path) has already been fixed here:
https://cgit.freebsd.org/src/commit/sbin/ldconfig/ldconfig.c?id=3ede04c78c7c726ed79a39d22c65a58d0ecc5d00

However other problems remain:
 - The verbose flag (-v) mentioned in the man page doesn't do anything.
 - The flags -R and -m do exactly the same thing, which is not mentioned in the
   man page. Instead, these flags have different descriptions leaving the user
   wondering about the difference.
 - The man page states that -R is the default action when no options are given,
   which isn't really true. When only directories/files are given (without -R
   or -m), then the search path will be overwritten instead of appended to.
 - Running ldconfig without parameters does a rescan with no output. Is this
   the desired behaviour? Maybe justread (-r) would be better in this case.
 - Clearing the entire search path doesn't seem to be possible anymore, because
   an empty directory list forces rescan mode.
 - The flag -32 is incompatible with -f, which is not stated in the man page.

I think the solution depends on how much we are willing to change the api.
Apart from documenting all of the above in the man page, these might be a few
options:
 - Removing -v from the man page.
 - Removing -R or -m from the man page as they are the same.
 - Adding an explicit flag for overwriting, which would avoid confusion and
   allow overwriting with an empty list. To me, this seems like the cleanest
   solution going forward, but would change the api.
 - Stating in the man page that the default action is actually overwrite when
   directories are given or
 - just removing the default and requiring the user to specify explicitly what
   s/he wants. This would avoid confusion with different defaults depending on
   whether the directory list is empty or not.

Also as a side note, it might be a good idea to explicitly initialize the
global boolean insecure to false in the main function.

-- 
You are receiving this mail because:
You are the assignee for the bug.