disable parsing of &> as GNU bash iop if -o posix or -o sh, based on IRC discussion where jilles(IIRC) pointed out it breaks existing valid scripts

This commit is contained in:
tg
2013-03-24 15:01:50 +00:00
parent 8697048c2c
commit a3b5e77c6c
4 changed files with 31 additions and 8 deletions

5
lex.c
View File

@@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.182 2013/02/19 18:45:20 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.183 2013/03/24 15:01:48 tg Exp $");
/*
* states while lexing word
@@ -898,7 +898,8 @@ yylex(int cf)
state = SBASE;
dp = Xstring(ws, wp);
if ((c == '<' || c == '>' || c == '&') && state == SBASE) {
if (state == SBASE && (c == '<' || c == '>' ||
(!Flag(FSH) && !Flag(FPOSIX) && c == '&'))) {
struct ioword *iop = alloc(sizeof(struct ioword), ATEMP);
if (Xlength(ws, wp) == 0)