* Re: [PATCH] fix unterminated sed cmd in export_report.pl
[not found] <1305064543-7401-1-git-send-email-jim.cromie@gmail.com>
@ 2011-05-11 9:27 ` Jiri Kosina
2011-05-11 21:16 ` Arnaud Lacombe
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Kosina @ 2011-05-11 9:27 UTC (permalink / raw)
To: Jim Cromie; +Cc: Michal Marek, linux-kbuild
On Tue, 10 May 2011, jim.cromie@gmail.com wrote:
> From: Jim Cromie <jim.cromie@gmail.com>
>
> fix following err by escaping end-of-line $ in regex.
> perl /home/jimc/projects/lx/linux-2.6/scripts/export_report.pl > /dev/null
> sed: -e expression #1, char 5: unterminated `s' command
> sh: .mod.c/: not found
>
> without this fix, SECTION 2 of report is empty.
>
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> ---
> scripts/export_report.pl | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/export_report.pl b/scripts/export_report.pl
> index 04dce7c..91fa5a2 100644
> --- a/scripts/export_report.pl
> +++ b/scripts/export_report.pl
> @@ -50,7 +50,7 @@ sub usage {
>
> sub collectcfiles {
> my @file
> - = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
> + = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko\$/.mod.c/`;
> chomp @file;
> return @file;
> }
Thanks for the fix, Jim.
Adding Michal and linux-kbuild@, this should rather go in through his
tree.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fix unterminated sed cmd in export_report.pl
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
0 siblings, 1 reply; 5+ messages in thread
From: Arnaud Lacombe @ 2011-05-11 21:16 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Jim Cromie, Michal Marek, linux-kbuild
Hi,
On Wed, May 11, 2011 at 5:27 AM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Tue, 10 May 2011, jim.cromie@gmail.com wrote:
>
>> From: Jim Cromie <jim.cromie@gmail.com>
>>
>> fix following err by escaping end-of-line $ in regex.
>> perl /home/jimc/projects/lx/linux-2.6/scripts/export_report.pl > /dev/null
>> sed: -e expression #1, char 5: unterminated `s' command
>> sh: .mod.c/: not found
>>
>> without this fix, SECTION 2 of report is empty.
>>
>> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
>> ---
>> scripts/export_report.pl | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/scripts/export_report.pl b/scripts/export_report.pl
>> index 04dce7c..91fa5a2 100644
>> --- a/scripts/export_report.pl
>> +++ b/scripts/export_report.pl
>> @@ -50,7 +50,7 @@ sub usage {
>>
>> sub collectcfiles {
>> my @file
>> - = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
>> + = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko\$/.mod.c/`;
This is bogus. the first \ is still eaten by the shell. All what
sed(1) will see is the '.'.
Btw, that's an awful lot of command to do a simple task. grep(1) and
cat(1) can be done within sed(1), so I guess the patch should looks
like:
- = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
+ = `sed '/\.ko$/!d; s/\.ko$/.mod.c/' .tmp_versions/*.mod`;
[not tested]
- Arnaud
>> chomp @file;
>> return @file;
>> }
>
> Thanks for the fix, Jim.
>
> Adding Michal and linux-kbuild@, this should rather go in through his
> tree.
>
> --
> Jiri Kosina
> SUSE Labs
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fix unterminated sed cmd in export_report.pl
2011-05-11 21:16 ` Arnaud Lacombe
@ 2011-05-11 21:26 ` Arnaud Lacombe
2011-05-11 22:26 ` Jim Cromie
0 siblings, 1 reply; 5+ messages in thread
From: Arnaud Lacombe @ 2011-05-11 21:26 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Jim Cromie, Michal Marek, linux-kbuild
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fix unterminated sed cmd in export_report.pl
2011-05-11 21:26 ` Arnaud Lacombe
@ 2011-05-11 22:26 ` Jim Cromie
2011-05-11 22:39 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: Jim Cromie @ 2011-05-11 22:26 UTC (permalink / raw)
To: Arnaud Lacombe; +Cc: Jiri Kosina, Michal Marek, linux-kbuild, shemminger
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.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fix unterminated sed cmd in export_report.pl
2011-05-11 22:26 ` Jim Cromie
@ 2011-05-11 22:39 ` Stephen Hemminger
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2011-05-11 22:39 UTC (permalink / raw)
To: Jim Cromie; +Cc: Arnaud Lacombe, Jiri Kosina, Michal Marek, linux-kbuild
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-11 22:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox