public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jim Cromie <jim.cromie@gmail.com>
Cc: Arnaud Lacombe <lacombar@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>, Michal Marek <mmarek@suse.cz>,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] fix unterminated sed cmd in export_report.pl
Date: Wed, 11 May 2011 15:39:38 -0700	[thread overview]
Message-ID: <20110511153938.2c441429@nehalam> (raw)
In-Reply-To: <BANLkTimxtJeYMxnaA4Ovz0XOAZJKvB+yzA@mail.gmail.com>

On Wed, 11 May 2011 16:26:23 -0600
Jim Cromie <jim.cromie@gmail.com> wrote:

> On Wed, May 11, 2011 at 3:26 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> > Hi
> >
> > On Wed, May 11, 2011 at 5:16 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> >> -     = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
> >> +     = `sed '/\.ko$/!d; s/\.ko$/.mod.c/' .tmp_versions/*.mod`;
> >>
> > Actually, my perl-fuu is not what it used to be, that one should be better:
> >
> > +     = `sed '/\\.ko\$/!d; s/\\.ko\$/.mod.c/' .tmp_versions/*.mod`;
> >
> > The backslash before the '.' should be escaped as well to be passed to
> > sed(1). I'll give it a try to confirm.
> >
> >  - Arnaud
> >
> 
> 
> I agree w your complicated-construct sentiment re the cmd-pipeline.
> 
> this used to be done with a grep,
> undone by
> 
> 
> commit 91416cfdf98bdbc828fd3e5ca7208beba5979d63
> Author: Stephen Hemminger <shemminger@vyatta.com>
> Date:   Mon Feb 22 15:17:22 2010 -0800
> 
>     export_report: fix perl warnings
> 
>     Use local file handles, use three argument open.
>     Don't modify arguments in perl grep (use sed instead)
> 
>     Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>     Acked-by: WANG Cong <amwang@redhat.com>
>     Cc: Michal Marek <mmarek@suse.cz>
>     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>     Signed-off-by: Michal Marek <mmarek@suse.cz>
> 
> diff --git a/scripts/export_report.pl b/scripts/export_report.pl
> index 705b5ba..04dce7c 100644
> --- a/scripts/export_report.pl
> +++ b/scripts/export_report.pl
> @@ -49,10 +49,10 @@ sub usage {
>  }
> 
>  sub collectcfiles {
> -        my @file = `cat .tmp_versions/*.mod | grep '.*\.ko\$'`;
> -        @file = grep {s/\.ko/.mod.c/} @file;
> -       chomp @file;
> -        return @file;
> +    my @file
> +       = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
> +    chomp @file;
> +    return @file;
>  }
> 
> 
> the backslash escape noise in the subshell pipeline can be avoided
> by returning to the grep, with less process spawning too
> (not that this is executed often)
> I'll try that.

Even better would be doing the work in perl rather than using
shell for this.

      reply	other threads:[~2011-05-11 22:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1305064543-7401-1-git-send-email-jim.cromie@gmail.com>
2011-05-11  9:27 ` [PATCH] fix unterminated sed cmd in export_report.pl Jiri Kosina
2011-05-11 21:16   ` Arnaud Lacombe
2011-05-11 21:26     ` Arnaud Lacombe
2011-05-11 22:26       ` Jim Cromie
2011-05-11 22:39         ` Stephen Hemminger [this message]

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=20110511153938.2c441429@nehalam \
    --to=shemminger@vyatta.com \
    --cc=jim.cromie@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox