zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: SEGV with alias\
Date: Fri, 24 Jul 2015 09:53:22 +0100	[thread overview]
Message-ID: <20150724095322.7dba34af@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <150723193351.ZM16103@torch.brasslantern.com>

On Thu, 23 Jul 2015 19:33:51 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jul 23,  3:18pm, Bart Schaefer wrote:
> } Subject: Re: SEGV with alias\
> }
> } On Thu, Jul 23, 2015 at 2:52 PM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> } > [CCing reporter of the recent ihungetc() issue]
> } >
> } > Typing <l><s><Backslash><Enter><Enter> may segfault if 'ls' is aliased.
> } 
> 
> It doesn't crash any more, but with debug enabled it prints
>     Warning: backing up wrong character.
> forever.

I can stop this cleanly, but I still don't know what the code chunk is
doing.

pws

diff --git a/Src/hist.c b/Src/hist.c
index cf224cb..75e809c 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -906,7 +906,8 @@ ihungetc(int c)
     while (!lexstop && !errflag) {
 	if (hptr[-1] != (char) c && stophist < 4 &&
 	    hptr > chline + 1 && hptr[-1] == '\n' && hptr[-2] == '\\' &&
-	    !(histactive & HA_UNGET)) {
+	    !(histactive & HA_UNGET) &&
+	    (inbufflags & (INP_ALIAS|INP_HIST)) != INP_ALIAS) {
 	    histactive |= HA_UNGET;
 	    hungetc('\n');
 	    hungetc('\\');


      reply	other threads:[~2015-07-24  8:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 21:52 Daniel Shahaf
2015-07-23 22:18 ` Bart Schaefer
2015-07-24  2:33   ` Bart Schaefer
2015-07-24  8:53     ` 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=20150724095322.7dba34af@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /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).