headers_install: check exit status of unifdef
PATCH 1/1 headers_install: check exit status of unifdef
If unifdef fails for any reason (like segfaulting), we should be aborting the install steps. So check its exit status in this unlikely scenario.
--- scripts/headers_install.pl | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
scripts/headers_install.pl +2 -1
@@ -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;
Signature · 1 line
1.7.3.2
PATCH v2 1/1 headers_install: check exit status of unifdef
If unifdef fails for any reason (like segfaulting), we should be aborting the install steps. So check its exit status in this unlikely scenario.
---
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(-)
scripts/headers_install.pl +7 -0
@@ -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;
Signature · 1 line
1.7.3.2
Quoted 18 lines · 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ò <[email protected]>Signed-off-by Mike Frysinger <[email protected]>---
v2
- apparently exit status of 1 is normal for unifdef, so need to handle that tooscripts/headers_install.pl | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)scripts/headers_install.pl +0
-0
scripts/headers_install.pl foreach my $file (@files) { · line 52
Quoted 8 lines
scripts/headers_install.pl +5
-0@@ -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) {??
scripts/headers_install.pl foreach my $file (@files) { · line 57
Quoted 6 lines
scripts/headers_install.pl +2
-0+ die "$tmpfile: $!\n"; + } unlink $tmpfile; } exit 0;
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
PATCH v3 1/1 headers_install: check exit status of unifdef
In reply to Mike FrysingerIf unifdef fails for any reason (like segfaulting), we should be aborting the install steps. So check its exit status in this unlikely scenario.
---
v3
- fix thinko pointed out by Randy
scripts/headers_install.pl | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
scripts/headers_install.pl +7 -0
@@ -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;
Signature · 1 line
1.7.3.2
Quoted 11 lines · Mike Frysinger
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ò<[email protected]>Signed-off-by Mike Frysinger<[email protected]>---
v3
- fix thinko pointed out by Randyscripts/headers_install.pl | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
Applied to kbuild-2.6#kbuild, thanks.
Michal