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: Crash when capturing command output in completion
Date: Fri, 16 Jan 2015 09:44:36 +0000	[thread overview]
Message-ID: <20150116094436.7803b467@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <150115212036.ZM23929@torch.brasslantern.com>

On Thu, 15 Jan 2015 21:20:36 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jan 15,  8:43pm, Bart Schaefer wrote:
> }
> } schaefer<501> echo $(ls)
> } zsh: fatal error: out of memory
> 
> As probably should have been obvious to me, if I back out to before
> workers/34160 (commit c0d01a6fe0c67911650730cf13a2b9a0db16e59b) then
> this error goes away.
> 
> However, it looks to have something to do with factoring lexsave/restore.
> Probably zle_chline isn't getting initialized in all the places that it
> needs to be.

It's not just the rearrangement of saving and restoring, anyway.

The old skipcomm() didn't interact directly with any of the stuff
kludged into the lexer to handle completion, as far as I can see.  It
might be to do with the differences in saving and restoring of state
over the internals of $(...).  If the integration between completion and
the lexer were neat enough, this would be too deep for it to care: it's
just parsing a string recursively.  However, it's never that simple.

Later, completion tries to execute the $(...) to replace the output.
In theory that's not really changed because all it needs is the
string that's been parsed a bit differently...  however, the entry point
to the lexer is also different here.

One thing that needs looking at is whether the history input function
pointers are special over completion.  However, a quick grep suggested
they weren't.

An approach to debugging might be to put back just the old skipcomm(),
which depends less on the rest of the system than the new one, and
nothing else (one replacement of bptr with lexbuf.ptr is needed) and
look for what the resulting differences are.  This appears to
work the way I'd expect (doesn't crash, expands output) but I don't have
time to look further.

(If the worst comes to the worst and this proves intractable, using
a fallback skipcomm() for completion only would be possible.  However, I
suspect this is revealing some interesting difference that should be
fixable.)

pws


  reply	other threads:[~2015-01-16  9:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 19:34 Vin Shelton
2015-01-15 21:53 ` Bart Schaefer
2015-01-15 23:53   ` Vin Shelton
2015-01-16  0:27     ` Bart Schaefer
2015-01-16  3:11       ` Vin Shelton
2015-01-16  3:17         ` Vin Shelton
2015-01-16  4:43           ` Bart Schaefer
2015-01-16  5:20             ` Bart Schaefer
2015-01-16  9:44               ` Peter Stephenson [this message]
2015-01-16 12:57                 ` Peter Stephenson
2015-01-16 16:18                   ` Bart Schaefer
2015-01-16 16:25                     ` Bart Schaefer
2015-01-16 18:04                     ` Peter Stephenson
2015-01-16 18:58                       ` Bart Schaefer
2015-01-16 19:16                         ` Bart Schaefer
2015-01-16 20:05                           ` Peter Stephenson
2015-01-16 19:19                         ` Ray Andrews
2015-01-16  6:43             ` Ray Andrews
2015-01-16  7:49               ` Bart Schaefer
2015-01-16 16:21                 ` Ray Andrews
2015-01-16 16:34                   ` Bart Schaefer

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=20150116094436.7803b467@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).