$(( causes parsing error NotImplementedError
Hello all, hopefully the following issue is related to this mailing list.
I recently noticed that the expression $(( causes a parsing error on shell-like functions. The $(( or arithmetic expansion, is a POSIX standard expression but it causes issues on the parser even before it is runs in sh. Is this expected, or documented anywhere?
Thank you for your time. The abbreviated error is below (sorry for the formatting)
Error during parse shell code, the last 5 lines are:
echo $((1 +2 ))
ERROR: Unable to parse /example.bb
Traceback (most recent call last):
File "/meta/poky/bitbake/lib/bb/pysh/pyshlex.py", line 600, in PLYLexer._parse(eof=True):
elif self._state==self.ST_QUOTED:
> self._parse_quoted(eof)
elif self._state==self.ST_HEREDOC:
File "/meta/poky/bitbake/lib/bb/pysh/pyshlex.py", line 688, in PLYLexer._parse_quoted(eof=True):
> wtree, remaining = self._wordlexer.add(input, eof)
self._wordlexer = None
File "//poky/bitbake/lib/bb/pysh/pyshlex.py", line 146, in WordLexer.add(data=['$', '(', '(', '1', ' ', '+', '2', ' ', ')', ')', '\n'], eof=True):
self._buffer += list(data)
> self._parse(eof)
File "/meta/poky/bitbake/lib/bb/pysh/pyshlex.py", line 324, in WordLexer._parse(eof=True):
> read, closed = parsefunc(buf, result, eof)
File "/meta/poky/bitbake/lib/bb/pysh/pyshlex.py", line 290, in WordLexer._parse_dollar(buf=['1', ' ', '+', '2', ' ', ')', ')', '\n'], result=['$((', ''], eof=True):
else:
> raise NotImplementedError(sep)
NotImplementedError: $((
Hi,
Quoted 7 lines · Paulo Neve
Hello all, hopefully the following issue is related to this mailing list.
I recently noticed that the expression $(( causes a parsing error on shell-like functions. The $(( or arithmetic expansion, is a POSIX standard expression but it causes issues on the parser even before it is runs in sh. Is this expected, or documented anywhere?
Quoted 5 lines
Thank you for your time. The abbreviated error is below (sorry for the formatting)
Error during parse shell code, the last 5 lines are:
echo $((1 +2 ))
The best list for this would be the bitbake mailing list. This is a known issue, basically our shell parsing code doesn't understand that expression. It is sad we don't support it, particularly as it is POSIX.
We've generally just been able to avoid code continaing that expression to avoid the issue so fixing it hasn't been a high priority.
Cheers,
Richard