From owner-freebsd-questions@FreeBSD.ORG Thu Oct 11 05:26:42 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E345016A41A for ; Thu, 11 Oct 2007 05:26:41 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id 761CE13C45D for ; Thu, 11 Oct 2007 05:26:41 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-253-31-60.bredband.comhem.se ([83.253.31.60]:55013 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1IfqZE-0004mp-4U for questions@freebsd.org; Thu, 11 Oct 2007 07:26:40 +0200 Received: (qmail 52789 invoked from network); 11 Oct 2007 07:26:37 +0200 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 11 Oct 2007 07:26:37 +0200 Received: (qmail 2891 invoked by uid 1001); 11 Oct 2007 07:26:37 +0200 Date: Thu, 11 Oct 2007 07:26:37 +0200 From: Erik Trulsson To: Jonathan Noack Message-ID: <20071011052637.GA2827@owl.midgard.homeip.net> Mail-Followup-To: Jonathan Noack , questions@freebsd.org References: <64910.70.130.237.37.1192052489.squirrel@www.noacks.org> <20071010223442.GA99741@owl.midgard.homeip.net> <1526.75.206.130.128.1192076869.squirrel@www.noacks.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526.75.206.130.128.1192076869.squirrel@www.noacks.org> User-Agent: Mutt/1.5.16 (2007-06-09) X-Originating-IP: 83.253.31.60 X-Scan-Result: No virus found in message 1IfqZE-0004mp-4U. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1IfqZE-0004mp-4U 35b9fd576ebbd79a55bc324b62431932 Cc: questions@freebsd.org Subject: Re: shooting oneself in the foot with "ldconfig -v" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2007 05:26:42 -0000 On Thu, Oct 11, 2007 at 12:27:49AM -0400, Jonathan Noack wrote: > On Wed, October 10, 2007 18:34, Erik Trulsson wrote: > > On Wed, Oct 10, 2007 at 05:41:29PM -0400, Jonathan Noack wrote: > >> Hey folks, > >> I'm running 6.2-p8 and was trying to clean up my "portsclean -L" output > >> today. It was reporting tons of duplicate libraries in /usr/X11R6 and > >> /usr/local even though X11R6 is an alias to /usr/local. I tracked the > >> problem to portclean's use of `ldconfig -elf -r` which was reporting > >> directories and libraries in /usr/X11R6. I read the ldconfig manpage in > >> an attempt to understand more and saw this line: > >> -v Switch on verbose mode. > >> > >> I told myself, "Self, the '-v' option may allow you to determine what's > >> going on. It can't help knowing more!" Alas, the "-v" option doesn't > >> behave as advertised. Instead it clears the shared library cache > >> (reference: http://www.parsed.org/tip/231/). An empty shared library > >> cache means all dynamically-linked programs fail. This has the > >> wonderful > >> side-effect of preventing me from logging into the box to fix it (I > >> logged > >> off before I figured this out). "Reboot and all will be well," you say? > >> Yes, on boot /etc/rc.d/ldconfig is run and it builds the shared library > >> cache. Unfortunately, the box is 1,000 miles away in my apartment. :( > >> > >> This brings me to the question: > >> Is the "-v" option broken or is the documentation out of date? > > > > No, the '-v' option behaves as documented and is not broken. > > It is, however, intended to be used in conjunction with some other option. > > > > You see, running ldconfig(8) without any arguments at all will clear the > > shared library cache. (Actually it will replace the cache with the files > > found in the specified directories, but since none were specified...) > > Adding '-v' will not change what ldconfig does, except possibly letting > > it be a bit more verbose about what happens. > > Not according to ldconfig(8); running ldconfig without any arguments > implies "-R": > -R Rescan the previously configured directories. This opens the > previous hints file and fetches the directory list from the > header. Any additional pathnames on the command line are also > processed. This is the default action when no parameters are > given. Yes, you are right. > > The previously configured directory list was fully populated, so > effectively there should have been no change as the previously configured > directories were untouched and I specified no additional pathnames. > > > ldconfig is behaving as designed and documented, so the bug, such as it > > is, > > is in the design of ldconfig that lets you screw up the machine by simply > > running ldconfig without any option. > > Are you saying that by specifying "-v" I no longer satisfied the "no > parameters are given" clause and ended up in a default place in the logic? That wasn't actually what I was saying, but after checking the source code it turns out you are right and that is exactly what happens. > I could see how an unconditional shared library cache clear coupled with > no additional action (no matching actions to pursue) could get me the > results I got. If so that behavior is really confusing. IMHO a verbose > switch shouldn't change behavior; it should just spam the console a lot. True. -- Erik Trulsson ertr1013@student.uu.se