projects/guix·blob java-team · refs

26 lines · 950 B

1Have 'salloc' use $SHELL or /bin/sh as the fallback shell.
2
3This is useful in situations where glibc’s Name Service Switch (NSS) is
4dysfunctional (with ‘getpwuid’ returning NULL), which can happen when
5/etc/nsswitch.conf specifies plugins that fail to be loaded in user code, for
6instance because user code is linked against an incompatible libc.
7
8Similar patch submitted upstream: https://bugs.schedmd.com/show_bug.cgi?id=19896
9
10diff --git a/src/salloc/opt.c b/src/salloc/opt.c
11index f535600..848f099 100644
12--- a/src/salloc/opt.c
13+++ b/src/salloc/opt.c
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 }