pmodels / mpich

Official MPICH Repository
http://www.mpich.org
Other
544 stars 281 forks source link

[mpich2-dev] smpd + mpiexec_rsh.c #353

Closed mpichbot closed 8 years ago

mpichbot commented 8 years ago

Originally by Jeffrey Frey frey@UDel.Edu on 2009-01-13 13:41:30 -0600



Has anyone else has run into this bug before...it exists in 1.0.7 and
1.0.8 (at least) and affects smpd with the mpiexec_rsh startup.

In src/pm/smpd/mpiexec_rsh.c:475 the rsh command string is created as:

            MPIU_Snprintf(pExe, SMPD_MAX_EXE_LENGTH - curLen, "
\"PMI_RANK=%d\" \"PMI_SIZE=%d\" \"PMI_KVS=%s\" \"PMI_ROOT_HOST=%s\"
\"PMI_ROOT_PORT=%d\" \"PMI_ROOT_LOCAL=0\" \"PMI_APPNUM=%d\" \"%s\"",
                launch_node_ptr->iproc, launch_node_ptr->nproc,
smpd_process.kvs_name, root_host, root_port, launch_node_ptr->appnum,
exe);

Note the escaped quotes around the final argument [exe] in the format
string.  This resulting string [pExe] is later re-parsed by
smpd_launch_process; if the string in [exe] contains any quote
characters then the parsing inside smpd_launch_process() will mangle
the argument list to be passed to the executable.  E.g.

    ... "PMI_APPNUM=####" "/home/frey/mpitest "--x=y" testing"

gets parsed into an argv[] list of

   argv[0] = "/home/frey/mpitest "
   argv[1] = "--x"
   argv[2] = "="
   argv[3] = "y testing"
   argv[4] = NULL

by smpd_launch_process().  Note that the quotes around "--x=y" were
introduced by mpiexec, since the argument contains an "=" which is
used as a delimiter character in the string utilities -- it was not
explicitly quoted in my invocation of mpiexec.

I think the quoting in the code cited above (src/pm/smpd/
mpiexec_rsh.c:475) was mistakenly introduced, since all three command-
building code sections coming before it in that source file do NOT
quote [exe] in the command string they create.  Here's a diff for src/
pm/smpd/mpiexec_rsh.c:

## SNIP==
475c475
<           MPIU_Snprintf(pExe, SMPD_MAX_EXE_LENGTH - curLen, "
\"PMI_RANK=%d\" \"PMI_SIZE=%d\" \"PMI_KVS=%s\" \"PMI_ROOT_HOST=%s\"
\"PMI_ROOT_PORT=%d\" \"PMI_ROOT_LOCAL=0\" \"PMI_APPNUM=%d\" \"%s\"",

---
 >           MPIU_Snprintf(pExe, SMPD_MAX_EXE_LENGTH - curLen, "
\"PMI_RANK=%d\" \"PMI_SIZE=%d\" \"PMI_KVS=%s\" \"PMI_ROOT_HOST=%s\"
\"PMI_ROOT_PORT=%d\" \"PMI_ROOT_LOCAL=0\" \"PMI_APPNUM=%d\" %s",
==## SNIP

::::::::::::::::::::::::::::::::::::::::::::::::::::::
   Jeffrey T. Frey, Ph.D.
   Systems Programmer IV / Cluster Management
   Network & Systems Services / College of Engineering
   University of Delaware, Newark DE  19716
   Office: (302) 831-6034  Mobile: (302) 419-4976
   http://turin.nss.udel.edu/

   99 A1 7F 5E 71 70 8A 38  3C 4A A2 B1 4D 0A B2 49
::::::::::::::::::::::::::::::::::::::::::::::::::::::
mpichbot commented 8 years ago

Originally by Jeffrey Frey on 2009-01-13 13:41:35 -0600


This message has 0 attachment(s)