Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Martijn Dekker Newsgroups: gnu.bash.bug Subject: '=~' crash on NetBSD Date: Wed, 6 May 2020 19:08:36 +0100 Lines: 48 Approved: bug-bash@gnu.org Message-ID: References: <9f5a02eb-6e79-e369-5106-579060a6f946@inlv.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1588788524 26551 209.51.188.17 (6 May 2020 18:08:44 GMT) X-Complaints-To: action@cs.stanford.edu To: Bug reports for the GNU Bourne Again SHell Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Content-Language: en-GB Received-SPF: none client-ip=2a02:2770::21a:4aff:fec6:e3d8; envelope-from=martijn@inlv.org; helo=freekahlil.inlv.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <9f5a02eb-6e79-e369-5106-579060a6f946@inlv.org> Xref: csiph.com gnu.bash.bug:16286 On NetBSD, bash (all versions, including current git) dumps core when using [[ to match against an ERE containing certain UTF-8 characters, for example, É ($'\303\211'). | $ bin/bash-5.0-debug -c "[[ c =~ $'\303\211' ]]" | | malloc: unknown:0: assertion botched | malloc: 0x81ba08: allocated: last allocated from unknown:0 | free: start and end chunk sizes differ | Aborting...Abort trap (core dumped) If it helps, here's a backtrace generated from the core file by 'gdb'. It seems to suggest that only the first byte of the UTF-8 character is included in the pattern... #0 0x00007ae3a22fe48a in _lwp_kill () from /usr/lib/libc.so.12 #1 0x00007ae3a22fdd32 in abort () from /usr/lib/libc.so.12 #2 0x000000000043492e in programming_error ( format=0x5213d8 "free: start and end chunk sizes differ") at error.c:175 #3 0x00000000004f3e78 in xbotch (mem=0x81ba08, e=8, s=0x5213d8 "free: start and end chunk sizes differ", file=0x0, line=0) at malloc.c:358 #4 0x00000000004f4e40 in internal_free (mem=0x81ba08, file=0x0, line=0, flags=0) at malloc.c:964 #5 0x00000000004f5a1e in free (mem=0x81ba08) at malloc.c:1392 #6 0x00000000004b3c02 in sh_regmatch (string=0x806358 "c", pattern=0x819d28 "\303", flags=3) at shmatch.c:118 #7 0x0000000000424c28 in execute_cond_node (cond=0x819a48) at execute_cmd.c:3884 #8 0x0000000000424e3f in execute_cond_command (cond_command=0x819a48) at execute_cmd.c:3959 #9 0x000000000041fb34 in execute_command_internal (command=0x819a88, asynchronous=0, pipe_in=-1, pipe_out=-1, fds_to_close=0x8199e8) at execute_cmd.c:1029 #10 0x0000000000492b38 in parse_and_execute ( string=0x805188 "[[ c =~ \303 ]]", from_file=0x4fe190 "-c", flags=4) at evalstring.c:460 #11 0x0000000000406452 in run_one_command ( command=0x7f7fffb6ca46 "[[ c =~ \303 ]]") at shell.c:1436 #12 0x00000000004055f8 in main (argc=3, argv=0x7f7fffb6c468, env=0x7f7fffb6c488) at shell.c:738 -- modernish -- harness the shell https://github.com/modernish/modernish