Treat 'exec $1' like '$1' for the purpose of quoting (fixes #2068)
This commit is contained in:
parent
cc3884cf9f
commit
bd3299edd3
|
@ -422,6 +422,7 @@ getCommandNameAndToken direct t = fromMaybe (Nothing, t) $ do
|
|||
"busybox" -> firstArg
|
||||
"builtin" -> firstArg
|
||||
"command" -> firstArg
|
||||
"run" -> firstArg -- Used by bats
|
||||
"exec" -> do
|
||||
opts <- getBsdOpts "cla:" args
|
||||
(_, (t, _)) <- listToMaybe $ filter (null . fst) opts
|
||||
|
|
|
@ -1853,6 +1853,8 @@ prop_checkSpacefulness37v = verifyTree checkVerboseSpacefulness "@test 'status'
|
|||
prop_checkSpacefulness38= verifyTree checkSpacefulness "a=; echo $a"
|
||||
prop_checkSpacefulness39= verifyNotTree checkSpacefulness "a=''\"\"''; b=x$a; echo $b"
|
||||
prop_checkSpacefulness40= verifyNotTree checkSpacefulness "a=$((x+1)); echo $a"
|
||||
prop_checkSpacefulness41= verifyNotTree checkSpacefulness "exec $1 --flags"
|
||||
prop_checkSpacefulness42= verifyNotTree checkSpacefulness "run $1 --flags"
|
||||
|
||||
data SpaceStatus = SpaceSome | SpaceNone | SpaceEmpty deriving (Eq)
|
||||
instance Semigroup SpaceStatus where
|
||||
|
|
|
@ -370,8 +370,8 @@ usedAsCommandName tree token = go (getId token) (tail $ getPath tree token)
|
|||
| currentId == getId word = go id rest
|
||||
go currentId (T_DoubleQuoted id [word]:rest)
|
||||
| currentId == getId word = go id rest
|
||||
go currentId (T_SimpleCommand _ _ (word:_):_)
|
||||
| currentId == getId word = True
|
||||
go currentId (t@(T_SimpleCommand _ _ (word:_)):_) =
|
||||
getId word == currentId || getId (getCommandTokenOrThis t) == currentId
|
||||
go _ _ = False
|
||||
|
||||
-- A list of the element and all its parents up to the root node.
|
||||
|
|
Loading…
Reference in New Issue