From 6c5142c792c09b202166e8240d8b7f54d0673afc Mon Sep 17 00:00:00 2001 From: Alexey Tourbin Date: Tue, 20 Nov 2007 08:20:48 +0300 Subject: [PATCH] shell.req: removed "function" from "alias|keyword|builtin" check It seems that our /bin/bash interpreter does not have any "built-in" functions by default. $ bash -c 'foo() { :; }; set' |grep ' ()' foo () $ bash -c 'set' |grep ' ()' $ Thus funcions can be user-defined only. Generally, what was wrong with this "function" check is that it was executed in shell.req context. That is, since e.g. "Info" and "Fatal" are functions within shell.req, all other dependencies on "Info" and "Fatal" were simply ignored. This was wrong and this has now been fixed. Another possibility to ignore current shell.req context while checking for built-in things is to spawn "clean" shell instance: - case "$(type -t -- "$2")" in + case "$($sh -c 'type -t "$1"' "$0" "$2")" in But this can be rather expensive at this early "cleanup" stage. --- scripts/shell.req.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/shell.req.in b/scripts/shell.req.in index a960df4..4f8414f 100755 --- a/scripts/shell.req.in +++ b/scripts/shell.req.in @@ -85,8 +85,7 @@ ShellReq() *) Info "$f: invalid $sh --rpm-requires output: $line"; continue ;; esac case "$(type -t -- "$2")" in - # XXX remove "function"? - alias|keyword|function|builtin) continue ;; + alias|keyword|builtin) continue ;; *) printf '%s\t%s\n' "$1" "$2" ;; esac done