Index | Thread | Search

From:
Alexander Farber <alexander.farber@gmail.com>
Subject:
Re: ldd(1): remove unimplemented -x option
To:
tech@openbsd.org
Date:
Tue, 6 Jan 2026 20:34:20 +0100

Download raw body.

Thread
Hi Alexander

On Tue, Jan 6, 2026 at 7:18 PM Alexander Hall <alexander@beard.se> wrote:

> On January 6, 2026 4:13:12 PM GMT+01:00, Alexander Farber <
> alexander.farber@gmail.com> wrote:
> >
> >ldd(1) accepts -x but immediately errors with "not yet implemented".
> >This stub has been in place for over 10 years and neither FreeBSD nor
> >NetBSD have this option. The man page already has -x commented out.
> >This removes the dead code.
>
> This would break `ldd -- progname`, no? So the code removed is not quite
> dead.


You're right, thanks for catching that. Here's a revised diff:

Index: libexec/ld.so/ldd/ldd.c
===================================================================
RCS file: /cvs/src/libexec/ld.so/ldd/ldd.c,v
retrieving revision 1.26
diff -u -r1.26 ldd.c
--- libexec/ld.so/ldd/ldd.c 15 Aug 2023 13:50:53 -0000 1.26
+++ libexec/ld.so/ldd/ldd.c 6 Jan 2026 19:33:42 -0000
@@ -46,25 +46,18 @@
 int
 main(int argc, char **argv)
 {
- int c, xflag, ret;
+ int c, ret;

  if (pledge("stdio rpath proc exec prot_exec", NULL) == -1)
  err(1, "pledge");

- xflag = 0;
- while ((c = getopt(argc, argv, "x")) != -1) {
+ while ((c = getopt(argc, argv, "")) != -1) {
  switch (c) {
- case 'x':
- xflag = 1;
- break;
  default:
  usage();
  /*NOTREACHED*/
  }
  }
-
- if (xflag)
- errx(1, "-x not yet implemented");

  argc -= optind;
  argv += optind;