Revert "read: discard IFS delimiters before the last token"

See #6650.

This reverts commit 1410f938aa.
This commit is contained in:
Johannes Altmanninger 2020-02-29 09:53:53 +01:00
parent 99851c09b3
commit 91fcb8c42c
2 changed files with 0 additions and 18 deletions

View File

@ -607,14 +607,6 @@ int builtin_read(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
wcstring substr; wcstring substr;
loc = wcstring_tok(buff, (vars_left() > 1) ? opts.delimiter : wcstring(), loc); loc = wcstring_tok(buff, (vars_left() > 1) ? opts.delimiter : wcstring(), loc);
if (loc.first != wcstring::npos) { if (loc.first != wcstring::npos) {
if (vars_left() == 1) { // Discard trailing delimiters, see #6406
loc.first =
std::find_if(buff.begin() + loc.first, buff.end(),
[&opts](wchar_t c) {
return opts.delimiter.find(c) == wcstring::npos;
}) -
buff.begin();
}
substr = wcstring(buff, loc.first, loc.second); substr = wcstring(buff, loc.first, loc.second);
} }
vars.set_one(*var_ptr++, opts.place, substr); vars.set_one(*var_ptr++, opts.place, substr);

View File

@ -345,13 +345,3 @@ echo c $c
# CHECK: a 'afoo barb' # CHECK: a 'afoo barb'
# CHECK: b # CHECK: b
# CHECK: c # CHECK: c
echo "a b b" | read a b
string escape $a $b
# CHECK: a
# CHECK: 'b b'
echo 'a<><>b<>b' | read -d '<>' a b
printf %s\n $a $b
# CHECK: a
# CHECK: <>b<>b