1
1

Be a little smarter when checking the MCA parameters that specify what

components to load:

- only allow the ^ to be the first character of the value
- if we find ^ elsewhere in the value, print an error and fail  

This commit was SVN r10880.
Этот коммит содержится в:
Jeff Squyres 2006-07-19 14:19:44 +00:00
родитель 0b15943a7a
Коммит 32c1f38976
2 изменённых файлов: 46 добавлений и 12 удалений

Просмотреть файл

@ -35,3 +35,21 @@ The %s component was not found!
This means that this component is either not installed, or unable to be
used on your system.
[framework-param:too-many-negates]
MCA framework parameters can only take a single negation operator
("^"), and it must be at the beginning of the value. The following
value violates this rule:
%s
When used, the negation operator sets the "exclusive" behavior mode,
meaning that it will exclude all specified components (and implicitly
include all others). If the negation operator is not specified, the
"inclusive" mode is assumed, meaning that all specified components
will be included (and implicitly exclude all others).
For example, "^a,b" specifies the exclusive behavior and means "use
all components *except* a and b", while "c,d" specifies the inclusive
behavior and means "use *only* components c and d."
You cannot mix inclusive and exclusive behavior.

Просмотреть файл

@ -159,8 +159,7 @@ static int parse_requested(int mca_param, bool *include_mode,
char ***requested_component_names)
{
int i;
char *requested;
char *tmp;
char *requested, *requested_orig;
*requested_component_names = NULL;
*include_mode = true;
@ -173,22 +172,39 @@ static int parse_requested(int mca_param, bool *include_mode,
if (NULL == requested || 0 == strlen(requested)) {
return OPAL_SUCCESS;
}
*requested_component_names = opal_argv_split(requested, ',');
requested_orig = requested;
/* Are we including or excluding? */
/* Are we including or excluding? We only allow the negate
character to be the *first* character of the value (but be nice
and allow any number of negate characters in the beginning). */
for (i = 0; NULL != (*requested_component_names)[i]; ++i) {
if (negate == *((*requested_component_names)[i])) {
tmp = strdup((*requested_component_names)[i] + 1);
free((*requested_component_names)[i]);
(*requested_component_names)[i] = tmp;
*include_mode = false;
}
while (negate == requested[0] && '\0' != requested[0]) {
*include_mode = false;
++requested;
}
/* Double check to ensure that the user did not specify the negate
character anywhere else in the value. */
i = 0;
while ('\0' != requested[i]) {
if (negate == requested[i]) {
opal_show_help("help-mca-base.txt",
"framework-param:too-many-negates",
true, requested_orig);
free(requested_orig);
return OPAL_ERROR;
}
++i;
}
/* Split up the value into individual component names */
*requested_component_names = opal_argv_split(requested, ',');
/* All done */
free(requested_orig);
return OPAL_SUCCESS;
}