From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2457 invoked by alias); 1 Mar 2017 15:39:22 -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: 40684 Received: (qmail 20171 invoked from network); 1 Mar 2017 15:39:22 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(0.8/5.0):. Processed in 3.570628 secs); 01 Mar 2017 15:39:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=qNqX=2K=gmail.com=yan12125@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at bounces.park01.gkg.net does not designate permitted sender hosts) X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=YkqOQOmCpcMRVNjklk7UFFiga1Ku4YMs1kKHiYFefDQ=; b=EJ2myg5UptDj5wsvbuBaj6fYcvHVA4xN9GMkOVG2jF82I7tZ5objSq1DhEWLrVfbCL OsEqmLn1kjjWYIdEe/WpUmuAfSg/hIcvUV8GiJvHH8vwZxaUJB3ZhXa8vfQk6eNbgwBV 6HJaeC0a7wezTcAqBrqthLRnyx3eCT9MEwe/f4TcVfbbkjPiVNRb89EYNHPM0urkEhUS OC52alvow03bp6LxZEwJQFHpqodEagQ4u14Qyuf77V5/a4IrRbf73jr7SD9Su5aZzPhC AbPx4JJ7QGoZzkEERnriq7RzfD7e15UfiOIDxe339hAIkMNu+StGiLwe7/qdsuCMDsum xpOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=YkqOQOmCpcMRVNjklk7UFFiga1Ku4YMs1kKHiYFefDQ=; b=WgfVHWxo4Gciqt0iiBPgFbFGTKg9q38DmBHm+DHuf0X16cv5SJnj8L0mt+j8tGMT4L Rl1oL1Vm1J9XWYfKiViPa/OxcLND4q2QJkQYxKRZF1UlAEO3jUD7qEi4nOQ3tG0Ksm3X UQtOjWt8KeJBi1F8VYBG7oxf+Vqb3zeSmX2oN/sgGXJg1AC/lUCfakzXvRw230mXfVry l0hdqEzP7ReC6GZM/mlt9guuvkkvJD2A0BUtpd+B9OH0KIpAcPlsBM8naXwEdcG9fHfN kUALZwuOQLhfUjblHJcmXMx31rTrCAdmkPTHiushV2H2d6OXaKz8Ag62bgIDgNuhaKJx 49jQ== X-Gm-Message-State: AMke39ka25ADNvqLB8WvWKXCZcsCWE42SsL1qZpStyrGSOgAm4/fYSK+Vzt2zp3Lf7WkrJdCdiosbL2Vc83c4w== X-Received: by 10.237.33.251 with SMTP id m56mr8208492qtc.121.1488382731415; Wed, 01 Mar 2017 07:38:51 -0800 (PST) MIME-Version: 1.0 From: Chi-Hsuan Yen Date: Wed, 1 Mar 2017 23:38:51 +0800 Message-ID: Subject: [BUG] SIGSEGV under certain circumstances To: Zsh hackers list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello zsh experts, Yesterday I got SIGSEGV in zsh under certain circumstances. I'm on Arch Linux x86_64. Steps to reproduce are: 1. Install the mpv media player. Seems the bug is related to its completion script _mpv. On Arch Linux it's stored in /usr/share/zsh/site-functions/_mpv. I have uploaded a copy to [1] 2. Use .zshrc at [2] 3. Create an empty file called =E7=AA=81=E7=84=B6=E5=A5=BD=E6=83=B3=E4=BD= =A0-3565536.mp3 in $HOME Seems the filename affects how SIGSEGV occurs or not. Its content is irrelevant. 4. Open a new terminal and run `mpv =E7=AA=81=E7=84=B6=E5=A5=BD=E6=83=B3=E4= =BD=A0-3565536.mp3`. Then exit the terminal to make sure that the mpv command is written to ~/.zsh_history 5. Open another new terminal, hit arrow up one or more times to the previous mpv command. 6. Hit tab, then zsh crashes with SIGSEGV. The log under gdb can be found a= t [3] My zsh version is d00931de5c2b7aa846daf137865dd05ac8d4be8a. I replaced the value of `source` to git-master and rebuild the Arch Linux zsh package. [4] I can reproduce this bug with both QTerminal (a fork of Konsole) and xfce4-terminal. So it's not a terminal-specific issue. By the way, after those steps ~/.zsh_history seems corrupted: $ head -n 2 ~/.zsh_history | tail -n 1 | xxd 00000000: 6d70 7620 e7aa 81e7 83a4 b6e5 a5bd e683 mpv ............ 00000010: a3b3 e4bd 8380 2d33 3536 3535 3336 2e6d ......-3565536.m 00000020: 7033 0a p3. $ echo -n =E7=AA=81=E7=84=B6=E5=A5=BD=E6=83=B3=E4=BD=A0 | xxd 00000000: e7aa 81e7 84b6 e5a5 bde6 83b3 e4bd a0 ............... Chinese characters =E7=AA=81=E7=84=B6=E5=A5=BD=E6=83=B3=E4=BD=A0 map to: e7aa81 e784b6 e5a5bd e683b3 e4bda0 in utf-8 (15 bytes, 3 bytes for each character). However, in ~/.zsh_history, the saved content is: (I reformatted it for easier comparision with the correct version) e7aa81 e783a4b6 e5a5bd e683a3b3 e4bd8380 Apparently the 2nd, 4th and 5th characters are corrupted. I'm not sure whether it's related to the crash, though. I know this bug is not easy to reproduce. Thanks for the patience in reading this long letter! Best, Yen, Chi-Hsuan [1] https://gist.github.com/yan12125/014c7a7510d1d9bd9ac8edf142a0c65d#file-= _mpv [2] https://gist.github.com/yan12125/014c7a7510d1d9bd9ac8edf142a0c65d#file-= zshrc [3] https://gist.github.com/yan12125/014c7a7510d1d9bd9ac8edf142a0c65d#file-= backtrace [4] https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h= =3Dpackages/zsh