From: Colin Guthrie Date: Tue, 14 Aug 2012 21:09:39 +0000 (+0100) Subject: install/dracut-install.c: Ensure deps are resolved when handling scripts X-Git-Tag: 024~109 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68318328f1fc394ac043b939425715ba78dc6f57;p=thirdparty%2Fdracut.git install/dracut-install.c: Ensure deps are resolved when handling scripts If we are doing lazy dep solving and happen to process a script with a shebang on e.g. /bin/bash before we encounter the actual binary itself we effectively ignore the fact that we've been asked to resolve the deps and put the item in the 'seen' hashmap. Thus when we later really do try and resolve deps, we short circuit and don't do anything. Example test case: $ cd $ mkdir -p foo/bin $ cp /bin/bash foo/bin $ echo '#!/bin/bash' >foo/bin/script $ dracut-install -D $HOME/foo -R $HOME/foo/bin/script $HOME/foo/bin/bash --- diff --git a/install/dracut-install.c b/install/dracut-install.c index e79065dde..9a244baac 100644 --- a/install/dracut-install.c +++ b/install/dracut-install.c @@ -392,10 +392,15 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res } if (ret == 0) { - log_debug("'%s' already exists", fulldstpath); + if (resolvedeps) { + log_debug("'%s' already exists, but checking for any deps", fulldstpath); + ret = resolve_deps(src); + } else + log_debug("'%s' already exists", fulldstpath); + free(fulldstpath); /* dst does already exist */ - return 0; + return ret; } /* check destination directory */