Re: [PATCH] fix unterminated sed cmd in export_report.pl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> On Wed, May 11, 2011 at 3:26 PM, Arnaud Lacombe <lacombar@xxxxxxxxx> wrote:
> > Hi
> >
> > On Wed, May 11, 2011 at 5:16 PM, Arnaud Lacombe <lacombar@xxxxxxxxx> 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@xxxxxxxxxx>
> 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@xxxxxxxxxx>
>     Acked-by: WANG Cong <amwang@xxxxxxxxxx>
>     Cc: Michal Marek <mmarek@xxxxxxx>
>     Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>     Signed-off-by: Michal Marek <mmarek@xxxxxxx>
> 
> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux