From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7215 invoked from network); 15 May 2002 07:38:23 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 15 May 2002 07:38:23 -0000 Received: (qmail 9476 invoked by alias); 15 May 2002 07:38:14 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17163 Received: (qmail 9464 invoked from network); 15 May 2002 07:38:14 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15586.4172.587990.806826@wischnow.berkom.de> Date: Wed, 15 May 2002 09:37:48 +0200 To: zsh-workers@sunsite.dk Subject: Re: completion in quotes - " vs ' - no suffix added In-Reply-To: <15585.11254.373249.131932@wischnow.berkom.de> References: <15576.54689.459113.686818@wischnow.berkom.de> <6134254DE87BD411908B00A0C99B044F02E89A73@mowd019a.mow.siemens.ru> <15577.7296.682622.411849@wischnow.berkom.de> <1020508153855.ZM7837@candle.brasslantern.com> <15583.34740.981994.404489@wischnow.berkom.de> <6134254DE87BD411908B00A0C99B044F02E89A8C@mowd019a.mow.siemens.ru> <1020513173320.ZM12360@candle.brasslantern.com> <1021313089.2926.10.camel@localhost.localdomain> <15584.49227.780505.590251@wischnow.berkom.de> <1020514142335.ZM13473@candle.brasslantern.com> <1020514143155.ZM13540@candle.brasslantern.com> <15585.11254.373249.131932@wischnow.berkom.de> X-Mailer: VM 6.95 under 21.5 (patch 3) "asparagus" XEmacs Lucid I wrote: > > Bart Schaefer wrote: > > > On May 14, 2:23pm, Bart Schaefer wrote: > > } > > } -rw-rw-r-- 1 schaefer schaefer 0 May 13 10:29 a\ b > > } drwxrwxr-x 2 schaefer schaefer 1024 May 13 10:29 a\ d/ > > } schaefer<503> zsh -c "ls a > > } schaefer<503> zsh -c "ls a\\\\\\ > > > > It's worse than that -- if I type TAB again at this point, the shell > > crashes. > > The number of backslashes is ok. > > But the segv not, obviously. A quick check shows that there's another > bug in the zle_tricky code, [...] I was wrong there, it was entirely in set_comp_sep(), the function that splits strings-as-command-lines. We have to treat backslashed backslashes correctly (there, not every backslash is turned int a Bnull, for obvious reasons, sorry, should have thought of that). Bye Sven Index: Src/Zle/compcore.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v retrieving revision 1.57 diff -u -r1.57 compcore.c --- Src/Zle/compcore.c 13 May 2002 09:32:00 -0000 1.57 +++ Src/Zle/compcore.c 15 May 2002 07:37:37 -0000 @@ -1268,7 +1268,7 @@ LinkList foo = newlinklist(); LinkNode n; int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs; - int tl, got = 0, i = 0, j, cur = -1, oll = ll, sl; + int tl, got = 0, i = 0, j, cur = -1, oll = ll, sl, css = 0; int remq = 0, dq = 0, odq, sq = 0, osq, issq = 0, sqq = 0, lsq = 0, qa = 0; int ois = instring, oib = inbackt, noffs = lp, ona = noaliases; char *tmp, *p, *ns, *ol = (char *) line, sav, *qp, *qs, *ts, qc = '\0'; @@ -1312,6 +1312,10 @@ if (*p == '\\' && p[1] == '\\') { dq++; chuck(p); + if (j > cs) { + cs++; + css++; + } if (!*p) break; } @@ -1343,9 +1347,13 @@ if (tok == ENDINPUT || tok == LEXERR) break; if (tokstr && *tokstr) { - for (p = tokstr; dq && *p; p++) - if (*p == Bnull) + for (p = tokstr; dq && *p; p++) { + if (*p == Bnull) { dq--; + if (p[1] == '\\') + dq--; + } + } if (issq) { for (p = tokstr, lsq = 0; *p; p++) { if (sq && *p == Snull) @@ -1369,7 +1377,7 @@ swb = wb - 1 - dq - sq; swe = we - 1 - dq - sq; sqq = lsq; - soffs = cs - swb; + soffs = cs - swb - css; chuck(p + soffs); ns = dupstring(p); } @@ -1423,8 +1431,11 @@ if (*p == Bnull && p[1]) { if (remq) swb -= 2; - if (odq) + if (odq) { swb--; + if (p[1] == '\\') + swb--; + } } } if (p[1] || *p != Bnull) { -- Sven Wischnowsky wischnow@berkom.de