Skip to content

Commit

Permalink
Merge pull request #12093 from jsquyres/pr/v4.1.x/allow-prefix-of-a-s…
Browse files Browse the repository at this point in the history
…ingle-slash

v4.1.x: ORTE: a prefix of "/" is ok
  • Loading branch information
jsquyres authored Nov 27, 2023
2 parents 3a1cd5f + f961d45 commit d9bc607
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
8 changes: 7 additions & 1 deletion orte/mca/plm/rsh/plm_rsh_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -475,7 +476,12 @@ static int setup_launch(int *argcptr, char ***argvptr,
*/

value = opal_basename(opal_install_dirs.bindir);
asprintf(&bin_base, "%s/%s", prefix_dir, value);
/* Ensure that we don't have a prefix that ends in "/" */
if ('/' == prefix_dir[strlen(prefix_dir) - 1]) {
asprintf(&bin_base, "%s%s", prefix_dir, value);
} else {
asprintf(&bin_base, "%s/%s", prefix_dir, value);
}
free(value);

if (NULL != orted_cmd) {
Expand Down
23 changes: 15 additions & 8 deletions orte/orted/orted_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017-2021 IBM Corporation. All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -487,10 +488,13 @@ int orte_submit_init(int argc, char *argv[],
param[param_len-1] = '\0';
param_len--;
if (0 == param_len) {
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
true, orte_basename, orte_basename);
free(param);
return ORTE_ERR_FATAL;
/* We get here if we removed all PATH_SEP's
and end up with an empty string. In this
case, the prefix is just a single
PATH_SEP. */
param[0] = '\\';
param[1] = '\0';
break;
}
}

Expand Down Expand Up @@ -1583,10 +1587,13 @@ static int create_app(int argc, char* argv[],
param[param_len-1] = '\0';
param_len--;
if (0 == param_len) {
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
true, orte_basename, orte_basename);
free(param);
return ORTE_ERR_FATAL;
/* We get here if we removed all PATH_SEP's
and end up with an empty string. In this
case, the prefix is just a single
PATH_SEP. */
param[0] = '\\';
param[1] = '\0';
break;
}
}
orte_set_attribute(&app->attributes, ORTE_APP_PREFIX_DIR, ORTE_ATTR_GLOBAL, param, OPAL_STRING);
Expand Down
6 changes: 1 addition & 5 deletions orte/tools/orterun/help-orterun.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -174,11 +175,6 @@ Only one should be specified to avoid potential version
confusion. Operation will continue, but the application's prefix
option will be ignored.
#
[orterun:empty-prefix]
A prefix was supplied to %s that only contained slashes.

This is a fatal error; %s will now abort. No processes were launched.
#
[debugger-mca-param-not-found]
Internal error -- the orte_base_user_debugger MCA parameter was not able to
be found. Please contact the Open RTE developers; this should not
Expand Down

0 comments on commit d9bc607

Please sign in to comment.