From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24171 invoked by alias); 16 Jan 2015 09:45:02 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34303 Received: (qmail 13350 invoked from network); 16 Jan 2015 09:45:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f126d000001e9a-3b-54b8dd984db0 Date: Fri, 16 Jan 2015 09:44:36 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: Re: Crash when capturing command output in completion Message-id: <20150116094436.7803b467@pwslap01u.europe.root.pri> In-reply-to: <150115212036.ZM23929@torch.brasslantern.com> References: <150115135356.ZM23582@torch.brasslantern.com> <150115162748.ZM23670@torch.brasslantern.com> <150115204336.ZM23779@torch.brasslantern.com> <150115212036.ZM23929@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMLMWRmVeSWpSXmKPExsVy+t/xq7oz7u4IMbg+XdviYPNDJgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZfQs8ypoF6iY/P03WwPjN54uRk4OCQETiRW7VrND2GISF+6t Z+ti5OIQEljKKDFl825mkISQwBImie1vPCAS2xglOr8/ZgVJsAioSsxbfZERxGYTMJSYumk2 kM3BISKgLdH+UQwkLCxgJ3Foxhmwcl4Be4npjX+YQUo4Bawkdi5zhBj5nFmice99sF38AvoS V/9+YoI4yF5i5pUzjBC9ghI/Jt9jAbGZBbQkNm9rYoWw5SU2r3kLdae6xI27u9knMArNQtIy C0nLLCQtCxiZVzGKppYmFxQnpeca6hUn5haX5qXrJefnbmKEBOyXHYyLj1kdYhTgYFTi4Z2x ZUeIEGtiWXFl7iFGCQ5mJRHejduAQrwpiZVVqUX58UWlOanFhxiZODilGhhrrzr8mHGnQ4nX ONpnnbTi/8o2jg/+f5g0LjGq1gZNv1eiXPpus0HUrV1PyyI3vt7wlWPe/qpDJnuWCol9iQxL kjmUwlw86z03w/wN3D91b735fXPRxC/ORkv+nF5SpCKdF8f8/jbXlHb9EsXynPN7LrO9ebPb tuxl++UJvcf1g2Y3mc4MPZerxFKckWioxVxUnAgA1RPh7jYCAAA= On Thu, 15 Jan 2015 21:20:36 -0800 Bart Schaefer 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