* [PATCH] Minor fix for patchlets which modify multiple projects
@ 2004-05-12 19:04 Brad Fisher
2004-05-13 3:02 ` Patrick McHardy
2004-05-14 8:32 ` Jozsef Kadlecsik
0 siblings, 2 replies; 5+ messages in thread
From: Brad Fisher @ 2004-05-12 19:04 UTC (permalink / raw)
To: netfilter-devel
While converting a match of mine to pom-ng, I noticed that
apply_patchlet doesn't properly determine the list of projects which are
affected by the patchlet. In my case, the patch would be incompletely
applied - the kernel space part would apply, but the userspace part
would not. The following patch (agains pom-ng cvs) should fix this.
-Brad Fisher
Index: Netfilter_POM.pm
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/Netfilter_POM.pm,v
retrieving revision 1.26
diff -u -r1.26 Netfilter_POM.pm
--- Netfilter_POM.pm 11 May 2004 13:53:13 -0000 1.26
+++ Netfilter_POM.pm 12 May 2004 19:02:22 -0000
@@ -852,9 +852,11 @@
my(@projects);
# print Dumper($patchlet);
- @projects = keys %{{ keys %{$patchlet->{files}},
- keys %{$patchlet->{patch}},
- keys %{$patchlet->{ladds}} }};
+ my %projects = ( );
+ foreach my $p ( keys %{$patchlet->{files}}, keys
%{$patchlet->{patch}}, keys %{$patchlet->{ladds}}) {
+ $projects{$p} = 1;
+ }
+ @projects = keys %projects;
foreach my $proj (@projects) {
return 0 unless ($self->apply_newfiles($patchlet, $proj,
$revert, $test, $copy)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Minor fix for patchlets which modify multiple projects
2004-05-12 19:04 [PATCH] Minor fix for patchlets which modify multiple projects Brad Fisher
@ 2004-05-13 3:02 ` Patrick McHardy
2004-05-13 16:09 ` Brad Fisher
2004-05-14 8:32 ` Jozsef Kadlecsik
1 sibling, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2004-05-13 3:02 UTC (permalink / raw)
To: Brad Fisher; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 583 bytes --]
Brad Fisher wrote:
>While converting a match of mine to pom-ng, I noticed that
>apply_patchlet doesn't properly determine the list of projects which are
>affected by the patchlet. In my case, the patch would be incompletely
>applied - the kernel space part would apply, but the userspace part
>would not. The following patch (agains pom-ng cvs) should fix this.
>-Brad Fisher
>
Thanks Brad, I've applied a small variation of this, because I don't know if
perl will complain about two equally named variables (@projects and %projects)
with warnings turned on.
Regards
Patrick
[-- Attachment #2: y --]
[-- Type: text/plain, Size: 775 bytes --]
Index: Netfilter_POM.pm
===================================================================
RCS file: /cvsroot/patch-o-matic-ng/Netfilter_POM.pm,v
retrieving revision 1.26
diff -u -r1.26 Netfilter_POM.pm
--- Netfilter_POM.pm 11 May 2004 13:53:13 -0000 1.26
+++ Netfilter_POM.pm 13 May 2004 02:57:05 -0000
@@ -852,9 +852,11 @@
my(@projects);
# print Dumper($patchlet);
- @projects = keys %{{ keys %{$patchlet->{files}},
- keys %{$patchlet->{patch}},
- keys %{$patchlet->{ladds}} }};
+ foreach my $p ( keys %{$patchlet->{files}},
+ keys %{$patchlet->{patch}},
+ keys %{$patchlet->{ladds}} ) {
+ push @projects, $p;
+ }
foreach my $proj (@projects) {
return 0 unless ($self->apply_newfiles($patchlet, $proj, $revert, $test, $copy)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Minor fix for patchlets which modify multiple projects
2004-05-13 3:02 ` Patrick McHardy
@ 2004-05-13 16:09 ` Brad Fisher
2004-05-13 18:08 ` Patrick McHardy
0 siblings, 1 reply; 5+ messages in thread
From: Brad Fisher @ 2004-05-13 16:09 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
Patrick McHardy wrote:
> Thanks Brad, I've applied a small variation of this, because I don't know if
> perl will complain about two equally named variables (@projects and %projects)
> with warnings turned on.
I don't think your patch is quite right. You can end up having the same project listed multiple
times with your patch, which is why I used the separate hash - key collisions are reduced to single
entries. I guess as long as it is no problem for a project to be processed multiple times, then
your patch will be OK, but if that isn't the case, you may want to look into it again.
As far as variables with the same name and different types, I don't believe Perl complains. I
typically program with 'use strict', which I believe enables all warnings, and have used naming
like this before. Of course it does add quite a bit of ambiguity, so renaming the %projects hash
would probably be a good idea if you choose to use a variation of my patch.
> Regards
> Patrick
-Brad
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Minor fix for patchlets which modify multiple projects
2004-05-13 16:09 ` Brad Fisher
@ 2004-05-13 18:08 ` Patrick McHardy
0 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2004-05-13 18:08 UTC (permalink / raw)
To: Brad Fisher; +Cc: netfilter-devel
Brad Fisher wrote:
>
> I don't think your patch is quite right. You can end up having the same project listed multiple
> times with your patch, which is why I used the separate hash - key collisions are reduced to single
> entries. I guess as long as it is no problem for a project to be processed multiple times, then
> your patch will be OK, but if that isn't the case, you may want to look into it again.
You're right, I just experienced that problem with the raw table patch.
Applying your original patch now, thanks.
Regards
Patrick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Minor fix for patchlets which modify multiple projects
2004-05-12 19:04 [PATCH] Minor fix for patchlets which modify multiple projects Brad Fisher
2004-05-13 3:02 ` Patrick McHardy
@ 2004-05-14 8:32 ` Jozsef Kadlecsik
1 sibling, 0 replies; 5+ messages in thread
From: Jozsef Kadlecsik @ 2004-05-14 8:32 UTC (permalink / raw)
To: Brad Fisher; +Cc: netfilter-devel
Hi Brad,
On Wed, 12 May 2004, Brad Fisher wrote:
> While converting a match of mine to pom-ng, I noticed that
> apply_patchlet doesn't properly determine the list of projects which are
> affected by the patchlet. In my case, the patch would be incompletely
> applied - the kernel space part would apply, but the userspace part
> would not. The following patch (agains pom-ng cvs) should fix this.
> -Brad Fisher
>
> Index: Netfilter_POM.pm
> ===================================================================
> RCS file: /cvspublic/patch-o-matic-ng/Netfilter_POM.pm,v
> retrieving revision 1.26
> diff -u -r1.26 Netfilter_POM.pm
> --- Netfilter_POM.pm 11 May 2004 13:53:13 -0000 1.26
> +++ Netfilter_POM.pm 12 May 2004 19:02:22 -0000
> @@ -852,9 +852,11 @@
> my(@projects);
>
> # print Dumper($patchlet);
> - @projects = keys %{{ keys %{$patchlet->{files}},
> - keys %{$patchlet->{patch}},
> - keys %{$patchlet->{ladds}} }};
> + my %projects = ( );
> + foreach my $p ( keys %{$patchlet->{files}}, keys
> %{$patchlet->{patch}}, keys %{$patchlet->{ladds}}) {
> + $projects{$p} = 1;
> + }
> + @projects = keys %projects;
>
> foreach my $proj (@projects) {
> return 0 unless ($self->apply_newfiles($patchlet, $proj,
> $revert, $test, $copy)
Yes, that was a bug. My code should have written as
@projects = keys %{{ %{$patchlet->{files}},
%{$patchlet->{patch}},
%{$patchlet->{ladds}} }};
Thank you the fix.
Best regards,
Jozsef
-
E-mail : kadlec@blackhole.kfki.hu, kadlec@sunserv.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-05-14 8:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-12 19:04 [PATCH] Minor fix for patchlets which modify multiple projects Brad Fisher
2004-05-13 3:02 ` Patrick McHardy
2004-05-13 16:09 ` Brad Fisher
2004-05-13 18:08 ` Patrick McHardy
2004-05-14 8:32 ` Jozsef Kadlecsik
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.