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.
This commit is contained in:
Alexey Tourbin 2007-11-20 08:20:48 +03:00
parent d9a787cd0f
commit 6c5142c792

View File

@ -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