chapel-lang/chapel — pull request #194 by gbtitus (2014-08-22 18:16:54+00:00)
Title: with GASNet udp conduit and ssh spawning, forward the environment

GASNet's udp conduit and ssh spawner do not forward the environment from
the launching process to the user processes. We therefore need to do it
ourselves. To achieve this, in our amudprun launcher add a -E option
for each environment variable to the command line for the user program.

runtime/src/launch/amudprun/launch-amudprun.c
If we are using the ssh spawner, add the environment to the user
program command line via the new -E option.

While here, I also did a little cleaning up. I moved _nlbuf into the
only function that uses it. While doing so I renamed _nlbuf to nlbuf;
the leading '_' seemed extraneous. I also changed sprintf(3) to
snprintf(3) in the two places where we print into limited-size
buffers. The buffers should always be long enough, but it's still
good style. And, I got rid of a pair of comments that didn't seem to
be adding anything.

runtime/src/arg.c
Don't print a warning when we see a -E option for an env var that is
already set. It turns out there are lots of these, set by various
things that run before the user executable in the remote ssh session.
The warnings are therefore unavoidable and just add noise.

third-party/gasnet/GASNet-1.22.0/other/amudp/amudp_spawn.cpp
Allow command lines of arbitrary length in the udp conduit's ssh
spawner. The old code only allowed 1024 characters, used a fixed
size buffer, and didn't check for overflow. Adding the entire
environment to the command line typically requires way more than 1024
characters. The change here duplicates this GASNet commit:
https://bitbucket.org/berkeleylab/gasnet/commits/1abde2638f58790b6e649ad23d\
42a19a6b3166d3

This is a minor modification of some code I sent Paul Hargrove. To
ease future merges, I'm committing his version instead of my original.
(I committed and then backed out mine in my branch, so anyone curious
can dig it up.)

test/execflags/gbt/getenv.chpl
test/execflags/gbt/getenv.execenv
test/execflags/gbt/getenv.good
test/execflags/gbt/getenv.numlocales
test/execflags/gbt/getenv.prediff
test/execflags/gbt/getenv.skipif
Add a test that runs only for comm=gasnet, and checks that a user
environment variable is available.