Cleanup the passing of MCA params on the orted cmd line in ssh by ensuring that we quote all values since they could be multi-word and/or contain special characters. Thanks to Dirk Schubert for pointing it out.
cmr=v1.8.2:reviewer=jsquyres This commit was SVN r32280.
Этот коммит содержится в:
родитель
408474d2d8
Коммит
a94a97bd50
@ -572,18 +572,15 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
*/
|
||||
cnt = opal_argv_count(orted_cmd_line);
|
||||
for (i=0; i < cnt; i+=3) {
|
||||
/* check if the specified option is more than one word - all
|
||||
* others have already been passed
|
||||
*/
|
||||
if (NULL != strchr(orted_cmd_line[i+2], ' ')) {
|
||||
/* must add quotes around it */
|
||||
(void)asprintf(¶m, "\"%s\"", orted_cmd_line[i+2]);
|
||||
/* now pass it along */
|
||||
opal_argv_append(&argc, &argv, orted_cmd_line[i]);
|
||||
opal_argv_append(&argc, &argv, orted_cmd_line[i+1]);
|
||||
opal_argv_append(&argc, &argv, param);
|
||||
free(param);
|
||||
}
|
||||
/* there could be multi-word values here, or
|
||||
* values with special characters, so protect
|
||||
* the value with quotes */
|
||||
(void)asprintf(¶m, "\"%s\"", orted_cmd_line[i+2]);
|
||||
/* now pass it along */
|
||||
opal_argv_append(&argc, &argv, orted_cmd_line[i]);
|
||||
opal_argv_append(&argc, &argv, orted_cmd_line[i+1]);
|
||||
opal_argv_append(&argc, &argv, param);
|
||||
free(param);
|
||||
}
|
||||
|
||||
/* unless told otherwise... */
|
||||
@ -612,20 +609,16 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
char *p2;
|
||||
/* add it */
|
||||
opal_argv_append(&argc, &argv, "-mca");
|
||||
opal_argv_append(&argc, &argv, param);
|
||||
/* if the value has a special character in it,
|
||||
* then protect it with quotes
|
||||
*/
|
||||
if (NULL != strchr(value, ';')) {
|
||||
char *p2;
|
||||
(void)asprintf(&p2, "\"%s\"", value);
|
||||
opal_argv_append(&argc, &argv, p2);
|
||||
free(p2);
|
||||
} else {
|
||||
opal_argv_append(&argc, &argv, value);
|
||||
}
|
||||
/* there could be multi-word values here, or
|
||||
* values with special characters, so protect
|
||||
* the value with quotes */
|
||||
(void)asprintf(&p2, "\"%s\"", value);
|
||||
opal_argv_append(&argc, &argv, p2);
|
||||
free(p2);
|
||||
}
|
||||
free(param);
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user