From 4853a4aad97fe36f9237ffb7356201adab507a1c Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 4 Oct 2007 21:36:25 -0500 Subject: Fail loudly is scriptlets cannot be run via /bin/sh If /bin/sh is missing in the root directory, scriptlets cannot be executed, as we're explicitly calling it. Signed-off-by: Aaron Griffin --- lib/libalpm/trans.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 9eb27c30..462b4d8b 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -552,6 +552,13 @@ int _alpm_runscriptlet(const char *root, const char *installfn, return(0); } + snprintf(tmpdir, PATH_MAX, "%sbin/sh", root); + if(stat(tmpdir, &buf)) { + /* not found */ + _alpm_log(PM_LOG_ERROR, _("No /bin/sh in root dir (%s), aborting scriptlet\n"), root); + return(0); + } + if(!strcmp(script, "pre_upgrade") || !strcmp(script, "pre_install")) { snprintf(tmpdir, PATH_MAX, "%stmp/", root); if(stat(tmpdir, &buf)) { -- cgit v1.2.3-24-g4f1b