Skip to content

Commit

Permalink
Revert "read: discard IFS delimiters before the last token"
Browse files Browse the repository at this point in the history
See #6650.

This reverts commit 1410f93.
  • Loading branch information
krobelus committed Feb 29, 2020
1 parent 99851c0 commit 91fcb8c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
8 changes: 0 additions & 8 deletions src/builtin_read.cpp
Expand Up @@ -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);
Expand Down
10 changes: 0 additions & 10 deletions tests/checks/read.fish
Expand Up @@ -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

0 comments on commit 91fcb8c

Please sign in to comment.