sh: Backslash-newline should not affect field splitting in read builtin.
This was originally broken in r212339 in 2010.
This commit is contained in:
parent
bc522110e3
commit
718cf25701
@ -191,9 +191,10 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
CHECKSTRSPACE(1, p);
|
||||
if (backslash) {
|
||||
backslash = 0;
|
||||
startword = 0;
|
||||
if (c != '\n')
|
||||
if (c != '\n') {
|
||||
startword = 0;
|
||||
USTPUTC(c, p);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!rflag && c == '\\') {
|
||||
|
@ -121,6 +121,7 @@ FILES+= read4.0 read4.0.stdout
|
||||
FILES+= read5.0
|
||||
FILES+= read6.0
|
||||
FILES+= read7.0
|
||||
FILES+= read8.0
|
||||
FILES+= return1.0
|
||||
FILES+= return2.1
|
||||
FILES+= return3.1
|
||||
|
17
bin/sh/tests/builtins/read8.0
Normal file
17
bin/sh/tests/builtins/read8.0
Normal file
@ -0,0 +1,17 @@
|
||||
# $FreeBSD$
|
||||
|
||||
read a b c <<\EOF
|
||||
\
|
||||
A\
|
||||
\
|
||||
\
|
||||
\
|
||||
B\
|
||||
\
|
||||
\
|
||||
C\
|
||||
\
|
||||
\
|
||||
\
|
||||
EOF
|
||||
[ "$a.$b.$c" = "A.B.C" ]
|
Loading…
Reference in New Issue
Block a user