From 6d29cecce106d0771d6f8b2bf2839c45ad170b5f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 5 Sep 2012 16:28:36 +0000 Subject: [PATCH] Fix the help message warning of multiple prefixes so it correctly prints out the info, and fix a typo. cmr:v1.7 This commit was SVN r27241. --- orte/tools/orterun/help-orterun.txt | 2 +- orte/tools/orterun/orterun.c | 40 ++++++++++++++++++----------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/orte/tools/orterun/help-orterun.txt b/orte/tools/orterun/help-orterun.txt index 8cfec11fb5..a8f09455f6 100644 --- a/orte/tools/orterun/help-orterun.txt +++ b/orte/tools/orterun/help-orterun.txt @@ -171,7 +171,7 @@ prefix provided for the first app_context: App prefix: %s Only one should be specified to avoid potential version -confusion. Operation will continue, but the applicaton's prefix +confusion. Operation will continue, but the application's prefix option will be ignored. # [orterun:empty-prefix] diff --git a/orte/tools/orterun/orterun.c b/orte/tools/orterun/orterun.c index c828f97bf4..80a91bfa6a 100644 --- a/orte/tools/orterun/orterun.c +++ b/orte/tools/orterun/orterun.c @@ -617,7 +617,6 @@ int orterun(int argc, char *argv[]) if (opal_cmd_line_is_taken(&cmd_line, "prefix") || '/' == argv[0][0] || want_prefix_by_default) { size_t param_len; - if ('/' == argv[0][0]) { char* tmp_basename = NULL; /* If they specified an absolute path, strip off the @@ -640,22 +639,29 @@ int orterun(int argc, char *argv[]) } /* if both are given, check to see if they match */ if (opal_cmd_line_is_taken(&cmd_line, "prefix") && NULL != orterun_globals.path_to_mpirun) { + char *tmp_basename; /* if they don't match, then that merits a warning */ param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0)); - if (0 != strcmp(param, orterun_globals.path_to_mpirun)) { + /* ensure we strip any trailing '/' */ + if (0 == strcmp(OPAL_PATH_SEP, &(param[strlen(param)-1]))) { + param[strlen(param)-1] = '\0'; + } + tmp_basename = strdup(orterun_globals.path_to_mpirun); + if (0 == strcmp(OPAL_PATH_SEP, &(tmp_basename[strlen(tmp_basename)-1]))) { + tmp_basename[strlen(tmp_basename)-1] = '\0'; + } + if (0 != strcmp(param, tmp_basename)) { orte_show_help("help-orterun.txt", "orterun:double-prefix", - true, orte_basename, param, - orterun_globals.path_to_mpirun, orte_basename); + true, orte_basename, orte_basename, + param, tmp_basename, orte_basename); /* use the prefix over the path-to-mpirun so that * people can specify the backend prefix as different * from the local one */ free(orterun_globals.path_to_mpirun); orterun_globals.path_to_mpirun = NULL; - } else { - /* since they match, just use param */ - free(orterun_globals.path_to_mpirun); } + free(tmp_basename); } else if (NULL != orterun_globals.path_to_mpirun) { param = orterun_globals.path_to_mpirun; } else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){ @@ -1675,18 +1681,22 @@ static int create_app(int argc, char* argv[], NULL != orterun_globals.prefix) { /* if they don't match, then that merits a warning */ param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0)); - if (0 != strcmp(param, orterun_globals.prefix)) { + /* ensure we strip any trailing '/' */ + if (0 == strcmp(OPAL_PATH_SEP, &(param[strlen(param)-1]))) { + param[strlen(param)-1] = '\0'; + } + value = strdup(orterun_globals.prefix); + if (0 == strcmp(OPAL_PATH_SEP, &(value[strlen(value)-1]))) { + value[strlen(value)-1] = '\0'; + } + if (0 != strcmp(param, value)) { orte_show_help("help-orterun.txt", "orterun:app-prefix-conflict", - true, orte_basename, orterun_globals.prefix, param); + true, orte_basename, value, param); /* let the global-level prefix take precedence since we - * know that one is being used + * know that one is being used */ free(param); - param = orterun_globals.prefix; - } else { - /* since they match, just use param */ - free(orterun_globals.prefix); - orterun_globals.prefix = NULL; + param = strdup(orterun_globals.prefix); } } else if (NULL != orterun_globals.prefix) { param = orterun_globals.prefix;