| 1 | Have 'salloc' use $SHELL or /bin/sh as the fallback shell.
|
| 2 |
|
| 3 | This is useful in situations where glibc’s Name Service Switch (NSS) is
|
| 4 | dysfunctional (with ‘getpwuid’ returning NULL), which can happen when
|
| 5 | /etc/nsswitch.conf specifies plugins that fail to be loaded in user code, for
|
| 6 | instance because user code is linked against an incompatible libc.
|
| 7 |
|
| 8 | Similar patch submitted upstream: https://bugs.schedmd.com/show_bug.cgi?id=19896
|
| 9 |
|
| 10 | diff --git a/src/salloc/opt.c b/src/salloc/opt.c
|
| 11 | index f535600..848f099 100644
|
| 12 | |
| 13 | |
| 14 | @@ -333,8 +333,10 @@ static char *_get_shell(void)
|
| 15 | if (uid == SLURM_AUTH_NOBODY)
|
| 16 | uid = getuid();
|
| 17 |
|
| 18 | - if (!(shell = uid_to_shell(uid)))
|
| 19 | - fatal("no user information for user %u", uid);
|
| 20 | + if (!(shell = uid_to_shell(uid))) {
|
| 21 | + shell = getenv("SHELL") ?: "/bin/sh";
|
| 22 | + warning("no user information for user %u, using '%s' as the shell", opt.uid, shell);
|
| 23 | + }
|
| 24 |
|
| 25 | return shell;
|
| 26 | }
|