All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Dmitri Seletski <drjoms@gmail.com>, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] "ip help" wrong output, exit code.
Date: Mon, 22 Jun 2026 17:44:54 +0100	[thread overview]
Message-ID: <20260622174454.576b3580@pumpkin> (raw)
In-Reply-To: <20260622075700.27806286@phoenix.local>

On Mon, 22 Jun 2026 07:57:00 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> On Sun, 21 Jun 2026 22:48:59 +0100
> Dmitri Seletski <drjoms@gmail.com> wrote:
> 
> > From 0805e07105cd15c5b94271a4706e50e3c65dbde5 Mon Sep 17 00:00:00 2001
> > From: Dmitri Seletski <drjoms@gmail.com>
> > Date: Sun, 21 Jun 2026 22:12:43 +0100
> > Subject: [PATCH iproute2-next]  "ip help" wrong output, exit code.
> > 
> > Changed output of "ip help" from standard error to standard output. And 
> > Exit is now 0 instead of -1. "ip help|grep bridge" - now gives bridge 
> > syntax instead of flooding user with everything from "ip help".
> > ---
> > ip/ip.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/ip/ip.c b/ip/ip.c
> > index e4b71bde..4627b61c 100644
> > --- a/ip/ip.c
> > +++ b/ip/ip.c
> > @@ -56,7 +56,7 @@ static void usage(void) __attribute__((noreturn));
> > 
> > static void usage(void)
> > {
> > -fprintf(stderr,
> > +fprintf(stdout,
> > "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
> > "       ip [ -force ] -batch filename\n"
> > "where  OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp 
> > | link |\n"
> > @@ -72,7 +72,7 @@ static void usage(void)
> > "                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] 
> > [filename] |\n"
> > "                    -rc[vbuf] [size] | -n[etns] name | -N[umeric] | 
> > -a[ll] |\n"
> > "                    -c[olor]}\n");
> > -exit(-1);
> > +exit(0);
> > }  
> 
> Your mailer damages white space.
> 

The output also needs to depend on whether these is a 'usage' error or
if 'help' is requested.
Code code is correct for the former - except it should do exit(1).

	David



  reply	other threads:[~2026-06-22 16:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-20  9:36 "ip help" output is an error Dmitri Seletski
2026-06-21 15:21 ` Stephen Hemminger
2026-06-21 21:51   ` Dmitri Seletski
2026-06-22  7:49   ` David Laight
2026-06-22 10:39     ` Dmitri Seletski
     [not found]   ` <069b13e1-f689-410b-bd40-b5e5831b67e7@gmail.com>
2026-06-22 14:57     ` [PATCH iproute2-next] "ip help" wrong output, exit code Stephen Hemminger
2026-06-22 16:44       ` David Laight [this message]
2026-06-22 17:47         ` Dmitri Seletski
  -- strict thread matches above, loose matches on Subject: below --
2026-06-21 21:56 Dmitri Seletski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260622174454.576b3580@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=drjoms@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.