Date: Sun, 30 May 2010 14:20:32 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r208656 - in head: bin/sh tools/regression/bin/sh/parser Message-ID: <201005301420.o4UEKWXv067286@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun May 30 14:20:32 2010 New Revision: 208656 URL: http://svn.freebsd.org/changeset/base/208656 Log: sh: Fix a crash if a heredoc was not properly ended and parsing continued. Example (in interactive mode): cat <<EOF && ) The next command typed caused sh to segfault, because the state for the here document was not reset. Like parser_temp, this uses the fact that the parser is not re-entered. Added: head/tools/regression/bin/sh/parser/heredoc6.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun May 30 14:11:27 2010 (r208655) +++ head/bin/sh/parser.c Sun May 30 14:20:32 2010 (r208656) @@ -203,6 +203,7 @@ parsecmd(int interact) * which could happen if we add command substitution on PS1/PS2. */ parser_temp_free_all(); + heredoclist = NULL; tokpushback = 0; doprompt = interact; Added: head/tools/regression/bin/sh/parser/heredoc6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/heredoc6.0 Sun May 30 14:20:32 2010 (r208656) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +r= +! command eval ": <<EOF; )" 2>/dev/null; command eval : hi \${r:=0} +exit ${r:-3}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005301420.o4UEKWXv067286>