Skip to contentSkip to conversation

sanity.bbclass: Check for the known broken version of make

PATCH Superseded Mark Hatle 1 participant 3 messages Jun 18, 2013

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH v2 1/1 sanity.bbclass: Check for the known broken version of make

See GNU Savannah bug 30612 -- make 3.82 is known to be broken.

A number of vendors are providing a modified version, so checking for just the version string is not enough. We also need to check if the patch for the issue has been applied. We use a modified version of the reproduced to check for the issue.

---
 meta/classes/sanity.bbclass | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
meta/classes/sanity.bbclass +39 -0
index 3b9934b..012c40d 100644
@@ -336,6 +336,41 @@ def check_gcc_march(sanity_data):
 
     return result
 
+# Unpatched versions of make 3.82 are known to be broken.  See GNU Savannah Bug 30612.
+# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
+def check_make_version(sanity_data, loosever):
+    status, result = oe.utils.getstatusoutput("make --version")
+    if status != 0:
+        return "Unable to execute make --version, exit code %s\n" % status
+    version = result.split()[2]
+    if loosever(version) == loosever("3.82"):
+        # Construct a test file
+        f = open("makefile_test", "w")
+        f.write("makefile_test.a: makefile_test_a.c makefile_test_b.c makefile_test.a( makefile_test_a.c makefile_test_b.c)\n")
+        f.write("\n")
+        f.write("makefile_test_a.c:\n")
+        f.write("	touch $@\n")
+        f.write("\n")
+        f.write("makefile_test_b.c:\n")
+        f.write("	touch $@\n")
+        f.close()
+
+        # Check if make 3.82 has been patched
+        status,result = oe.utils.getstatusoutput("make -f makefile_test")
+
+        os.remove("makefile_test")
+        if os.path.exists("makefile_test_a.c"):
+            os.remove("makefile_test_a.c")
+        if os.path.exists("makefile_test_b.c"):
+            os.remove("makefile_test_b.c")
+        if os.path.exists("makefile_test.a"):
+            os.remove("makefile_test.a")
+
+        if status != 0:
+            return "Your version of make 3.82 is broken. Please revert to 3.81 or install a patched version.\n"
+    return None
+
+
 # Tar version 1.24 and onwards handle overwriting symlinks correctly
 # but earlier versions do not; this needs to work properly for sstate
 def check_tar_version(sanity_data, loosever):
@@ -407,6 +442,10 @@ def check_sanity(sanity_data):
         messages = messages + 'Please set a MACHINE in your local.conf or environment\n'
         machinevalid = False
 
+    makemsg = check_make_version(sanity_data, LooseVersion)
+    if makemsg:
+        messages = messages + makemsg
+
     tarmsg = check_tar_version(sanity_data, LooseVersion)
     if tarmsg:
         messages = messages + tarmsg
Signature · 1 line
1.8.3.1
author
#1 lore raw

Just an FYI -- this fails (correctly I might add) on many Fedora systems. It turns out that their version of make 3.82 is only partially patched.

The specific check we look for looks for two different problems. The first is a target that includes target(dep1 dep2 dep3). The second is a target that starts with leading spaces.

From what I can tell, most Fedora 3.82 versions are patched for the first problem, but not the second.

There are other problems with 3.82, but this patch appears to detect the most broken of 3.82 versions in common use.

(And no, this is no longer an RFC. I think this is the correct patch!)

--Mark

Quoted 70 lines · Mark Hatle

See GNU Savannah bug 30612 -- make 3.82 is known to be broken.

A number of vendors are providing a modified version, so checking for just the version string is not enough. We also need to check if the patch for the issue has been applied. We use a modified version of the reproduced to check for the issue.

---
  meta/classes/sanity.bbclass | 39 +++++++++++++++++++++++++++++++++++++++
  1 file changed, 39 insertions(+)
meta/classes/sanity.bbclass +39 -0
index 3b9934b..012c40d 100644
@@ -336,6 +336,41 @@ def check_gcc_march(sanity_data):
 
      return result
 
+# Unpatched versions of make 3.82 are known to be broken.  See GNU Savannah Bug 30612.
+# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
+def check_make_version(sanity_data, loosever):
+    status, result = oe.utils.getstatusoutput("make --version")
+    if status != 0:
+        return "Unable to execute make --version, exit code %s\n" % status
+    version = result.split()[2]
+    if loosever(version) == loosever("3.82"):
+        # Construct a test file
+        f = open("makefile_test", "w")
+        f.write("makefile_test.a: makefile_test_a.c makefile_test_b.c makefile_test.a( makefile_test_a.c makefile_test_b.c)\n")
+        f.write("\n")
+        f.write("makefile_test_a.c:\n")
+        f.write("	touch $@\n")
+        f.write("\n")
+        f.write("makefile_test_b.c:\n")
+        f.write("	touch $@\n")
+        f.close()
+
+        # Check if make 3.82 has been patched
+        status,result = oe.utils.getstatusoutput("make -f makefile_test")
+
+        os.remove("makefile_test")
+        if os.path.exists("makefile_test_a.c"):
+            os.remove("makefile_test_a.c")
+        if os.path.exists("makefile_test_b.c"):
+            os.remove("makefile_test_b.c")
+        if os.path.exists("makefile_test.a"):
+            os.remove("makefile_test.a")
+
+        if status != 0:
+            return "Your version of make 3.82 is broken. Please revert to 3.81 or install a patched version.\n"
+    return None
+
+
  # Tar version 1.24 and onwards handle overwriting symlinks correctly
  # but earlier versions do not; this needs to work properly for sstate
  def check_tar_version(sanity_data, loosever):
@@ -407,6 +442,10 @@ def check_sanity(sanity_data):
          messages = messages + 'Please set a MACHINE in your local.conf or environment\n'
          machinevalid = False
 
+    makemsg = check_make_version(sanity_data, LooseVersion)
+    if makemsg:
+        messages = messages + makemsg
+
      tarmsg = check_tar_version(sanity_data, LooseVersion)
      if tarmsg:
          messages = messages + tarmsg
author
#2 lore raw
Quoted 2 lines · Mark Hatle

Just an FYI -- this fails (correctly I might add) on many Fedora systems. It turns out that their version of make 3.82 is only partially patched.

From the best that I can tell, Fedora 16 and newer are all broken. (And I checked OE-Core, and it's also missing the second part of the fix. I should be sending a patch for that soon.)

Fedora Bug filed: https://bugzilla.redhat.com/show_bug.cgi?id=975597

If necessary we can relax the check I added by removing the 'space' on the makefile_test.a: ... line.

Obviously it hasn't been failing for the oe-core (and likely meta-oe) builds. But it is still broken.

--Mark

Quoted 91 lines

The specific check we look for looks for two different problems. The first is a target that includes target(dep1 dep2 dep3). The second is a target that starts with leading spaces.

From what I can tell, most Fedora 3.82 versions are patched for the first
problem, but not the second.

There are other problems with 3.82, but this patch appears to detect the most broken of 3.82 versions in common use.

(And no, this is no longer an RFC. I think this is the correct patch!)

--Mark

Quoted 60 lines · Mark Hatle

See GNU Savannah bug 30612 -- make 3.82 is known to be broken.

A number of vendors are providing a modified version, so checking for just the version string is not enough. We also need to check if the patch for the issue has been applied. We use a modified version of the reproduced to check for the issue.

---
   meta/classes/sanity.bbclass | 39 +++++++++++++++++++++++++++++++++++++++
   1 file changed, 39 insertions(+)
meta/classes/sanity.bbclass +35 -0
index 3b9934b..012c40d 100644
@@ -336,6 +336,41 @@ def check_gcc_march(sanity_data):
 
       return result
 
+# Unpatched versions of make 3.82 are known to be broken.  See GNU Savannah Bug 30612.
+# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
+def check_make_version(sanity_data, loosever):
+    status, result = oe.utils.getstatusoutput("make --version")
+    if status != 0:
+        return "Unable to execute make --version, exit code %s\n" % status
+    version = result.split()[2]
+    if loosever(version) == loosever("3.82"):
+        # Construct a test file
+        f = open("makefile_test", "w")
+        f.write("makefile_test.a: makefile_test_a.c makefile_test_b.c makefile_test.a( makefile_test_a.c makefile_test_b.c)\n")
+        f.write("\n")
+        f.write("makefile_test_a.c:\n")
+        f.write("	touch $@\n")
+        f.write("\n")
+        f.write("makefile_test_b.c:\n")
+        f.write("	touch $@\n")
+        f.close()
+
+        # Check if make 3.82 has been patched
+        status,result = oe.utils.getstatusoutput("make -f makefile_test")
+
+        os.remove("makefile_test")
+        if os.path.exists("makefile_test_a.c"):
+            os.remove("makefile_test_a.c")
+        if os.path.exists("makefile_test_b.c"):
+            os.remove("makefile_test_b.c")
+        if os.path.exists("makefile_test.a"):
+            os.remove("makefile_test.a")
+
+        if status != 0:
+            return "Your version of make 3.82 is broken. Please revert to 3.81 or install a patched version.\n"
+    return None
+
+
   # Tar version 1.24 and onwards handle overwriting symlinks correctly
   # but earlier versions do not; this needs to work properly for sstate
   def check_tar_version(sanity_data, loosever):

meta/classes/sanity.bbclass def check_sanity(sanity_data): · line 451

Quoted 10 lines
meta/classes/sanity.bbclass +4 -0
@@ -407,6 +442,10 @@ def check_sanity(sanity_data):
           messages = messages + 'Please set a MACHINE in your local.conf or environment\n'
           machinevalid = False
 
+    makemsg = check_make_version(sanity_data, LooseVersion)
+    if makemsg:
+        messages = messages + makemsg
+
       tarmsg = check_tar_version(sanity_data, LooseVersion)
       if tarmsg:
           messages = messages + tarmsg

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core