-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply patch to openmpi to allow running as root inside Docker
- Loading branch information
1 parent
3db6043
commit 70c57a9
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Allow override environment variables to work. This is required for running as root inside a docker container (e.g. Gitlab CI) | ||
|
||
See https://github.com/open-mpi/ompi/pull/5597#issuecomment-520612783 | ||
--- a/orte/tools/orterun/orterun.c | ||
+++ b/orte/tools/orterun/orterun.c | ||
@@ -143,6 +143,14 @@ int orterun(int argc, char *argv[]) | ||
* exit with a giant warning flag | ||
*/ | ||
if (0 == geteuid() && !orte_cmd_options.run_as_root) { | ||
+ char *r1, *r2; | ||
+ if (NULL != (r1 = getenv("OMPI_ALLOW_RUN_AS_ROOT")) && | ||
+ NULL != (r2 = getenv("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"))) { | ||
+ if (0 == strcmp(r1, "1") && 0 == strcmp(r2, "1")) { | ||
+ goto moveon; | ||
+ } | ||
+ } | ||
+ | ||
fprintf(stderr, "--------------------------------------------------------------------------\n"); | ||
if (NULL != orte_cmd_options.help) { | ||
fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename); | ||
@@ -160,6 +168,7 @@ int orterun(int argc, char *argv[]) | ||
exit(1); | ||
} | ||
|
||
+ moveon: | ||
/* setup to listen for commands sent specifically to me, even though I would probably | ||
* be the one sending them! Unfortunately, since I am a participating daemon, | ||
* there are times I need to send a command to "all daemons", and that means *I* have |