Have 'salloc' use $SHELL or /bin/sh as the fallback shell.
This is useful in situations where glibc’s Name Service Switch (NSS) is
dysfunctional (with ‘getpwuid’ returning NULL), which can happen when
/etc/nsswitch.conf specifies plugins that fail to be loaded in user code, for
instance because user code is linked against an incompatible libc.
Similar patch submitted upstream: https://bugs.schedmd.com/show_bug.cgi?id=19896
diff --git a/src/salloc/opt.c b/src/salloc/opt.c
index ffff7c8..74563ad 100644
--- a/src/salloc/opt.c
+++ b/src/salloc/opt.c
@@ -329,6 +329,7 @@ static void _opt_args(int argc, char **argv, int het_job_offset)
* NOTE: This function is NOT reentrant (see getpwuid_r if needed) */
static char *_get_shell(void)
{
+ char *shell;
struct passwd *pw_ent_ptr;
if (opt.uid == SLURM_AUTH_NOBODY)
@@ -336,11 +337,13 @@ static char *_get_shell(void)
else
pw_ent_ptr = getpwuid(opt.uid);
- if (!pw_ent_ptr) {
- pw_ent_ptr = getpwnam("nobody");
- warning("no user information for user %u", opt.uid);
+ if (pw_ent_ptr) {
+ shell = pw_ent_ptr->pw_shell;
+ } else {
+ shell = getenv("SHELL") ?: "/bin/sh";
+ warning("no user information for user %u, using '%s' as the shell", opt.uid, shell);
}
- return pw_ent_ptr->pw_shell;
+ return shell;
}
static void _salloc_default_command(int *argcp, char **argvp[])
ref='/guix/commit/gnu/system/examples/bare-hurd.tmpl?id=4f3e5548fcc2c0bbd9a5ecaf76a4fc63d2439aa3'>commitdiff
|
Age | Commit message (Expand) | Author |
2021-08-29 | Migrate to the new 'targets' field of bootloader-configuration....The old 'target' field is deprecated; adjust the sources to use the new
'targets' one instead.
* doc/guix-cookbook.texi<target>: Replace by 'targets'.
* gnu/bootloader/grub.scm: Likewise.
* gnu/installer/parted.scm: Likewise.
* gnu/machine/digital-ocean.scm: Likewise.
* gnu/system/examples/asus-c201.tmpl: Likewise
* gnu/system/examples/bare-bones.tmpl: Likewise
* gnu/system/examples/bare-hurd.tmpl: Likewise
* gnu/system/examples/beaglebone-black.tmpl: Likewise
* gnu/system/examples/desktop.tmpl: Likewise
* gnu/system/examples/docker-image.tmpl: Likewise
* gnu/system/examples/lightweight-desktop.tmpl: Likewise
* gnu/system/examples/vm-image.tmpl: Likewise
* gnu/system/examples/yggdrasil.tmpl: Likewise
* gnu/system/hurd.scm: Likewise
* gnu/system/images/hurd.scm: Likewise
* gnu/system/images/novena.scm: Likewise
* gnu/system/images/pine64.scm: Likewise
* gnu/system/images/pinebook-pro.scm: Likewise
* gnu/system/images/rock64.scm: Likewise
* gnu/system/install.scm: Likewise
* gnu/system/vm.scm: Likewise
* gnu/tests.scm: Likewise
* gnu/tests/ganeti.scm: Likewise
* gnu/tests/install.scm: Likewise
* gnu/tests/nfs.scm: Likewise
* gnu/tests/telephony.scm: Likewise
* tests/boot-parameters.scm: Likewise
* tests/system.scm: Likewise
| Maxim Cournoyer |
2021-01-19 | system: Rename 'disk-image' command 'image'....* guix/scripts/system.scm (system-derivation-for-action): Rename 'disk-image'
command 'image'. Warn when using the now deprecated 'disk-image' command.
(show-help): Adapt accordingly.
(guix-system): Ditto.
* tests/guix-system.sh: Ditto.
* gnu/system/examples/bare-hurd.tmpl: Ditto.
* doc/guix.texi (Building the Installation Image,
Building the Installation Image for ARM Boards,
Invoking guix pack,
Invoking guix system): Adapt documentation.
| Mathieu Othacehe |
2020-10-09 | system: hurd: Add PAM support with shadow and sudo....* gnu/system.scm (hurd-default-essential-services): Add
setuid-program-service-type.
* gnu/system/hurd.scm (%base-packages/hurd): Add shadow, sudo.
(%setuid-programs/hurd): New variable.
(%hurd-default-operating-system)[setuid-program]: Use it.
[pam-services, sudoers-file]: Remove overrides; enabling regular defaults.
* gnu/system/examples/bare-hurd.tmpl (%hurd-os)[users]: New field.
[services]: Do not disable PAM in SSH.
| Jan (janneke) Nieuwenhuizen |
2020-06-13 | system: bare-hurd.tmpl: Add openssh-sans-x client and service....* gnu/system/examples/bare-hurd.tmpl (%hurd-os)[packages]: Add openssh-sans-x.
[services]: Add openssh-service. Add example usage.
| Jan (janneke) Nieuwenhuizen |
2020-06-08 | system: examples: Add bare-hurd.tmpl....* gnu/system/hurd.scm (%hurd-def%hurd-default-operating-system-kernel,
%hurd-default-operating-system): New exported variables.
* gnu/system/examples/bare-hurd.tmpl: New file.
* Makefile.am (EXAMPLES): Add it.
* tests/guix-system.sh: Add --target=i586-pc-gnu when testing it.
| Jan (janneke) Nieuwenhuizen |