Date: Wed, 8 Sep 2010 20:35:43 +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: r212339 - in head: bin/sh tools/regression/bin/sh/builtins Message-ID: <201009082035.o88KZhIx073736@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Wed Sep 8 20:35:43 2010 New Revision: 212339 URL: http://svn.freebsd.org/changeset/base/212339 Log: sh: Fix 'read' if all chars before the first IFS char are backslash-escaped. Backslash-escaped characters did not set the flag for a non-IFS character. MFC after: 2 weeks Added: head/tools/regression/bin/sh/builtins/read4.0 (contents, props changed) head/tools/regression/bin/sh/builtins/read4.0.stdout (contents, props changed) Modified: head/bin/sh/miscbltin.c Modified: head/bin/sh/miscbltin.c ============================================================================== --- head/bin/sh/miscbltin.c Wed Sep 8 20:10:29 2010 (r212338) +++ head/bin/sh/miscbltin.c Wed Sep 8 20:35:43 2010 (r212339) @@ -174,6 +174,7 @@ readcmd(int argc __unused, char **argv _ continue; if (backslash) { backslash = 0; + startword = 0; if (c != '\n') STPUTC(c, p); continue; Added: head/tools/regression/bin/sh/builtins/read4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/read4.0 Wed Sep 8 20:35:43 2010 (r212339) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +printf '%s\n' '\a\ b c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a b\ c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a\:b:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a:b\:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } Added: head/tools/regression/bin/sh/builtins/read4.0.stdout ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/read4.0.stdout Wed Sep 8 20:35:43 2010 (r212339) @@ -0,0 +1,8 @@ +xa bxcx +xaxb cx +xa:bxcx +xaxb:cx +x\xax +x\xax +x\ axx +x\:axx
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009082035.o88KZhIx073736>