zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: Crash when capturing command output in completion
Date: Fri, 16 Jan 2015 18:04:00 +0000	[thread overview]
Message-ID: <20150116180400.6be0d82e@ntlworld.com> (raw)
In-Reply-To: <150116081843.ZM26927@torch.brasslantern.com>

On Fri, 16 Jan 2015 08:18:43 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jan 16, 12:57pm, Peter Stephenson wrote:
> }
> } Only very lightly tested and so probably partial fix --- however, I'll
> } commit this because (i) I'm fairly sure it's going in the right
> } direction (ii) it does work in some cases and hence the shell is less
> } crash-prone (iii) I get to insert a whiny message about the horrible
> } interface which always improves my morale.
> 
> OK, this changed something -- I don't get a crash any more (though I
> probably should as there is obviously a rogue pointer) but *without*
> -DZSH_OLD_SKIPCOMM I get this:
> 
> schaefer<501> echo ÿÿÿÿÿÿÿÿ$(ls)
> Completing all expansions
> ÿÿÿÿÿÿÿÿ$(ls)
> Completing original
> $(ls)

That's not happening here.  I had no problem with inserting the output
of ls in Src word by word, though there was some evidence of display
funnies when it tried to insert the complete set of words as an
expansion.

If it still happens after rebuilding from scratch, could you see if it's
related to what ls is actually outputting or some completion option?

> This has to mean it's a difference between hgetc() and lex_add_raw()
> or whatever; I don't really follow yet what's happening with those
> new routines.

The sole purpose of lex_add_raw() is to track the input buffer to be
copied back raw as the contents of the $(...).  Meanwhile, on top of
that, it's being parsed, but that's no use to us later as we need the
string for the command line argument.

The complexity comes when the input tracked in this way (tokstr_raw)
gets reinstalled in the normal string (tokstr) when we get to the end of
the parentheses.  From then on it's just a string again, until the
$(...) is actually executed.

pws


  parent reply	other threads:[~2015-01-16 18:09 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
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 [this message]
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=20150116180400.6be0d82e@ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).