Msys2-packages: zsh crashes on start

Created on 25 Jan 2017  路  29Comments  路  Source: msys2/MSYS2-packages

Since the new update that I have installed today (Jan 25th), zsh crashes immediately on startup. bash still works, though.

Most helpful comment

For the people who want to use zsh right now: downgrade the msys2-runtime with msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz version.

# One-liner command
pacman -U http://repo.msys2.org/msys/x86_64/msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz

In case of a contingency, I hereby upload the package file and its signature to github.

$ sha1sum *
b29aa19e488a4dcfe5d1b1760630b3305a19029d *msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz
3950fb0da3dd5c1a9d3d964bb68efedb0f2a2b0b *msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz.sig

All 29 comments

Did you install zsh 5.3.1?

Yes, and it crashes, too. But zsh --version works (returning zsh 5.3.1 (x86_64-pc-msys))

Okay, this happens only if I have prezto enabled. Without it I can login, at least. Here is a stack trace

$ cat zsh.exe.stackdump

Exception: STATUS_ACCESS_VIOLATION at rip=001800EB8C0
rax=0000000000000000 rbx=0000000000000348 rcx=0000000000000000
rdx=00000000FFFFA780 rsi=00000000FFFFA780 rdi=00000000FFFFA700
r8 =0000000077B30000 r9 =00000000000001B6 r10=00000000C0000034
r11=0000000000000202 r12=00000003FC221D18 r13=00000003FC222CE0
r14=0000000000000000 r15=0000000000000002
rbp=0000000000000000 rsp=00000000FFFFA598
program=C:\msys64\usr\bin\zsh.exe, pid 6796, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame        Function    Args
00000000000  001800EB8C0 (00000010000, 00000000000, 00000000000, 000FFFFFFFF)
00000000000  0018011F1E2 (00000000000, 00000000000, 00000000000, 00000000000)
003FC2221A0  0018011F759 (000FFFFA710, 00100000000, 0018011F119, 00000000000)
003FC2221A0  0018011F8E1 (6FFFFFF1230, 00000000001, 6FFFFFF12B0, 003FC2221A0)
003FC2221A0  0018011B01B (6FFFFFF1230, 00000000001, 6FFFFFF12B0, 003FC2221A0)
003FC2221A0  003FC1B428F (00000000001, 00000000000, 003FC1E40B7, 00E0000000D)
003FC2221A0  003FC19B178 (00000000020, 00000000020, 000FFFFAA40, 00000000000)
00000000000  003FC1E56F8 (000FFFFAC80, 00000000004, 000FFFFAB9C, 00300000000)
00000000000  003FC1EB279 (000FFFFAD4C, 00000000000, 000FFFFAC88, 000FFFFAC5C)
003FC21C8E0  003FC193DB3 (6FFFFFF10D8, 00000000000, 000FFFFFFFF, 00000000000)
000FFFFFFFF  003FC19CC95 (00000000000, 003FC222FA0, 00000000001, 6FFFFFF0FB4)
000FFFFFFFF  003FC19AB0F (00000000001, 00000000000, 001800F3320, 000FFFFAE8C)
00000000001  003FC1BC172 (00000000000, 000FFFFAF60, 00180131445, 003FC223500)
00000000000  003FC197E11 (000FFFFB230, 00000000000, 00000000000, 00000000012)
00000000000  003FC199472 (00600000003, 00000000001, 000000008C0, 00000000000)
003FC222FA0  003FC1997C2 (6FFFFFF0C49, 6FFFFFF0FB8, 003FC1CF18B, 6FFFFFF0C49)
End of stack trace (more stack frames may be present)

Additionally, when I run zsh --login -v, zsh ssems to stops after parsing /etc/profile (so it looks like prezto was not doing much at that moment):

$ zsh --login -vv
#
# Defines environment variables.
#
# Authors:
#   Sorin Ionescu <[email protected]>
#

# Ensure that a non-login, non-interactive shell has a defined environment.
if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
  source "${ZDOTDIR:-$HOME}/.zprofile"
fi
emulate sh -c 'source /etc/profile'
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software.
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.


# System-wide profile file

# Some resources...
# Customizing Your Shell: http://www.dsl.org/cookbook/cookbook_5.html#SEC69
# Consistent BackSpace and Delete Configuration:
#   http://www.ibb.net/~anne/keyboard.html
# The Linux Documentation Project: http://www.tldp.org/
# The Linux Cookbook: http://www.tldp.org/LDP/linuxcookbook/html/
# Greg's Wiki http://mywiki.wooledge.org/

# Setup some default paths. Note that this order will allow user installed
# software to override 'system' software.
# Modifying these default path settings can be done in different ways.
# To learn more about startup files, refer to your shell's man page.

MSYS2_PATH="/usr/local/bin:/usr/bin:/bin"
MANPATH='/usr/local/man:/usr/share/man:/usr/man:/share/man'
INFOPATH='/usr/local/info:/usr/share/info:/usr/info:/share/info'

case "${MSYS2_PATH_TYPE:-minimal}" in
  strict)
    # Do not inherit any path configuration, and allow for full customization
    # of external path. This is supposed to be used in special cases such as
    # debugging without need to change this file, but not daily usage.
    unset ORIGINAL_PATH
    ;;
  inherit)
    # Inherit previous path. Note that this will make all of the Windows path
    # available in current shell, with possible interference in project builds.
    ORIGINAL_PATH="${ORIGINAL_PATH:-${PATH}}"
    ;;
  *)
    # Do not inherit any path configuration but configure a default Windows path
    # suitable for normal usage with minimal external interference.
    WIN_ROOT="$(PATH=${MSYS2_PATH} cygpath -Wu)"
    ORIGINAL_PATH="${WIN_ROOT}/System32:${WIN_ROOT}:${WIN_ROOT}/System32/Wbem:${WIN_ROOT}/System32/WindowsPowerShell/v1.0/"
esac
Segmentation fault (Speicherabzug geschrieben)

Same here... also with the latest version

$ zsh --version
zsh 5.3.1 (x86_64-pc-msys)

Happened also before updating zsh, and after the latest update of a lot of packages yesterday (pacman -Syu )

With me, zsh borks after trying to set some paths:

~$ zsh --login -vv
# MSYS2

# Path to your oh-my-zsh installation.
export ZSH=$HOME/repos/oh-my-zsh

# zsh settings
plugins=(git pylint tmux vagrant)

# standard programs
export BROWSER=\"$(echo "${PROGRAMFILES} (x86)/Mozilla Firefox/firefox.exe"|sed -e 's/\\/\//')\"
Segmentation fault (core dumped)

Could it be the dollar sign ? Variables ?

Found a temporary solution, thanks to another issue with tmux (see #791 ): downgrade the msys2 runtime

pushd /var/cache/pacman/pkg
pacman -U msys2-runtime-devel-2.6.0-1-x86_64.pkg.tar.xz msys2-runtime-2.6.0-1-x86_64.pkg.tar.xz

Now everything works again like a charm.

Yes, this is very likely related to commit 05c35754e. Cygwin also had done a patch (https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=0008bdea02b690ab19ffe997499cb9a96ee5a66d), but ultimately reverted it due to regressions with zsh (https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=41abcc5825d33d78bd370997ba664e3c64eb6683)

So, I guess one has to write a proper patch, or revert it

Could it be the dollar sign ? Variables ?

Setting a variable to result of expansion is what crashes. Setting variable to literal works, expansions alone work too, but the combination does not. Minimal command to reproduce I found is:

zsh -c 'FOO=$(echo foo)'

I get a message before zsh crashes:
zsh: Can't add module parameter 'aliases' : parameter already exists

Is anyone actively looking into this? I've tried downgrading both msys2-runtime/msys2-runtime-devel and zsh and it still crashes for me.

did anyone try update to todays msys2-runtime-2.6.1-3?

@Alexpux I tried it just now--still crashes. :( @jan-hudec's repro will crash it.

ok.

Is there anything I can do to help diagnose or debug this? Having a 100% broken package in the repo for a popular interactive shell without any workaround or interim downgrade available means this ought to be a priority-1 issue.

@drvink, it is likely that the commit https://github.com/Alexpux/MSYS2-packages/commit/05c35754e11168bbece795ae9a144bd4a241df66 that @the-nic found does have something to do with it.

To verify, try building without the msys2-runtime/0300-gcc6-workaround-nonnull-error.patch file and testing (you'll have to use gcc 5.x).

If that helps, the patch needs to be fixed. The patch removes a null-pointer check on this in some methods, which is formally incorrect (calling a method on nullptr is already undefined behaviour), but in practice it might be actually catching some calls on nullptr. So the call sites need to be checked and if they may actually call the method on null, the check needs to be restored there.

Perhaps first add some asserts to find which place(s) actually rely on this.

For the people who want to use zsh right now: downgrade the msys2-runtime with msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz version.

# One-liner command
pacman -U http://repo.msys2.org/msys/x86_64/msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz

In case of a contingency, I hereby upload the package file and its signature to github.

$ sha1sum *
b29aa19e488a4dcfe5d1b1760630b3305a19029d *msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz
3950fb0da3dd5c1a9d3d964bb68efedb0f2a2b0b *msys2-runtime-2.6.1-1-x86_64.pkg.tar.xz.sig

I had zsh 5.3.1-1 crash on me. Downgraded to 5.1.1-1, and that works. For now. I'd rather downgrade this one package than the whole runtime. I wouldn't downgrade the kernel because a newer zsh version didn't work, would you?

Hi @georgehank - tmux has the same issue with runtime 2.6.1-x.: (see #791 ), so it seems to be about more than just a newer zsh version :wink:
Which runtime do you use ?

@georgehank My advise just downgrades the runtime only '0.0.0-2' version. It just reverts a few commits and it's not a big deal. I don't want to use the zsh of 2015.

Same for me. Downgrading ZSH doesn't even do the trick, but downgrading the runtime does. Thanks for the info.

I was just switch back to bash and waiting for fix. That an estimate of when it will appear?

@dulanov when Cygwin fixes this issue.

@mati865, does Cygwin actually have the issue? The https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=0008bdea02b690ab19ffe997499cb9a96ee5a66d was reverted in https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=41abcc5825d33d78bd370997ba664e3c64eb6683, specifically mentioning as causing this zsh problem. And their HEAD still has it reverted.

@jan-hudec this patch isn't used anymore: https://github.com/Alexpux/MSYS2-packages/commit/80ef82a4def044ae415c6a185e129dc1dc1eaf6e#diff-c95784de4a8ec7652a8b97b59eaf4b04L106
And was changed to -Wno-error=nonnull-compare flag but it doesn't help. Without it you cannot compile Cygwin.

So yes, it is Cygwin issue.

@mati865, disabling the diagnostics is not enough. You also have to disable the optimization. The changelog says to

Value range propagation now assumes that the this pointer of C++ member functions is non-null. This eliminates common null pointer checks but also breaks some non-conforming code-bases (such as Qt-5, Chromium, KDevelop). As a temporary work-around -fno-delete-null-pointer-checks can be used.

can you please try to add the -fno-delete-null-pointer-checks flag and try once more?

Pacman doesn't seem to be finding this yet. Is there some particular command needed?

@okonomiyaki3000 Alex build and updates packages manually in his free time. You can build package yourself or unzip (GitHub allows only zip archives) and install those packages with pacman -U:

x86_64 bit version only:
msys2-runtime.zip
Pkgver is still 3 so if any update comes it will get replaced.

Thanks! Just what I needed!

@okonomiyaki3000 Alex build and updates packages manually in his free time.

Manually...? My god we definitely need to help him out. I though it'd be automatically built and uploaded... He was doing so much for us

Thanks @Alexpux @mati865 @jan-hudec : Compiling and installing the latest version of the msys2-runtime (2.6.1-4) solves the issue. :thumbsup:

Was this page helpful?
0 / 5 - 0 ratings