summary refs log tree commit diff
path: root/src/Makefile.am
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2014-09-29 22:52:41 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2014-09-29 22:52:41 +0800
commitef91d3d6a4c39421fd3a391e02cd82f9f3aee4a8 (patch)
tree9d7e3577d31c1a291835b1ab4752dc7d507f44f7 /src/Makefile.am
parent[INPUT] Kill pgetc_macro (diff)
downloaddash-ef91d3d6a4c39421fd3a391e02cd82f9f3aee4a8.tar.gz
dash-ef91d3d6a4c39421fd3a391e02cd82f9f3aee4a8.zip
[PARSER] Handle backslash newlines properly after dollar sign
On Tue, Aug 26, 2014 at 12:34:42PM +0000, Eric Blake wrote:
> On 08/26/2014 06:15 AM, Oleg Bulatov wrote:
> > Hi!
> > 
> > While playing with sh generators I found that dash and bash have different
> > interpretations for <slash><newline> sequence.
> > 
> > $ dash -c 'EDIT=xxx; echo $EDIT\
> >> OR'
> > xxxOR
> 
> Buggy.
> 
> > $ bash -c 'EDIT=xxx; echo $EDIT\
> > OR'
> > /usr/bin/vim
> 
> Correct behavior.
> 
> > 
> > $ dash -c 'echo "$\
> > (pwd)"'
> > $(pwd)
> > 
> > Is it undefined behaviour in POSIX?
> 
> No, it's well-defined, and dash is buggy.  POSIX says:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03
> 
> "the shell shall break its input into tokens by applying the first
> applicable rule below to the next character in its input"
> 
> Rule 4 covers backslash handling, while rule 5 covers locating the end
> of a word to be subject to $ expansion.  Therefore, rule 4 should happen
> first.  Rule 4 defers to the section on quoting, with the caveat that
> <newline> joining is the only substitution that happens immediately as
> part of the parsing:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02
> 
> "If a <newline> follows the <backslash>, the shell shall interpret this
> as line continuation. The <backslash> and <newline> shall be removed
> before splitting the input into tokens. Since the escaped <newline> is
> removed entirely from the input and is not replaced by any white space,
> it cannot serve as a token separator."
> 
> So the fact that dash is treating the elided backslash-newline as a
> token separator, and parsing your input as if ${EDIT}OR instead of
> ${EDITOR} is a bug in dash.

I agree.  This patch should resolve this problem and similar ones
affecting blackslash newlines after we encounter a dollar sign.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/Makefile.am')
0 files changed, 0 insertions, 0 deletions
/td>June McEnroe I expected to have to remove some arbitrary colors, but it seems like just the range 2-75 works fine. 2020-02-10Add -HJune McEnroe 2020-02-10Hash to colors in the range 2-75June McEnroe Colors 76-87 seem too light, some almost appearing white. Colors 88-98 are shades of gray. 2020-02-10Improve color fudgingJune McEnroe Prevent fudged colors from ever being pure black. Distribute fudged colors between normal and bold if COLORS is 8. Fudge colors before checking if it's a pre-allocated pair. 2020-02-10Support all 99 IRC colorsJune McEnroe Corresponding ANSI colors from the table on ircdocs. 2020-02-10Avoid coloring mentions if there are control codesJune McEnroe This was breaking leading color codes. 2020-02-10Recalculate unreadLines on reflowJune McEnroe 2020-02-10Only make windows hotterJune McEnroe A warm message shouldn't clear a window's hotness. 2020-02-10Always increase unreadLinesJune McEnroe So that if you switch to a window and some new activity happens before you press M-u, it'll still jump to the right place. 2020-02-10Move scroll marker on resizeJune McEnroe 2020-02-10Update line count for words longer than linesJune McEnroe 2020-02-10Simplify mark, heat, unread trackingJune McEnroe 2020-02-10Update prompt when own nick changesJune McEnroe 2020-02-10Match URLs surrounded by parenthesesJune McEnroe But include a pair of parentheses in the URL itself. 2020-02-10Fix M-a so it properly cycles back to where it startedJune McEnroe 2020-02-09Add M-lJune McEnroe 2020-02-09Add /whoisJune McEnroe 2020-02-09Add /msgJune McEnroe