dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dash bug: double-quoted "\" breaks glob protection for next char
@ 2018-02-13 13:53 Denys Vlasenko
  2018-02-13 22:45 ` Martijn Dekker
  2018-02-14 20:03 ` Harald van Dijk
  0 siblings, 2 replies; 5+ messages in thread
From: Denys Vlasenko @ 2018-02-13 13:53 UTC (permalink / raw)
  To: Herbert Xu, dash

$ >'\zzzz'
$ >'\wwww'
$ dash -c 'echo "\*"'
\wwww \zzzz

The cause: uses "\\*" pattern instead of "\\\*".
The fix:

                        /* backslash */
                        case CBACK:
                                c = pgetc2();
                                if (c == PEOF) {
                                        USTPUTC(CTLESC, out);
                                        USTPUTC('\\', out);
                                        pungetc();
                                } else if (c == '\n') {
                                        nlprompt();
                                } else {
                                        if (
                                                dblquote &&
                                                c != '\\' && c != '`' &&
                                                c != '$' && (
                                                        c != '"' ||
                                                        eofmark != NULL
                                                )
                                        ) {
USTPUTC(CTLESC, out); // add this line
                                                USTPUTC('\\', out);
                                        }
                                        USTPUTC(CTLESC, out);
                                        USTPUTC(c, out);
                                        quotef++;
                                }

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-14 22:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 13:53 dash bug: double-quoted "\" breaks glob protection for next char Denys Vlasenko
2018-02-13 22:45 ` Martijn Dekker
2018-02-14 20:03 ` Harald van Dijk
2018-02-14 21:44   ` Harald van Dijk
2018-02-14 22:50     ` Harald van Dijk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).