From 91fcb8c42c7e995517cd2b476366b5c4f6c74b6f Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 29 Feb 2020 09:53:53 +0100 Subject: [PATCH] Revert "read: discard IFS delimiters before the last token" See #6650. This reverts commit 1410f938aad04216d824aec747bc7919849d7005. --- src/builtin_read.cpp | 8 -------- tests/checks/read.fish | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/src/builtin_read.cpp b/src/builtin_read.cpp index 67ac9afe8..3600953a2 100644 --- a/src/builtin_read.cpp +++ b/src/builtin_read.cpp @@ -607,14 +607,6 @@ int builtin_read(parser_t &parser, io_streams_t &streams, wchar_t **argv) { wcstring substr; loc = wcstring_tok(buff, (vars_left() > 1) ? opts.delimiter : wcstring(), loc); 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); } vars.set_one(*var_ptr++, opts.place, substr); diff --git a/tests/checks/read.fish b/tests/checks/read.fish index 55c8e580e..f41db3de9 100644 --- a/tests/checks/read.fish +++ b/tests/checks/read.fish @@ -345,13 +345,3 @@ echo c $c # CHECK: a 'afoo barb' # CHECK: b # 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