All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] headers_install: check exit status of unifdef
@ 2010-11-23 22:25 Mike Frysinger
  2010-11-23 22:41 ` [PATCH v2] " Mike Frysinger
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2010-11-23 22:25 UTC (permalink / raw)
  To: linux-kbuild, Michal Marek

If unifdef fails for any reason (like segfaulting), we should be aborting
the install steps.  So check its exit status in this unlikely scenario.

Reported-by: Diego Elio Pettenò <flameeyes@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 scripts/headers_install.pl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 4ca3be3..00856f1 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -44,7 +44,8 @@ foreach my $file (@files) {
 	close $out;
 	close $in;
 
-	system $unifdef . " $tmpfile > $installdir/$file";
+	system $unifdef . " $tmpfile > $installdir/$file"
+	    and die "$tmpfile: $!\n";
 	unlink $tmpfile;
 }
 exit 0;
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] headers_install: check exit status of unifdef
  2010-11-23 22:41 ` [PATCH v2] " Mike Frysinger
@ 2010-11-23 22:38   ` Randy Dunlap
  2010-11-24  0:54   ` [PATCH v3] " Mike Frysinger
  1 sibling, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2010-11-23 22:38 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kbuild, Michal Marek

On Tue, 23 Nov 2010 17:41:36 -0500 Mike Frysinger wrote:

> If unifdef fails for any reason (like segfaulting), we should be aborting
> the install steps.  So check its exit status in this unlikely scenario.
> 
> Reported-by: Diego Elio Pettenò <flameeyes@gentoo.org>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> v2
> 	- apparently exit status of 1 is normal for unifdef, so need to
> 	  handle that too
> 
>  scripts/headers_install.pl |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
> index 4ca3be3..59ad768 100644
> --- a/scripts/headers_install.pl
> +++ b/scripts/headers_install.pl
> @@ -45,6 +45,13 @@ foreach my $file (@files) {
>  	close $in;
>  
>  	system $unifdef . " $tmpfile > $installdir/$file";
> +	# unifdef will exit 0 on success, and will exit 1 when the
> +	# file was processed successfully but no changes were made,
> +	# so abort only when it's higher than that.
> +	my $e = $? >> 8;
> +	if ($e > 2) {

	if ($e > 1) {

??

> +		die "$tmpfile: $!\n";
> +	}
>  	unlink $tmpfile;
>  }
>  exit 0;
> -- 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] headers_install: check exit status of unifdef
  2010-11-23 22:25 [PATCH] headers_install: check exit status of unifdef Mike Frysinger
@ 2010-11-23 22:41 ` Mike Frysinger
  2010-11-23 22:38   ` Randy Dunlap
  2010-11-24  0:54   ` [PATCH v3] " Mike Frysinger
  0 siblings, 2 replies; 5+ messages in thread
From: Mike Frysinger @ 2010-11-23 22:41 UTC (permalink / raw)
  To: linux-kbuild, Michal Marek

If unifdef fails for any reason (like segfaulting), we should be aborting
the install steps.  So check its exit status in this unlikely scenario.

Reported-by: Diego Elio Pettenò <flameeyes@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
	- apparently exit status of 1 is normal for unifdef, so need to
	  handle that too

 scripts/headers_install.pl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 4ca3be3..59ad768 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -45,6 +45,13 @@ foreach my $file (@files) {
 	close $in;
 
 	system $unifdef . " $tmpfile > $installdir/$file";
+	# unifdef will exit 0 on success, and will exit 1 when the
+	# file was processed successfully but no changes were made,
+	# so abort only when it's higher than that.
+	my $e = $? >> 8;
+	if ($e > 2) {
+		die "$tmpfile: $!\n";
+	}
 	unlink $tmpfile;
 }
 exit 0;
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3] headers_install: check exit status of unifdef
  2010-11-23 22:41 ` [PATCH v2] " Mike Frysinger
  2010-11-23 22:38   ` Randy Dunlap
@ 2010-11-24  0:54   ` Mike Frysinger
  2010-12-14 14:11     ` Michal Marek
  1 sibling, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2010-11-24  0:54 UTC (permalink / raw)
  To: linux-kbuild, Michal Marek

If unifdef fails for any reason (like segfaulting), we should be aborting
the install steps.  So check its exit status in this unlikely scenario.

Reported-by: Diego Elio Pettenò <flameeyes@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v3
	- fix thinko pointed out by Randy

 scripts/headers_install.pl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 4ca3be3..efb3be1 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -45,6 +45,13 @@ foreach my $file (@files) {
 	close $in;
 
 	system $unifdef . " $tmpfile > $installdir/$file";
+	# unifdef will exit 0 on success, and will exit 1 when the
+	# file was processed successfully but no changes were made,
+	# so abort only when it's higher than that.
+	my $e = $? >> 8;
+	if ($e > 1) {
+		die "$tmpfile: $!\n";
+	}
 	unlink $tmpfile;
 }
 exit 0;
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] headers_install: check exit status of unifdef
  2010-11-24  0:54   ` [PATCH v3] " Mike Frysinger
@ 2010-12-14 14:11     ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2010-12-14 14:11 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kbuild

On 24.11.2010 01:54, Mike Frysinger wrote:
> If unifdef fails for any reason (like segfaulting), we should be aborting
> the install steps.  So check its exit status in this unlikely scenario.
>
> Reported-by: Diego Elio Pettenò<flameeyes@gentoo.org>
> Signed-off-by: Mike Frysinger<vapier@gentoo.org>
> ---
> v3
> 	- fix thinko pointed out by Randy
>
>   scripts/headers_install.pl |    7 +++++++
>   1 files changed, 7 insertions(+), 0 deletions(-)

Applied to kbuild-2.6#kbuild, thanks.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-14 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23 22:25 [PATCH] headers_install: check exit status of unifdef Mike Frysinger
2010-11-23 22:41 ` [PATCH v2] " Mike Frysinger
2010-11-23 22:38   ` Randy Dunlap
2010-11-24  0:54   ` [PATCH v3] " Mike Frysinger
2010-12-14 14:11     ` Michal Marek

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.