Hello Chapel developers,
I recently downloaded the 1.8.0 release to tool around with it under
Cygwin and ran into a bug. Everything compiled OK, but running chpl
would crash immediately in the shell script:
--------------------------------------------------------------------
$ pwd
/cygdrive/e/Temp/chapel-1.8.0
$ source util/setchplenv.bash
Setting CHPL_HOME to /cygdrive/e/Temp/chapel-1.8.0
Setting CHPL_HOST_PLATFORM to cygwin
Updating PATH to include /cygdrive/e/Temp/chapel-1.8.0/bin/cygwin
and /cygdrive/e/Temp/chapel-1.8.0/util
Updating MANPATH to include /cygdrive/e/Temp/chapel-1.8.0/man
$ chpl -o hello examples/hello.chpl
sh: /tmp/chpl-Daniel: Is a directory
error: running $CHPL_HOME/util/chplenv/platform --host
$ echo $CHPL_HOME
/cygdrive/e/Temp/chapel-1.8.0
--------------------------------------------------------------------
No amount of fiddling with environment variables seemed to help (which
is what I first thought might be the culprit, and what I tried "fixing"
initially).
Looking around in the code, I noticed the following block, lines 87-93
in chapel-1.8.0/compiler/util/files.cpp:
struct passwd* passwdinfo = getpwuid(geteuid());
const char* userid;
if (passwdinfo == NULL) {
userid = "anon";
} else {
userid = passwdinfo->pw_name;
}
It turns out that user names in Cygwin can contain spaces if the
underlying Windows user name does. My user name is one of these:
--------------------------------------------------------------------
$ id
uid=1000(Daniel Moniz) [... etc. ...]
$ whoami
Daniel Moniz
$ echo $USER
Daniel Moniz
--------------------------------------------------------------------
At the time, I just wanted the darn thing to work, so I just commented
out lines 89-93 inclusive, and hard-coded in "anon" as my user name,
such that the temporary directory the compiler is trying to write gets
created as expected:
struct passwd* passwdinfo = getpwuid(geteuid());
const char* userid;
/*
if (passwdinfo == NULL) {
userid = "anon";
} else {
userid = passwdinfo->pw_name;
}
*/
userid = "anon";
This is a gross hack, no doubt about it, but it works fine (or at least,
seems to) for now. Perhaps this is another case that should be handled
like the check for NULL?
Hope this helps. Thanks for making Chapel, and for making it available!
--
Daniel Moniz <[email protected]> [http://pobox.com/~dnm/]
------------------------------------------------------------------------------
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers