popen does NOT require /bin/sh in a subchroot

I appears that when chrooted, the /bin/sh used by popen is that of the parent
process. This is true until the process forks once chrooted, which we do not
want to do.

As such, this actually makes things nicer. We don't need a /bin/sh in a chroot
to run install scriptlets, and don't need to check for it in the root directory

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Aaron Griffin 2007-11-29 23:30:57 -06:00 committed by Dan McGee
parent f8b113ed97
commit 9558639d80

View file

@ -475,10 +475,10 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
return(0); return(0);
} }
snprintf(tmpdir, PATH_MAX, "%sbin/sh", root); /* NOTE: popen will use the PARENT's /bin/sh, not the chroot's */
if(stat(tmpdir, &buf)) { if(stat("/bin/sh", &buf)) {
/* not found */ /* not found */
_alpm_log(PM_LOG_ERROR, _("No /bin/sh in root dir (%s), aborting scriptlet\n"), root); _alpm_log(PM_LOG_ERROR, _("No /bin/sh in parent environment, aborting scriptlet\n"));
return(0); return(0);
} }