Skip to contentSkip to conversation

engine.pl: Fix a recent breakage of the buildsystem generator

PATCH Superseded Ramsay Jones 3 participants 5 messages Jun 15, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 engine.pl: Fix a recent breakage of the buildsystem generator

Commit ade2ca0c (Do not try to remove directories when removing old links, 27-10-2009) added an expression to a 'test' using an '-o' or connective. This resulted in the buildsystem generator mistaking the conditional 'rm' for a linker command. In order to fix the breakage, we filter the out the conditional 'rm' commands before attempting to identify other commands.

---
 contrib/buildsystems/engine.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
contrib/buildsystems/engine.pl +5 -0
index d506717..245af73 100644
@@ -135,6 +135,11 @@ sub parseMakeOutput
             }
         } while($ate_next);
 
+        if ($text =~ /^test / && $text =~ /|| rm -f /) {
+            # commands removing executables, if they exist
+            next;
+        }
+
         if($text =~ / -c /) {
             # compilation
             handleCompileLine($text, $line);
Signature · 1 line
1.6.6
#1 lore raw

contrib/buildsystems/engine.pl sub parseMakeOutput · line 138

Quoted 9 lines · Ramsay Jones
contrib/buildsystems/engine.pl +1 -0
index d506717..245af73 100644
@@ -135,6 +135,11 @@ sub parseMakeOutput
             }
         } while($ate_next);
 
+        if ($text =~ /^test / && $text =~ /|| rm -f /) {

That test on the right needs to escape its pipes or it will always match.

--Pete

Quoted 7 lines
contrib/buildsystems/engine.pl +4 -0
+            # commands removing executables, if they exist
+            next;
+        }
+
         if($text =~ / -c /) {
             # compilation
             handleCompileLine($text, $line);
#2 lore raw
Quoted 9 lines · Pete Harlan
Quoted 8 lines · Ramsay Jones
contrib/buildsystems/engine.pl +0 -0
index d506717..245af73 100644
@@ -135,6 +135,11 @@ sub parseMakeOutput
             }
         } while($ate_next);
 
Quoted 3 lines

contrib/buildsystems/engine.pl sub parseMakeOutput · line 138

Quoted 1 line
contrib/buildsystems/engine.pl +1 -0
+        if ($text =~ /^test / && $text =~ /|| rm -f /) {

That test on the right needs to escape its pipes or it will always match.

Heh, well spotted!
As you may have already noticed, I copy/pasted the code from the comment further down in this function, but didn't take enough care in doing so... Oops! ;-)

The obvious solution, also suggested later by Sebastion, is to simply remove the second regex from the test since it does not alter the outcome (and still fixes the problem)...

ATB,
Ramsay Jones

#3 lore raw
In reply to Ramsay Jones
Quoted 2 lines · Ramsay Jones

'-o' or connective. This resulted in the buildsystem generator mistaking the conditional 'rm' for a linker command. In order

Thanks for spotting the cause of this! Some comments:

1. How about deleting lines 183-185 in same run? That commented out code, too, is missing the escapes for the pipes that Pete mentioned anyway.

-# } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {
-# # commands removing executables, if they exist
-#

2. Couldn't we reduce the test to just

+ if ($text =~ /^test /) {
+ # options to test may be mistaken for linker options
+ next;
+ }
+

3. If the above won't do for some reason, I'd still prefer something like

+ if ($text =~ /^test / && $text =~ / -o /) {
+ # options to test may be mistaken for linker options
+ next;
+ }
+

as it makes more clear what's the problem in such lines.

Signature · 1 line
Sebastian Schuberth
#4 lore raw

Review

Quoted 13 lines · Sebastian Schuberth
Quoted 2 lines · Ramsay Jones

'-o' or connective. This resulted in the buildsystem generator mistaking the conditional 'rm' for a linker command. In order

Thanks for spotting the cause of this! Some comments:

1. How about deleting lines 183-185 in same run? That commented out code, too, is missing the escapes for the pipes that Pete mentioned anyway.

(quoted diff) +0 -3
-#        } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {
-#            # commands removing executables, if they exist
-#

OK, will do.

contrib/buildsystems/engine.pl sub parseMakeOutput · line 142

Quoted 8 lines

2. Couldn't we reduce the test to just

contrib/buildsystems/engine.pl +5 -0
+        if ($text =~ /^test /) {
+            # options to test may be mistaken for linker options
+            next;
+        }
+

Yes, good idea. I will send a new version of the patch soon.

Thanks!

ATB,
Ramsay Jones