You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/01/26 13:27:19 UTC

[2/2] lucy-clownfish git commit: Regenerate charmonizer.c to fix OS detection

Regenerate charmonizer.c to fix OS detection

Fixes CLOWNFISH-3.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/9fd7fb5b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/9fd7fb5b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/9fd7fb5b

Branch: refs/heads/master
Commit: 9fd7fb5bf4d7230e83d8025360948d69ccb03390
Parents: 4e0508a
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Jan 26 13:00:00 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Jan 26 13:00:00 2016 +0100

----------------------------------------------------------------------
 compiler/common/charmonizer.c | 30 ++++++++++++++++++------------
 runtime/common/charmonizer.c  | 30 ++++++++++++++++++------------
 2 files changed, 36 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9fd7fb5b/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/compiler/common/charmonizer.c b/compiler/common/charmonizer.c
index fc8833e..cf724af 100644
--- a/compiler/common/charmonizer.c
+++ b/compiler/common/charmonizer.c
@@ -5307,8 +5307,20 @@ chaz_OS_init(void) {
         printf("Trying to find a bit-bucket a la /dev/null...\n");
     }
 
-    /* Detect shell based on whether the bitbucket is "/dev/null" or "nul". */
-    if (chaz_Util_can_open_file("/dev/null")) {
+    /* Detect shell based on whether the bitbucket is "/dev/null" or "nul".
+     * Start with "nul" as some Windows boxes seem to have a "/dev/null".
+     */
+    if (chaz_Util_can_open_file("nul")) {
+        strcpy(chaz_OS.name, "windows");
+        strcpy(chaz_OS.dev_null, "nul");
+        strcpy(chaz_OS.dir_sep, "\\");
+        strcpy(chaz_OS.exe_ext, ".exe");
+        strcpy(chaz_OS.shared_lib_ext, ".dll");
+        strcpy(chaz_OS.static_lib_ext, ".lib");
+        strcpy(chaz_OS.local_command_start, ".\\");
+        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
+    }
+    else if (chaz_Util_can_open_file("/dev/null")) {
         char   *uname;
         size_t  uname_len;
         size_t i;
@@ -5341,20 +5353,14 @@ chaz_OS_init(void) {
         }
         strcpy(chaz_OS.local_command_start, "./");
     }
-    else if (chaz_Util_can_open_file("nul")) {
-        strcpy(chaz_OS.name, "windows");
-        strcpy(chaz_OS.dev_null, "nul");
-        strcpy(chaz_OS.dir_sep, "\\");
-        strcpy(chaz_OS.exe_ext, ".exe");
-        strcpy(chaz_OS.shared_lib_ext, ".dll");
-        strcpy(chaz_OS.static_lib_ext, ".lib");
-        strcpy(chaz_OS.local_command_start, ".\\");
-        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
-    }
     else {
         /* Bail out because we couldn't find anything like /dev/null. */
         chaz_Util_die("Couldn't find anything like /dev/null");
     }
+
+    if (chaz_Util_verbosity) {
+        printf("Detected OS: %s\n", chaz_OS.name);
+    }
 }
 
 const char*

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9fd7fb5b/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.c b/runtime/common/charmonizer.c
index b062d94..c0a75ad 100644
--- a/runtime/common/charmonizer.c
+++ b/runtime/common/charmonizer.c
@@ -5307,8 +5307,20 @@ chaz_OS_init(void) {
         printf("Trying to find a bit-bucket a la /dev/null...\n");
     }
 
-    /* Detect shell based on whether the bitbucket is "/dev/null" or "nul". */
-    if (chaz_Util_can_open_file("/dev/null")) {
+    /* Detect shell based on whether the bitbucket is "/dev/null" or "nul".
+     * Start with "nul" as some Windows boxes seem to have a "/dev/null".
+     */
+    if (chaz_Util_can_open_file("nul")) {
+        strcpy(chaz_OS.name, "windows");
+        strcpy(chaz_OS.dev_null, "nul");
+        strcpy(chaz_OS.dir_sep, "\\");
+        strcpy(chaz_OS.exe_ext, ".exe");
+        strcpy(chaz_OS.shared_lib_ext, ".dll");
+        strcpy(chaz_OS.static_lib_ext, ".lib");
+        strcpy(chaz_OS.local_command_start, ".\\");
+        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
+    }
+    else if (chaz_Util_can_open_file("/dev/null")) {
         char   *uname;
         size_t  uname_len;
         size_t i;
@@ -5341,20 +5353,14 @@ chaz_OS_init(void) {
         }
         strcpy(chaz_OS.local_command_start, "./");
     }
-    else if (chaz_Util_can_open_file("nul")) {
-        strcpy(chaz_OS.name, "windows");
-        strcpy(chaz_OS.dev_null, "nul");
-        strcpy(chaz_OS.dir_sep, "\\");
-        strcpy(chaz_OS.exe_ext, ".exe");
-        strcpy(chaz_OS.shared_lib_ext, ".dll");
-        strcpy(chaz_OS.static_lib_ext, ".lib");
-        strcpy(chaz_OS.local_command_start, ".\\");
-        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
-    }
     else {
         /* Bail out because we couldn't find anything like /dev/null. */
         chaz_Util_die("Couldn't find anything like /dev/null");
     }
+
+    if (chaz_Util_verbosity) {
+        printf("Detected OS: %s\n", chaz_OS.name);
+    }
 }
 
 const char*