shebang.req: Allow env with split-string arguments
Check for -S/--split-string= options, former could be (out of all other options) prefixed only with `i`. For now, this covers only the simplest cases where the first non-blank word is the command name itself. NB: /usr/bin/env -v is deliberately not supported. Link: https://bugzilla.altlinux.org/50059 Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
parent
6d5ff56099
commit
c0a25528e8
@ -41,6 +41,13 @@ ShebangReq()
|
||||
Warning "$f: trailing <CR> in arguments: $line"
|
||||
}
|
||||
|
||||
GetEnvCmd()
|
||||
{
|
||||
shift
|
||||
expr match "$*" "-i*S\s*\(\S\+\)" ||
|
||||
expr match "$*" "--split-string=\s*\(\S\+\)"
|
||||
}
|
||||
|
||||
local RPM_FINDPACKAGE_MANDATORY=1
|
||||
case "$#,$1" in
|
||||
1,*)
|
||||
@ -57,7 +64,10 @@ ShebangReq()
|
||||
;;
|
||||
*,/usr/bin/env)
|
||||
CheckArgs "$*"
|
||||
local cmd
|
||||
cmd=$(GetEnvCmd "$@") ||
|
||||
Fatal "$f: too many arguments: $line"
|
||||
FindPackage "$f" "$cmd"
|
||||
;;
|
||||
*)
|
||||
CheckArgs "$*"
|
||||
|
Loading…
Reference in New Issue
Block a user