From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 278711F4B4 for ; Wed, 31 Mar 2021 13:10:47 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 80974120F25; Wed, 31 Mar 2021 22:09:43 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 647D8120DA2 for ; Wed, 31 Mar 2021 22:09:41 +0900 (JST) Received: by filterdrecv-p3las1-699f5f7ff5-l6hp6 with SMTP id filterdrecv-p3las1-699f5f7ff5-l6hp6-18-606474C9-4B 2021-03-31 13:10:33.403554861 +0000 UTC m=+671853.697414161 Received: from herokuapp.com (unknown) by ismtpd0158p1iad2.sendgrid.net (SG) with ESMTP id zGV1APWjTUiwWNGKFjmDeQ for ; Wed, 31 Mar 2021 13:10:33.214 +0000 (UTC) Date: Wed, 31 Mar 2021 13:10:33 +0000 (UTC) From: mame@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 79171 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17765 X-Redmine-Issue-Author: lenwood X-Redmine-Sender: mame X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?EJh2gqwnyqXtd++xo=2FinyA1V0bXouTB4FkWnzNiKb49yZzu4F0Rhk39o2wb733?= =?us-ascii?Q?sRX0BPcHO9TsOpcN3iYnhFZu2IUwMEUkGbCpg9+?= =?us-ascii?Q?bYLmfQjc9xUAnA3OSwe6pH1ifzG73YDBBXqlI2G?= =?us-ascii?Q?9OqLYFfU4Q3LQXgyCyICm5XrSlAdFgSmRHKkDib?= =?us-ascii?Q?zwlBFxUMI9ZI2MDS9ztIr=2FpHl+YsmINWSH=2F6ina?= =?us-ascii?Q?kLURbuZaxAKOMpsNk=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103128 Subject: [ruby-core:103128] [Ruby master Bug#17765] Segmentation fault when calling String#gsub X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17765 has been updated by mame (Yusuke Endoh). It is difficult to identify the problem because the log lacks C level backtrace information maybe due to musl. Are you using Alpine Linux? If so could you try Debian with glibc? ---------------------------------------- Bug #17765: Segmentation fault when calling String#gsub https://bugs.ruby-lang.org/issues/17765#change-91202 * Author: lenwood (Paul Martensen) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux-musl] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- We recently had a ruby segfault occuring while invoking `String#gsub`. The line in the code looks like this: ``` ruby def sanitize_for_prometheus(string_or_symbol) reg = /[^a-zA-Z_0-9]/ string_or_symbol.to_s.downcase.gsub(reg, '_') end ``` And we've tried to replicate the segfault (on a different machine) with this script: ```rb def sanitize_for_prometheus(string_or_symbol) reg = /[^a-zA-Z_0-9]/ string_or_symbol.to_s.downcase.gsub(reg, '_') end def rand_string_or_symbol @o ||= [('a'..'z').to_a, ('A'..'Z').to_a, (0..9).to_a, '-', '.'].flatten str = @o.sample(50).join rand > 0.5 ? str.to_sym : str end loop { sanitize_for_prometheus rand_string_or_symbol } ``` But without success so far. I have attached a shortened version of the log file for reference. ---Files-------------------------------- segfault.log (60.8 KB) segfault_gsub.rb (343 Bytes) -- https://bugs.ruby-lang.org/