Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1433372AbdDYXHQ (ORCPT ); Tue, 25 Apr 2017 19:07:16 -0400 Received: from mail.kernel.org ([198.145.29.136]:54622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1433357AbdDYXHK (ORCPT ); Tue, 25 Apr 2017 19:07:10 -0400 Date: Tue, 25 Apr 2017 19:07:06 -0400 From: Steven Rostedt To: Federico Vaga Cc: LKML Subject: Re: [PATCH 4/5] trace-cmd: fix argument parsing minor BUG Message-ID: <20170425190706.4138fb8e@gandalf.local.home> In-Reply-To: <20170423102258.21609-5-federico.vaga@vaga.pv.it> References: <20170423102258.21609-1-federico.vaga@vaga.pv.it> <20170423102258.21609-5-federico.vaga@vaga.pv.it> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1193 Lines: 41 On Sun, 23 Apr 2017 12:22:57 +0200 Federico Vaga wrote: > For some reason the list command does not use anymore `getopt()` > to parse the arguments, instead it uses a custum implementation. > > During this change [5da0eff trace-cmd: Add regex for listing of events] > the variable `optind` has been forgotten. > > To reproduce the problem try to use invalid arguments. The application > will not report the correct invalid argument > > $ ./trace-cmd list -a > list: invalid option -- 'i' > > Signed-off-by: Federico Vaga > --- > trace-cmd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/trace-cmd.c b/trace-cmd.c > index 1a62faa..a05df92 100644 > --- a/trace-cmd.c > +++ b/trace-cmd.c > @@ -706,7 +706,7 @@ int main (int argc, char **argv) > break; > default: > fprintf(stderr, "list: invalid option -- '%c'\n", > - argv[optind][1]); > + argv[i][1]); Hmm, I had this fixed back in September. I haven't push in a long time. Well, I applied your other patches (Thanks!). I'm going to finally start updating trace-cmd this week. -- Steve > usage(argv); > } > }