zsh-workers
 help / color / mirror / code / Atom feed
* The pattern containing NUL.
@ 1999-07-19  4:38 Tanaka Akira
  1999-07-19  8:09 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Tanaka Akira @ 1999-07-19  4:38 UTC (permalink / raw)
  To: zsh-workers

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.

Z(2):akr@localhost% gdb Src/zsh zsh.core
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsd"...
Core was generated by `zsh'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.so...done.
Reading symbols from /usr/lib/libtermcap.so.0.0...done.
Reading symbols from /usr/lib/libc.so.12.40...done.
#0  0x400ea273 in strcpy ()
(gdb) where
#0  0x400ea273 in strcpy ()
#1  0xc1ab5 in ?? ()
#2  0x46797 in paramsubst (l=0xc1a3c, n=0xc1a68, str=0xefbfd22c, qt=1, ssub=0)
    at subst.c:1679
#3  0x41df9 in stringsubst (list=0xc1a3c, node=0xc1a68, ssub=0) at subst.c:122
#4  0x41b63 in prefork (list=0xc1a3c, flags=0) at subst.c:71
#5  0x10509 in execcmd (cmd=0xc18cc, input=0, output=0, how=2, last1=2)
    at exec.c:1505
#6  0xf142 in execpline2 (pline=0xc1a1c, how=2, input=0, output=0, last1=0)
    at exec.c:1054
#7  0xe83b in execpline (l=0xc18b8, how=2, last1=0) at exec.c:869
#8  0xe403 in execlist (list=0xc1a2c, dont_change_job=0, exiting=0)
    at exec.c:738
#9  0x24203 in loop (toplevel=1, justonce=0) at init.c:143
#10 0x19f9 in main (argc=2, argv=0xefbfd4d8) at ./main.c:89
(gdb) 
-- 
Tanaka Akira


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

* Re: The pattern containing NUL.
  1999-07-19  4:38 The pattern containing NUL Tanaka Akira
@ 1999-07-19  8:09 ` Peter Stephenson
  1999-07-19 14:05   ` Tanaka Akira
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 1999-07-19  8:09 UTC (permalink / raw)
  To: zsh-workers

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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

* Re: The pattern containing NUL.
  1999-07-19  8:09 ` Peter Stephenson
@ 1999-07-19 14:05   ` Tanaka Akira
  0 siblings, 0 replies; 3+ messages in thread
From: Tanaka Akira @ 1999-07-19 14:05 UTC (permalink / raw)
  To: zsh-workers

In article <9907190809.AA35966@ibmth.df.unipi.it>,
  Peter Stephenson <pws@ibmth.df.unipi.it> writes:

> 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?

Yes. It fix the problem. Thanks.
-- 
Tanaka Akira


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

end of thread, other threads:[~1999-07-19 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-19  4:38 The pattern containing NUL Tanaka Akira
1999-07-19  8:09 ` Peter Stephenson
1999-07-19 14:05   ` Tanaka Akira

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).