1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix a syntax error when ((...)) is combined with redirections (#68)

This bugfix was backported from ksh93v- 2013-10-10-alpha.

src/cmd/ksh93/sh/parse: item():
- The done label is placed after the 'inout' call for handling I/O
  redirections. This causes the command below to produce a syntax
  error because the '>' is not handled as a redirection operator
  after 'goto done':
  $ ((1+2)) > /dev/null
  /usr/bin/ksh: syntax error: `>' unexpected
  Moving the done label fixes the syntax error as 'inout' is now
  called to handle the redirection operator.

src/cmd/ksh93/tests/arith.sh:
- Add a simple regression test.
This commit is contained in:
Johnothan King 2020-07-09 14:12:04 -07:00 committed by GitHub
parent 361fe1fcc3
commit 6930666234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -1367,13 +1367,13 @@ static Shnode_t *item(Lex_t *lexp,int flag)
return(t);
}
sh_lex(lexp);
/* redirection(s) following a compound command */
done:
/* redirection(s) following a compound command or arithmetic expression */
if(io=inout(lexp,io,0))
{
t=makeparent(lexp,TSETIO,t);
t->tre.treio=io;
}
done:
lexp->lasttok = savwdval;
lexp->lastline = savline;
return(t);