NetBSD Problem Report #41994

From dholland@eecs.harvard.edu  Sat Sep  5 02:35:55 2009
Return-Path: <dholland@eecs.harvard.edu>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 88CE763BC1D
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  5 Sep 2009 02:35:55 +0000 (UTC)
Message-Id: <20090905023534.01B251012B@tanaqui.eecs.harvard.edu>
Date: Fri,  4 Sep 2009 22:35:33 -0400 (EDT)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: ldd should have an -o option like nm
X-Send-Pr-Version: 3.95

>Number:         41994
>Category:       bin
>Synopsis:       ldd should have an -o option like nm
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 05 02:40:00 +0000 2009
>Closed-Date:    Mon Sep 07 18:47:11 +0000 2009
>Last-Modified:  Mon Sep 07 18:47:11 +0000 2009
>Originator:     David A. Holland
>Release:        NetBSD 5.99.15 (20090831)
>Organization:
>Environment:
System: NetBSD tanaqui 5.99.15 NetBSD 5.99.15 (TANAQUI) #29: Thu Sep 3 18:23:41 EDT 2009 dholland@tanaqui:/usr/src/sys/arch/i386/compile/TANAQUI i386
Architecture: i386
Machine: i386
>Description:

ldd should have an -o option like nm's -o option. That way one could
do e.g. ldd -o /usr/pkg/lib/lib*.so | grep "not found" to easily
identify busted libs, instead of various laborious alternatives.

>How-To-Repeat:

# ldd /usr/pkg/lib/lib*.so | grep 'not found'
        -lXp.7 => not found
        -lXp.7 => not found
        -lXp.7 => not found
        -lXp.7 => not found
        -lXp.7 => not found
# 

>Fix:

mrg said I should file this and he might look into it.

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: matthew green <mrg@netbsd.org>
Subject: Re: bin/41994: ldd should have an -o option like nm
Date: Mon, 7 Sep 2009 04:52:11 +0000

 On Sat, Sep 05, 2009 at 02:40:00AM +0000, dholland@eecs.harvard.edu wrote:
  > ldd should have an -o option like nm's -o option. That way one could
  > do e.g. ldd -o /usr/pkg/lib/lib*.so | grep "not found" to easily
  > identify busted libs, instead of various laborious alternatives.

 Candidate patch based on a suggestion by jmcneill:

 Index: ldd.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/ldd/ldd.c,v
 retrieving revision 1.9
 diff -u -p -r1.9 ldd.c
 --- ldd.c	22 Aug 2009 06:52:16 -0000	1.9
 +++ ldd.c	7 Sep 2009 04:50:20 -0000
 @@ -114,13 +114,13 @@ usage(void)
  int
  main(int argc, char **argv)
  {
 -	char *fmt1 = NULL, *fmt2 = NULL;
 +	const char *fmt1 = NULL, *fmt2 = NULL;
  	int c;

  #ifdef DEBUG
  	debug = 1;
  #endif
 -	while ((c = getopt(argc, argv, "f:")) != -1) {
 +	while ((c = getopt(argc, argv, "f:o")) != -1) {
  		switch (c) {
  		case 'f':
  			if (fmt1) {
 @@ -130,6 +130,11 @@ main(int argc, char **argv)
  			} else
  				fmt1 = optarg;
  			break;
 +		case 'o':
 +			if (fmt1 || fmt2)
 +				errx(1, "Cannot use -o and -f together");
 +			fmt1 = "%a:-l%o.%m => %p\n";
 +			break;
  		default:
  			usage();
  			/*NOTREACHED*/

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41994 CVS commit: src/usr.bin/ldd
Date: Mon, 7 Sep 2009 17:56:52 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Mon Sep  7 17:56:52 UTC 2009

 Modified Files:
 	src/usr.bin/ldd: ldd.1 ldd.c

 Log Message:
 Add an -o option that behaves like nm -o. Implementation from a suggestion
 by jmcneill (thanks!); ok mrg. Closes PR 41994.


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/usr.bin/ldd/ldd.1
 cvs rdiff -u -r1.9 -r1.10 src/usr.bin/ldd/ldd.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Sep 2009 18:47:11 +0000
State-Changed-Why:
fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.