zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: Lethal option-related bug
Date: Tue, 30 Jul 1996 10:19:09 +0200	[thread overview]
Message-ID: <199607300819.KAA18290@hydra.ifh.de> (raw)
In-Reply-To: "hzoli@cs.elte.hu"'s message of "Mon, 29 Jul 1996 20:03:45 MET." <199607291803.UAA05285@bolyai.cs.elte.hu>

hzoli@cs.elte.hu wrote:
> > It turns out to be easy to reproduce:
> > 
> > ./zsh -s
> > zsh: 7863 segmentation fault (core dumped)  ./zsh -s
> > the right fix, so I'll leave it.
> 
> OK, below is a simple and clean fix.  POSIX says that if IFS is unset it
> should be treated as if it were set to space-tab-newline.  Zsh does this
> but it adds an extra null here.

No, that doesn't work: you need to fix up wordchars as well which
causes the same problem.  (I didn't mention that in the original post
because I assumed whoever was making the patch would try it out and
discover this and perhaps other problems.)  The following less elegant
patch does at least fix the core dump.

*** Src/init.c.ifs	Mon Jul 29 18:01:46 1996
--- Src/init.c	Tue Jul 30 10:14:40 1996
***************
*** 59,64 ****
--- 59,67 ----
      opts[MONITOR] = 1;   /* may be unset in init_io() */
      opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid());
      opts[USEZLE] = 1;   /* may be unset in init_io() */
+     ifs         = ztrdup(" \t\n  ");
+     ifs[3]      = Meta;
+     wordchars   = ztrdup(DEFAULT_WORDCHARS);
      parseargs(argv);   /* sets INTERACTIVE, SHINSTDIN and SINGLECOMMAND */
  
      SHTTY = -1;
***************
*** 519,527 ****
  
      if (!(ttystrname = ztrdup(ttyname(SHTTY))))
  	ttystrname = ztrdup("");
-     ifs         = ztrdup(" \t\n  ");
-     ifs[3]      = Meta;
-     wordchars   = ztrdup(DEFAULT_WORDCHARS);
      postedit    = ztrdup("");
      underscore  = ztrdup("");
  
--- 522,527 ----

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


      reply	other threads:[~1996-07-30  8:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-29 15:59 Peter Stephenson
1996-07-29 18:03 ` Zoltan Hidvegi
1996-07-30  8:19   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199607300819.KAA18290@hydra.ifh.de \
    --to=pws@ifh.de \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).