From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25122 invoked by alias); 28 Oct 2015 02:43:23 -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: 36992 Received: (qmail 10771 invoked from network); 28 Oct 2015 02:43:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject:cc :mime-version:content-type; bh=XirFPzDNMyzKPxYQ9VY6TTnTXVFokLGG7dkuFXaViVQ=; b=iR3eLj5E9bGrFZIym/tluEP1GdPwVCZP14k7AD58oKOWmKXZa7+BIHxwl56vDVYzmU 6Uwwt3jPdp7WlBGqbzuFk5irphVgvBLm2McihsSJJNIfceVp7aL4t8w5VlfadQbYnxbv XOwEEu3sh+cVWD4HUcPk00TcMf/sEBvYb1EfZi7SusJPapGutMYYyOidPyRt07Lb6ce1 Nui/9fWhY7f1Beygire1IefWFd1IClZ3nH/TxqQgJMjej+RoBK2T5RQPONsrHiHbbuxL IFrY5FmwMAEx3mskLb2BHehdgtkAZeZHAjZo8qHPLz0GnrgU3YK72cwLLDKXPeqmwjAU qTyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:cc:mime-version:content-type; bh=XirFPzDNMyzKPxYQ9VY6TTnTXVFokLGG7dkuFXaViVQ=; b=UnUOGb9il8VgOsGzS5/loNTEDhe4xHXTjcmIXYMM35i8cq3nMuCgF7x2NaTDUEVWXx uxgwAa54ZOxqgSdr2RtNEp4RDwk+PvIjh0IE++NMoVRBrWPG9sV1xckgdMYqxbi3A11W /2SscaknUS/h2+756tVblexOSLsRRqY2sKNcwwWooggdwf5tZK7bUox3m19zp0QxEY/M SwbIV1TeA3Mau7xHBdGFKUYtkW0forKnGvDeInZ69MeQc1ZiTSX6ipwLrKp0ATxLgxH7 PfKQ1NmAE+xZDzEfqzQpSPxsKbqV1wltvyPy1Zm6kVFkzzW+MFhUXjTD5VHFHrIDnAsk N2CQ== X-Gm-Message-State: ALoCoQnzwdRaTgfMD2DadH8UKRmam2d8I0rnQcXU4VT7jvfXMS21R9UZeWb0G3xBRUzai7nkhu4t X-Received: by 10.202.67.194 with SMTP id q185mr6589537oia.37.1446000200659; Tue, 27 Oct 2015 19:43:20 -0700 (PDT) From: Bart Schaefer Message-Id: <151027194317.ZM17099@torch.brasslantern.com> Date: Tue, 27 Oct 2015 19:43:17 -0700 In-Reply-To: <151015172503.ZM30721@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted contents for CJK payloads" (Oct 15, 5:25pm) References: <151015172503.ZM30721@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted contents for CJK payloads Cc: Chi Hsuan Yen MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 15, 1:54pm, Bart Schaefer wrote: } } On Thu, Oct 15, 2015 at 6:54 AM, Chi Hsuan Yen wrote: } > This bug is similar to zsh-worker 36763 but different. With zsh } > commit 827d360, I have no problems in pasting CJK payloads with an } > empty ~/.zshrc, while problems occur with my own ~/.zshrc. It's a } > strange bug. Please tell me if you can't reproduce it. I'll test } > on more platforms. } } I am able to reproduce this, but not reliably. Fixing the descriptor "leak" in ztcp.c did not help with this bug, so I tried digging around a bit further. I first discovered that I'd mis-remembered what self-insert-unmeta is meant for. It's not un-metafying in the zsh sense, it's clearing the high-order bit -- so it's the wrong thing for bracketed-paste-magic to use when inserting characters, except maybe for ^M. However, that led to the question of why that branch of the "case" in bracketed-paste-magic is even being taken. The code is: case $REPLY in (${~bpm_active}) function () { emulate -L $bpm_emulate; set -$bpm_opts zle $REPLY };; (*) zle .self-insert-unmeta;; esac (where $REPLY comes from "zle .read-command"). $REPLY is "self-insert" and $bpm_active is "self-*" so the first branch ought to be taken, and indeed that is what happens if ztcp has never been invoked. However, if ztcp is run in the correct order with respect to the auto- load of bracketed-paste-magic, the case statement goes wrong and the (*) condition is taken instead. This is eerily similar to a situation I mentioned some while ago in which patterns in zstyle sometimes fail to match. I've never been able to consistently reproduce that one either, and it also seemed to be dependent on the order in which some operations were done. This has me entirely confused. valgrind finds nothing amiss so it's not a memory management thing. Some sort of clash in global variable address space? Anybody have an idea?