Skip to content

Commit 9308211

Browse files
author
Ralph Castain
committed
Ensure that output-filename is passed as an absolute path
Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit f5c3239)
1 parent b6e825f commit 9308211

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

orte/orted/orted_submit.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2007-2017 Los Alamos National Security, LLC. All rights
1616
* reserved.
17-
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
1818
* Copyright (c) 2015-2017 Research Organization for Information Science
1919
* and Technology (RIST). All rights reserved.
2020
* Copyright (c) 2017 IBM Corporation. All rights reserved.
@@ -813,7 +813,19 @@ int orte_submit_job(char *argv[], int *index,
813813
}
814814
/* if we were asked to output to files, pass it along */
815815
if (NULL != orte_cmd_options.output_filename) {
816-
orte_set_attribute(&jdata->attributes, ORTE_JOB_OUTPUT_TO_FILE, ORTE_ATTR_GLOBAL, orte_cmd_options.output_filename, OPAL_STRING);
816+
/* if the given filename isn't an absolute path, then
817+
* convert it to one so the name will be relative to
818+
* the directory where prun was given as that is what
819+
* the user will have seen */
820+
if (!opal_path_is_absolute(orte_cmd_options.output_filename)) {
821+
char cwd[OPAL_PATH_MAX], path;
822+
getcwd(cwd, sizeof(cwd));
823+
path = opal_os_path(false, cwd, orte_cmd_options.output_filename, NULL);
824+
orte_set_attribute(&jdata->attributes, ORTE_JOB_OUTPUT_TO_FILE, ORTE_ATTR_GLOBAL, path, OPAL_STRING);
825+
free(path);
826+
} else {
827+
orte_set_attribute(&jdata->attributes, ORTE_JOB_OUTPUT_TO_FILE, ORTE_ATTR_GLOBAL, orte_cmd_options.output_filename, OPAL_STRING);
828+
}
817829
}
818830
/* if we were asked to merge stderr to stdout, mark it so */
819831
if (orte_cmd_options.merge) {

0 commit comments

Comments
 (0)