Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

5.4.1 regression: PCRE with bash_rematch

I'm still trying to track this down, but getting what I have out there
because in checking just now, I saw that a 5.4.2 might be imminent and I
think this should block.

% /usr/local/Cellar/zsh/5.4.1/bin/zsh -f
osmium% setopt rematchpcre bash_rematch
osmium% [[ "server" =~ ^[^@:/]+$ ]]
zsh: segmentation fault (core dumped)  /usr/local/Cellar/zsh/5.4.1/bin/zsh -f

One of my git utility scripts broke on me when I tried to use it today,
with 5.4.1 on macOS installed by brew.  `brew switch zsh 5.3.1_1` got it
working again.  With a local git-head install built with memory
debugging, I get more details.

zsh(29859,0x7fffe51263c0) malloc: *** mach_vm_map(size=18446744071562072064) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
+./git-clone-each-pdp:49> [[ "$Remote" -pcre-match ^[^@:/]+$./git-clone-each-pdp:49: fatal error: out of memory

The line is:

	elif [[ "$Remote" =~ ^[^@:/]+$ ]]; then

The value of Remote is just "server" (without quotes).

rematchpcre bash_rematch and ksh_arrays are set, only the first two are
needed to reproduce under -f; actually only bash_rematch if -pcre-match
is explicit:

% /opt/zsh-devel/bin/zsh -f
osmium% setopt bash_rematch
osmium% zmodload zsh/pcre
osmium% [[ "server" -pcre-match ^[^@:/]+$ ]]
zsh: segmentation fault (core dumped)  /opt/zsh-devel/bin/zsh -f

With that last one:
-------------------------------8< lldb >8-------------------------------
% lldb -c /cores/core.29982 zsh
(lldb) target create "zsh" --core "/cores/core.29982"
warning: (x86_64) /cores/core.29982 load command 367 LC_SEGMENT_64 has a fileoff + filesize (0x2d11f000) that extends beyond the end of the file (0x2d11e000), the segment will be truncated to match
warning: (x86_64) /cores/core.29982 load command 368 LC_SEGMENT_64 has a fileoff (0x2d11f000) that extends beyond the end of the file (0x2d11e000), ignoring this section
Core file '/cores/core.29982' (x86_64) was loaded.
(lldb) bt
* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x0000000108abeef0 zsh`metafy + 64
    frame #1: 0x0000000108c185c8 pcre.so`___lldb_unnamed_symbol4$$pcre.so + 360
    frame #2: 0x0000000108c18b2b pcre.so`___lldb_unnamed_symbol5$$pcre.so + 619
    frame #3: 0x0000000108a4df86 zsh`evalcond + 1254
    frame #4: 0x0000000108a55992 zsh`___lldb_unnamed_symbol30$$zsh + 98
    frame #5: 0x0000000108a50a61 zsh`___lldb_unnamed_symbol18$$zsh + 497
    frame #6: 0x0000000108a50325 zsh`execlist + 869
    frame #7: 0x0000000108a4ff93 zsh`execode + 195
    frame #8: 0x0000000108a6dcfc zsh`loop + 812
    frame #9: 0x0000000108a70ee4 zsh`zsh_main + 1476
    frame #10: 0x00007fffdc212235 libdyld.dylib`start + 1
    frame #11: 0x00007fffdc212235 libdyld.dylib`start + 1
-------------------------------8< lldb >8-------------------------------

Messages sorted by: Reverse Date, Date, Thread, Author