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:38 UTC

[2/2] lucy-clownfish git commit: Swap Charmonizer checks for "nul" and "/dev/null"

Swap Charmonizer checks for "nul" and "/dev/null"

Some CPAN Testers Windows boxes seem to have a "/dev/null".

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/643c5302
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/643c5302
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/643c5302

Branch: refs/heads/0.4
Commit: 643c5302780145b006a8a0f5910d01dd934ecaf9
Parents: c503163
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:03:03 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/643c5302/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/compiler/common/charmonizer.c b/compiler/common/charmonizer.c
index 7009af9..026c412 100644
--- a/compiler/common/charmonizer.c
+++ b/compiler/common/charmonizer.c
@@ -5200,8 +5200,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;
@@ -5234,20 +5246,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/643c5302/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.c b/runtime/common/charmonizer.c
index b81c3fd..705eea9 100644
--- a/runtime/common/charmonizer.c
+++ b/runtime/common/charmonizer.c
@@ -5200,8 +5200,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;
@@ -5234,20 +5246,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*