From https://ftp.gnu.org/gnu/bash/bash-4.4-patches/bash44-012
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Bug-Reported-by: Clark Wang <dearvoid@gmail.com>
Bug-Reference-ID: <CADv8-ojttPUFOZXqbjsvy83LfaJtQKZ5qejGdF6j0VJ3vtrYOA@mail.gmail.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2016-11/msg00106.html
When -N is used, the input is not supposed to be split using $IFS, but
leading and trailing IFS whitespace was still removed.
Patch (apply with `patch -p0'):
*** bash-4.4-patched/subst.c 2017-01-20 14:22:01.000000000 -0500
--- b/subst.c 2017-01-25 13:43:22.000000000 -0500
/* Parse a single word from STRING, using SEPARATORS to separate fields.
ENDPTR is set to the first character after the word. This is used by
! the `read' builtin. This is never called with SEPARATORS != $IFS;
! it should be simplified.
XXX - this function is very similar to list_string; they should be
get_word_from_string (stringp, separators, endptr)
/* Parse a single word from STRING, using SEPARATORS to separate fields.
ENDPTR is set to the first character after the word. This is used by
! This is never called with SEPARATORS != $IFS, and takes advantage of that.
XXX - this function is very similar to list_string; they should be
+ #define islocalsep(c) (local_cmap[(unsigned char)(c)] != 0)
get_word_from_string (stringp, separators, endptr)
int sindex, sh_style_split, whitesep, xflags;
+ unsigned char local_cmap[UCHAR_MAX+1]; /* really only need single-byte chars here */
! for (xflags = 0, s = ifs_value; s && *s; s++)
if (*s == CTLESC) xflags |= SX_NOCTLESC;