Hi Daniel --

Thanks for passing this along.  After years of not encountering any cygwin 
users with spaces in their name, you're the second to show up with this problem 
within the week (see the chapel-bugs mailing list for a mention of the other).  
I just committed a fix for this issue this afternoon (one that squeezes spaces 
out of the username), so if you were to update to trunk/, it ought to work for 
you now out of the box.  That said, your hack is a completely reasonable 
workaround as well.  We'll be doing the 1.9 release in a few weeks (mid-April), 
and it will contain this fix as well.

Thanks for passing it along, and sorry that we didn't save you the work by 
running into it sooner,
-Brad

________________________________________
From: Daniel Moniz [[email protected]]
Sent: Wednesday, March 26, 2014 9:01 PM
To: [email protected]
Subject: [Chapel-developers] Gross hack to handle user names with spaces        
under Cygwin

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

------------------------------------------------------------------------------
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to