[129719] trunk/base/src/macports1.0/doctor.tcl

khindenburg at macports.org khindenburg at macports.org
Thu Dec 18 18:50:12 PST 2014


Revision: 129719
          https://trac.macports.org/changeset/129719
Author:   khindenburg at macports.org
Date:     2014-12-18 18:50:12 -0800 (Thu, 18 Dec 2014)
Log Message:
-----------
doctor: for compilation check, use full path of system clang; check results; always remove test files

Modified Paths:
--------------
    trunk/base/src/macports1.0/doctor.tcl

Modified: trunk/base/src/macports1.0/doctor.tcl
===================================================================
--- trunk/base/src/macports1.0/doctor.tcl	2014-12-19 02:36:55 UTC (rev 129718)
+++ trunk/base/src/macports1.0/doctor.tcl	2014-12-19 02:50:12 UTC (rev 129719)
@@ -238,6 +238,8 @@
         # Returns:
         #           None
 
+        # TODO: Should we drop privileges?
+
         output "compilation errors"
 
         set filename    "test.c"
@@ -246,15 +248,24 @@
         puts $fd "int main() { return 0; }"
         close $fd
 
-        set output      [exec clang $filename -o main_test]
+        # 'clang' will fail when using
+        # https://trac.macports.org/wiki/UsingTheRightCompiler#testing
+        # TODO: use default C compiler
+        # TODO: skip if no C compiler installed
+        catch {exec /usr/bin/clang $filename -o main_test} output
 
         file delete $filename
         file delete "main_test"
 
-        if {"couldn't create cache file" in $output} {
-            ui_warn "found errors when attempting to compile file. To fix this issue, delete your tmp folder using:
+        if {[string length $output] > 0} {
+            # Some type of error
+            if {[string match "*couldn't create cache file*" $output]} {
+                ui_warn "found errors when attempting to compile file. To fix this issue, delete your tmp folder using:
                        rm -rf \$TMPDIR"
-            success_fail 0 
+            } else {
+                ui_warn $output
+            }
+            success_fail 0
             return
         }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141218/547f0ba9/attachment.html>


More information about the macports-changes mailing list