[Pkg-shadow-devel] Bug#623199: useradd: posix_spawn() error=ENOENT
Jonathan Nieder
jrnieder at gmail.com
Mon Apr 18 09:55:55 UTC 2011
Package: passwd
Version: 1:4.1.4.2+svn3283-3
Severity: minor
Justification: cosmetic
Tags: upstream
Hi,
With libc implementations (like glibc on hurd) that can return an
exec(2) error from posix_spawn, if nscd is not installed then useradd
and userdel write
Failed to flush the nscd cache.
posix_spawn() error=XXX
where XXX is the error number for ENOENT (0x10 << 26 + 2 = 1073741826
on Hurd) to stderr 4 times. It's just a warning message; no actual
harm done.
The cause: lib/nscd.c contains
char *spawnedArgs[] = {"/usr/sbin/nscd", "nscd", "-i", service, NULL};
char *spawnedEnv[] = {NULL};
/* spawn process */
err = posix_spawn (&pid, spawnedArgs[0], NULL, NULL,
spawnedArgs, spawnedEnv);
if(0 != err)
{
(void) fputs (_(MSG_NSCD_FLUSH_CACHE_FAILED), stderr);
(void) fprintf (stderr, "posix_spawn() error=%d\n", err);
return -1;
}
/* Wait for the spawned process to exit */
termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
if (-1 == termpid)
{
[...]
}
else if (termpid != pid)
{
[...]
}
return 0;
Questions:
* This ignores failure to nscd on platforms reporting it through
WIFEXITED(status) && WEXITSTATUS(status) == 127 but considers it an
error when it comes from the return value of posix_spawn. Which
behavior is intended?
One possibility might be to return 0 for ENOENT (since it is an
expected error) and ignore normal exits with nonzero status
(because nscd can exit with status 1 if the daemon wasn't
running or 127 if it doesn't exist) but report other errors.
* Is it intended that "nscd" is passed as argv[1] rather than argv[0]?
* Why not use the PATH (posix_spawnp) to discover where "nscd" is, to
allow the admin to install a copy to /usr/local/sbin/nscd?
* Is it safe to run nscd with an empty environment (in particular
without $PATH)? Is the environment scrubbing intended?
Thanks for keeping core programs in good shape. Thoughts welcome as
always.
Regards,
Jonathan
More information about the Pkg-shadow-devel
mailing list