[aur-general] Backslash to split lines in `depends` array

Ido Rosen ido at kernel.org
Sun Nov 3 08:31:56 EST 2013


This is a bug in aura's array parsing logic, which is in Bash/Parser.hs
line :

array :: Parser [BashString]
array = concat . catMaybes <$> array' <?> "valid array"
    where array'  = char '(' *> spaces *> manyTill single' (char ')')
          single' = (Nothing <$ comment <* spaces) <|> (Just <$> single)

...and is missing backslash ('\\') support and is overly simplistic.
See for comparison the command parser in the same file (which has
backslash support):

command :: Parser Field
command = spaces *> (Command <$> many1 commandChar <*> option [] (try args))
    where commandChar = alphaNum <|> oneOf "./"
          args = char ' ' >> unwords <$> line >>= \ls ->
                   case parse (many1 single) "(command)" ls of
                     Left _   -> fail "Failed parsing strings in a command"
                     Right bs -> return $ concat bs
          line = (:) <$> many (noneOf "\n\\") <*> next
          next = ([] <$ char '\n') <|> (char '\\' *> spaces *> line)



On Sun, Nov 3, 2013 at 8:09 AM, Frederik "Freso" S. Olesen <
freso.dk at gmail.com> wrote:

> Den 03-11-2013 13:29, Fabien Dubosson skrev:
>
>> [...] So before filling a
>>
>> bug request to `aura`, I wanted to be sure that it is allowed/common to
>> use
>> `\` to split lines in the `depends` array?
>>
>
> For some more in-depth information than Rafael's commanding comment:
> 1) the \ character followed by a newline is used for breaking up long
> lines in (ba)sh code. The $depends array is thus perfectly valid bash, and
> I would file a bug report against aura to either make it not error - or at
> least change it to a warning, since:
> 2) there's no need to escape the newline in the $depends array, as
> newlines will just be treated like other whitespace until the array
> definition is ended by the ")" character, thus I would *also* do as Rafael
> "suggested" and ask the octave-hg to remove the backslash.
>
> --
> Frederik "Freso" S. Olesen <http://freso.dk/>
>


More information about the aur-general mailing list