Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: The pattern containing NUL.
- X-seq: zsh-workers 7192
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: The pattern containing NUL.
- Date: Mon, 19 Jul 1999 10:09:42 +0200
- In-reply-to: "Tanaka Akira"'s message of "19 Jul 1999 13:38:43 DFT." <rsq7lnxuucs.fsf@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Tanaka Akira wrote:
> zsh-3.1.6-test-1 dumps core as following on NetBSD 1.4.
>
> Z(2):akr@localhost% Src/zsh -f
> localhost% print $OSTYPE
> netbsd1.4
> localhost% print $ZSH_VERSION
> 3.1.6-test-1
> localhost% tmp=a
> localhost% print "${line#$'\0'}"
> zsh: segmentation fault (core dumped) Src/zsh -f
> Z(2):akr@localhost%
>
> The backtrace was follows.
Well, I can't get the core dump and don't entirely believe the backtrace,
but there does seem to be a bug... does this fix it?
We really need a pattern matching expert to fix up the globbing code. It's
slow and complicated (all right, it would look out of place if wasn't).
--- Src/glob.c.null Sun Jul 18 17:37:35 1999
+++ Src/glob.c Mon Jul 19 10:03:42 1999
@@ -2724,6 +2724,9 @@
* Here we bypass tulower() and tuupper() for speed.
*/
int xi = (STOUC(UNMETA(x)) & 0xff), yi = (STOUC(UNMETA(y)) & 0xff);
+ /* A NULL is a real null, since a \000 would be metafied. */
+ if (!*x || !*y)
+ return 0;
return xi == yi ||
(((c->stat & C_IGNCASE) ?
((isupper(xi) ? tolower(xi) : xi) ==
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author