From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22878 invoked from network); 21 Jul 2021 20:19:30 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 21 Jul 2021 20:19:30 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1626898770; b=spJb0+VAFDZcj5iw619kKXxl+V30U8QFaAX2WZfbNVgK1/2gd19llSClBfvvHTiKr4ha9kh5ZQ 1KNxkAQxvNBIZkzuDlL67QizsM7lHEKaaTOe880aVKalwZN1qTAL862BxQZip73FDkOz+dpx9q kVg0NXMSmvoPAmooFYan6CTRZgq9T4wWPlwj6RofT9P1ysRATcJWz3NZ0y3pyJwveqVQXzVmJK QQaIXa9/kUidbDYnpBV/86tuLSqPIw1WPgRRpQicYQErR119kh09NJw2VzXVft6CGMCRnuDFVn 8hZtHNTZQ6xdR0zH+Otm7fNM6g0JMYjT9+SGQ3ZZFcWEYg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (smtpq5.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.100; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1626898770; bh=KI0SMeBdWuc++eILTessFxjRscCTppB3qN/wzkrehQk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature: DKIM-Signature; b=wkuercT3E+h01SuefHPUZvDqRV0ywQJHM5oDWqijbCMXIxL0711XN/VMqFB9LCZhlXVGXm731P G+zutObxpzx/jzqeLfBiT+q+tMcs60wCo2pygVkBMRBsoG7JqU5/CwueQEwM9ibt/k80TArBiW DjclX0dg7QwQh+PZEb6Qhx3cGv4sie4TKakcuxJLrPU9+zLgLayoGsORuFFVydXC5lMukR8IOT 95RRvhOvljzqvOD0LGJAQr19uviv1d63VVL42bsS72LTGf0OacBUABbQAtAQ+LaJdcANC9grgz czw/shU2zeIRDBr4Io5YZ2Rp6mW1eKOOs7eySgEIJaC1vA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=YHNx/RletR8BXhc/DHlKATbkP8q8RaeFomBwA0NTlms=; b=MkwPrwaSaLU3lPs0rIjKyotYSd 7kVL/WgzeqKh16ZW3DdqaJlq+NLr+xJdkOKgJ/WmZubrLlosCg4bKTWUOQ7Sr/tLSpP+tg/E8j0IF J9p4zaDxLHDRo7mEy/1x8OGbsKGLz7UQhNPhmlq+BMLlmYCtfyBCqR8CKvo2tTOtiHyk1+IHlxZvM eJDHWNDynlvMprl8sjuUSvd69B+lKOeDWNYxk2swWqVbB8vt0Dq+fZG6RlmR9ojIB2D+mgO0P7gya eLJLmm7tZqpK7yBCiIS5kVEec40szwgaHUV4gauKuClmrCgJWalK6NTi8QdxdJzi8vUFAqAid8dmy ZT4Z1D3g==; Received: from authenticated user by zero.zsh.org with local id 1m6Igh-0006m8-1J; Wed, 21 Jul 2021 20:19:27 +0000 Authentication-Results: zsh.org; iprev=pass (smtpq5.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.100; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from smtpq5.tb.ukmail.iss.as9143.net ([212.54.57.100]:51832) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1m6Ig8-0006UZ-TH; Wed, 21 Jul 2021 20:18:53 +0000 Received: from [212.54.57.107] (helo=csmtp3.tb.ukmail.iss.as9143.net) by smtpq5.tb.ukmail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1m6Ig8-0004Ob-6k for zsh-workers@zsh.org; Wed, 21 Jul 2021 22:18:52 +0200 Received: from pws-Zeus ([86.7.189.51]) by cmsmtp with ESMTPA id 6Ig7myFr9bkrT6Ig7mlJTj; Wed, 21 Jul 2021 22:18:52 +0200 X-Originating-IP: [86.7.189.51] X-Authenticated-Sender: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.4 cv=OYD7sjfY c=1 sm=1 tr=0 ts=60f8812c cx=a_exe a=mDzK/eG20+r+ucIvzJc7BQ==:117 a=mDzK/eG20+r+ucIvzJc7BQ==:17 a=IkcTkHD0fZMA:10 a=e_q4qTt1xDgA:10 a=pGLkceISAAAA:8 a=UsjYXR5mNlNLch5RXjQA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1626898732; bh=YHNx/RletR8BXhc/DHlKATbkP8q8RaeFomBwA0NTlms=; h=Subject:From:To:Date:In-Reply-To:References; b=nkkuuOnFtR1CTjlB7opu2ah9/ylsxZRxCAkXVuRdLZyaolsz1dvisdkuSyEnDGp0n ld0M/h+2jeM/ugWwBO+mVgR7LRFgGMx1+aDo9xY3gZN90rz3H/b9IK2KnMiTR51PrW d5rt07+1JkZzvzpPT2KJWrBF78CKuXgj2pi3+XPyo91g3eU/dvfS/03v7mNkL4Xaes yZ8gwTcolt1pLBodvWMYhWvwkfyHaejCjQHtoxFa6d/Zs9vh57P4R6fvxiFOHuG9gZ mdhae5yc+uqo1tp5e+P5d12gUplqD1Pe26V1FNlcBReI265FayCs0t8t3My1egfYd/ wfL2HVWY0AX3g== Message-ID: Subject: Re: "double free or corruption (out)" in zsh correct From: Peter Stephenson To: zsh-workers@zsh.org Date: Wed, 21 Jul 2021 21:18:51 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfIicl6HJZ4STVxHlbS+WmoX3K+5JLowYZmRK8GkR9I3bf0rJ1HEtRyKsOYGrok13GQnlObGkBpXRTwP6C2izl7rrWVOWUlB9o+YAxqItOAVNmxE8tL/R AKExxEYY/U1TTkjLnUYsrAjNJbzJsPn2+0gk3+IFOk7Ak5EQHAtq8k5YephDFJFCdYvuV2fXV9/A8w== X-Seq: 49182 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, 2021-07-21 at 10:03 -0700, Bart Schaefer wrote: > On Wed, Jul 21, 2021 at 6:03 AM Henning Reich wrote: > > > > you probably already know but it seems there is a bug in the correct > > function (or is this not part of zsh?). > > I can reproduce: > > ubuntu% setopt correct > ubuntu% A=$(PWD) > zsh: correct 'PWD' to 'pwd' [nyae]? y > hist.c:1710: BUG: hwget() called in middle of word > zsh: segmentation fault (core dumped) Src/zsh -f We don't currently have the tools to do the history replacement within the recursive analysis of the $(...), which doesn't maintain history with all the detail of the main command line. It's probably better just to turn it off there for now. This means the word seen is A=$(PWD) so it doesn't get corrected. Anything more is more work. pws diff --git a/Src/hist.c b/Src/hist.c index 42cae030c..6ac581fda 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -339,6 +339,13 @@ hist_in_word(int yesno) histactive &= ~HA_INWORD; } +/**/ +int +hist_is_in_word(void) +{ + return (histactive & HA_INWORD) ? 1 : 0; +} + /* add a character to the current history word */ static void diff --git a/Src/lex.c b/Src/lex.c index 37fcec3e2..ece02659e 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -1889,6 +1889,7 @@ exalias(void) hwend(); if (interact && isset(SHINSTDIN) && !strin && incasepat <= 0 && tok == STRING && !nocorrect && !(inbufflags & INP_ALIAS) && + !hist_is_in_word() && (isset(CORRECTALL) || (isset(CORRECT) && incmdpos))) spckword(&tokstr, 1, incmdpos, 1);