Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh heredoc crash



[>workers]

On Sep 9,  5:35pm, Peter Stephenson wrote:
} Subject: Re: zsh heredoc crash
}
} On Fri, 9 Sep 2016 16:33:19 +0200
} Kamil Dudka <kdudka@xxxxxxxxxx> wrote:
} > On Friday, September 09, 2016 10:00:54 Paulo Cesar Pereira de Andrade wrote:
} > > ---8<---
} > > #!/usr/bin/zsh
} > > 
} > > cat >> /tm/ptry <<EOF
} > > export A="$(tr '\n' ' ' <<BLDARC
} > > content
} > > BLDARC)"
} > > EOF
} > > ---8<---
} > 
} > I was not able to make upstream zsh 5.0.2 crash with the above reproducer.
} 
} That's the underlying bug Paulo is talking about, yes
} (zsh-workers/34322).

I get:

torch% cat >> /tmp/try <<EOF
heredoc> export A="$(tr '\n' ' ' <<BLDARC
heredoc> content
heredoc> BLDARC)"
heredoc> EOF
zsh: parse error

However, if I add another line break, it works:

torch% cat >> /tmp/try <<EOF
export A="$(tr '\n' ' ' <<BLDARC
content
BLDARC  
)" 
EOF
torch% cat /tmp/try
export A="content "
torch% 

This is because gethere() is looking for a *line* containing only the end
token, even though the top of the call chain is parse_event(OUTPAR).  The
desired end token is not passed down through par_sublist().



Messages sorted by: Reverse Date, Date, Thread, Author