Bug 259997 - shells/zsh: Fails to install: *** Signal 10
Summary: shells/zsh: Fails to install: *** Signal 10
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Baptiste Daroussin
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2021-11-23 17:03 UTC by khb
Modified: 2022-08-31 14:38 UTC (History)
7 users (show)

See Also:
bugzilla: maintainer-feedback? (bapt)


Attachments
log from poudriere testport (122.83 KB, text/plain)
2021-12-25 01:41 UTC, tech-lists
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description khb 2021-11-23 17:03:36 UTC
When pulling from git, zsh does not build. Not sure what the error message means here, but: 

install  -s -m 555  zleparameter.so /usr/ports/shells/zsh/work/stage/usr/local/lib/zsh/5.8/zsh/zleparameter.so
if test x/usr/local/share/zsh/5.8/functions != x && test x/usr/local/share/zsh/5.8/functions != xno; then  test xno != xno &&  /bin/sh ./mkinstalldirs /usr/ports/shells/zsh/work/stageno;  sdir_top="." fndir="/usr/local/share/zsh/5.8/functions" dir_top="."  scriptdir="/usr/local/share/zsh/5.8/scripts" runhelpdir="/usr/local/share/zsh/5.8/help"  FUNCTIONS_SUBDIRS="yes"  INSTALL_DATA="install  -m 0644"  INSTALL_PROGRAM="install  -s -m 555"  DESTDIR="/usr/ports/shells/zsh/work/stage" VERSION="5.8"  /bin/sh ./Config/installfns.sh || exit 1;  fi;  exit 0
/bin/sh ../mkinstalldirs /usr/ports/shells/zsh/work/stage/usr/local/man/man1
for file in zsh.1 zshbuiltins.1 zshcalsys.1 zshcompctl.1 zshcompwid.1 zshcompsys.1  zshcontrib.1 zshexpn.1 zshmisc.1 zshmodules.1  zshoptions.1 zshparam.1 zshroadmap.1 zshtcpsys.1 zshzftpsys.1 zshzle.1  zshall.1; do  test -s $file || exit 1;  install  -m 0644 $file /usr/ports/shells/zsh/work/stage/usr/local/man/man1/`echo $file | sed 's|zsh|zsh|'` || exit 1;  done
if test x"/usr/local/share/zsh/5.8/help" != x""; then  /bin/sh ../mkinstalldirs /usr/ports/shells/zsh/work/stage/usr/local/share/zsh/5.8/help;  install  -m 0644 help/* /usr/ports/shells/zsh/work/stage/usr/local/share/zsh/5.8/help;  while read from to; do  rm -f /usr/ports/shells/zsh/work/stage/usr/local/share/zsh/5.8/help/$to || : ;  ln -s $from /usr/ports/shells/zsh/work/stage/usr/local/share/zsh/5.8/help/$to;  done < help.txt;  fi
/bin/mkdir -p /usr/ports/shells/zsh/work/stage/usr/local/share/zsh/site-functions
/bin/ln -f /usr/ports/shells/zsh/work/stage/usr/local/bin/zsh /usr/ports/shells/zsh/work/stage/usr/local/bin/rzsh
(/usr/ports/shells/zsh/work/stage/usr/local/bin/zsh -fc '  setopt extendedglob nomark_dirs;  cd /usr/ports/shells/zsh/work/stage//usr/local/share/zsh/5.8 ;  rm -f functions/**/*.orig ;  for i in functions/**/*(/) ; do  zcompile -U -M $i.zwc $i/*~*.zwc(^/) ;  /bin/chmod 644 $i.zwc ;  done')
*** Signal 10

Stop.
make[1]: stopped in /usr/ports/shells/zsh
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/zsh
Comment 1 khb 2021-11-23 19:24:15 UTC
I'm running 14.0-CURRENT-
uname -a:
FreeBSD 14.0-CURRENT #10 main-n250967-44ca3690519: Tue Nov 23 10:04:47 CST 2021
Comment 2 tech-lists 2021-12-24 18:51:45 UTC
(In reply to khb from comment #1)

I'm seeing this exact error in a poudriere tesport context with fresh ports tree on FreeBSD 13.0-STABLE 1300522 amd64
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-12-24 22:04:36 UTC
@Reporter Could you provide additional information, including:

- uname -a output
- Git commit hash of the ports tree version
- pkg version -v output (as an attachment)
- full build log (as an attachment, compressed if necessary)
- /etc/make.conf contents (as an attachment, if not empty)

If there is a .core file produced, include output of, as an attachment, the backtrace (via gdb bt) for that core file

Note: Signal 10 is a Bus Error
Comment 4 tech-lists 2021-12-25 01:40:04 UTC
(In reply to Kubilay Kocak from comment #3)

context:
poudriere-devel-3.3.99.20211130 amd64 host (stable/13-n248546-d5dd159b15e 1300522 1300522)

poudriere jail:
JAILNAME VERSION                       ARCH  METHOD       TIMESTAMP           PATH
desktop  13.0-STABLE 1300522           amd64 src=/usr/src 2021-12-13 22:23:10 /poudriere/jails/desktop

PORTSTREE              METHOD    TIMESTAMP           PATH
default                git+https 2021-12-24 18:44:39 /poudriere/ports/default

command: poudriere testport -i -j desktop shells/zsh

found ./wrkdirs/usr/ports/shells/zsh/work/stage/usr/local/share/zsh/5.8/zsh.core

[installed gdb]

nobody@desktop:/ % gdb
GNU gdb (GDB) 11.1 [GDB v11.1 for FreeBSD]
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) core ./wrkdirs/usr/ports/shells/zsh/work/stage/usr/local/share/zsh/5.8/zsh.core
[New LWP 218382]
Core was generated by `/wrkdirs/usr/ports/shells/zsh/work/stage/usr/local/bin/zsh    setopt extendedglo'.
Program terminated with signal SIGBUS, Bus error.
Object-specific hardware error.
#0  0x0000000800467bf8 in ?? ()
(gdb) bt
#0  0x0000000800467bf8 in ?? ()
#1  0x0000000000000005 in ?? ()
#2  0x0000000000000000 in ?? ()
(gdb)
Comment 5 tech-lists 2021-12-25 01:41:46 UTC
Created attachment 230381 [details]
log from poudriere testport
Comment 6 Dima Panov freebsd_committer freebsd_triage 2022-01-09 13:19:16 UTC
Confirm on FreeBSD 14.0-CURRENT #1 main-n252235-9a498f9a143 (1400046)

zsh was fine with 1400040 and still fine with 13.0 and 12.3 releases.
Comment 7 Baptiste Daroussin freebsd_committer freebsd_triage 2022-01-19 09:00:30 UTC
I can't reproduce on main-n251095-ecff38de76d. I will upgrade and try to reproduce
Comment 8 Martin Neubauer 2022-02-13 13:31:31 UTC
I got hit by this on upgrading a 13stable system following the latest security advisory. After this the installed zsh crashed immediately on startup and rebuilding failed with the same error described here. After playing around with the build options it seems that for me disabling MEM fixed the problem. Maybe others affected could try to reproduce.
Comment 9 Oleg Sidorkin 2022-02-13 19:46:48 UTC
Disabling MEM fixes zsh for me too.
It fails on some AVX instructions inside libc. It seems that zsh allocator doesn't align data structures properly and then CPU refuses to execute AVX commands on misaligned data
Comment 10 Marcin Gryszkalis 2022-03-17 18:33:05 UTC
Same here after upgrade to 13.1-BETA1 #17 releng/13.1-942b5e156d4

* thread #1, name = 'zsh', stop reason = signal SIGBUS: hardware error
  * frame #0: 0x0000000800486aa3 libc.so.7`___lldb_unnamed_symbol4533 + 771
    frame #1: 0x0000000800487ad8 libc.so.7`___lldb_unnamed_symbol4538 + 200
    frame #2: 0x00000008004879c9 libc.so.7`___lldb_unnamed_symbol4537 + 25
    frame #3: 0x000000080048789d libc.so.7`___lldb_unnamed_symbol4536 + 205
    frame #4: 0x0000000800487503 libc.so.7`setlocale + 1027
    frame #5: 0x000000000026182d zsh`zsh_main + 45
    frame #6: 0x000000000022e470 zsh`_start + 256


    0x800486a94 <+756>:  xorl   %ecx, %ecx
    0x800486a96 <+758>:  xorps  %xmm0, %xmm0
    0x800486a99 <+761>:  movsd  0x28(%r14,%rcx), %xmm1    ; xmm1 = mem[0],zero 
    0x800486aa0 <+768>:  unpcklps %xmm0, %xmm1              ; xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] 
->  0x800486aa3 <+771>:  movaps %xmm1, 0x40(%rbx,%rcx,2)
    0x800486aa8 <+776>:  movq   0x428(%r14,%rcx), %rax
    0x800486ab0 <+784>:  movq   %rax, 0x840(%rbx,%rcx)
    0x800486ab8 <+792>:  movq   0x828(%r14,%rcx), %rax
    0x800486ac0 <+800>:  movq   %rax, 0xc40(%rbx,%rcx)
    0x800486ac8 <+808>:  movsd  0x30(%r14,%rcx), %xmm1    ; xmm1 = mem[0],zero 
    0x800486acf <+815>:  unpcklps %xmm0, %xmm1              ; xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] 
    0x800486ad2 <+818>:  movaps %xmm1, 0x50(%rbx,%rcx,2)
    0x800486ad7 <+823>:  movq   0x430(%r14,%rcx), %rax
    0x800486adf <+831>:  movq   %rax, 0x848(%rbx,%rcx)
    0x800486ae7 <+839>:  movq   0x830(%r14,%rcx), %rax
    0x800486aef <+847>:  movq   %rax, 0xc48(%rbx,%rcx)
    0x800486af7 <+855>:  addq   $0x10, %rcx
    0x800486afb <+859>:  cmpq   $0x400, %rcx              ; imm = 0x400 
    0x800486b02 <+866>:  jne    0xcba99                   ; <+761>

       rax = 0x00000000002d9048
       rbx = 0x00000000002d8008
       rcx = 0x0000000000000000
       rdx = 0x00000000002f06f8

(lldb) po $xmm0
(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)

(lldb) po $xmm1
(0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
Comment 11 António Trindade 2022-05-15 09:25:51 UTC
I confirm this bug is still present on ZSH 5.8.1 on FreeBSD 13.1-RELEASE.
As stated, disabling the MEM options fixes it.
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-08-31 14:38:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d278243809bfa2de43adb6d398113e5e8c8c4cd1

commit d278243809bfa2de43adb6d398113e5e8c8c4cd1
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2022-08-31 14:35:54 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2022-08-31 14:38:09 +0000

    shells/zsh: remove the MEM option

    Remove the option allowing to use zsh memory allocator, it is only
    useful for zsh developers who won't use the port anyway.

    PR:     259997

 shells/zsh/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Comment 13 Baptiste Daroussin freebsd_committer freebsd_triage 2022-08-31 14:38:53 UTC
I removed the MEM option entirely as it does not bring any good to users anyway