NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/56972 (sh: read builtin mishandles backslash in input)

Synopsis: sh: read builtin mishandles backslash in input

State-Changed-From-To: open->analyzed
State-Changed-When: Fri, 19 Aug 2022 04:43:16 +0000
Problem understood.  Fix being tested.

This issue goes back to when read was last touched (not long before
NetBSD 3 was released -- 2005).  Before then read was so broken that
what happened in this area can be considered irrelevant.

This problem occurs when all the characters to be assigned to any
variable (except the last var) are escaped (whether they needed to be or
not).  A single unescaped char in there would hide the problem.  Processing
that was supposed to happen for chars being added to a word (the thing
assigned to any var but the last) was being skipped for escaped chars
which are processed separately.  The fix is trivial.

But while testing here I noticed a problem in this area with the
last var as well.  That is supposed to have trailing IFS whitespace
removed, which was being done ... whether or not that whitespace
had been escaped.   The fix for that is almost as trivial, and
will be done as part of this PR.

Home | Main Index | Thread Index | Old Index