From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1B0A91F44D for ; Mon, 25 Mar 2024 09:03:13 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=GkU5QNlO; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=bQ9gh1kz; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 5C11283833; Mon, 25 Mar 2024 09:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1711357385; bh=0VN2+tQQ69G7SUxaMOOnCFysJzkxqbcFp9b7QVIxhzo=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=GkU5QNlOK+QUocuk4+Do70Poz3R/wjW9rH9NKSYKM04t6FEn7rRWTN/a1HTfxjst0 s8SRaXTeNOoO0wrzbPTbUoT6Xv5mwXKxjsqw6tHDmbgxWH+jz/XNTuJIaLu7jRQOtV PGrg0i7nWLZgE6wW/1hFKe+zaFVPwnEHPJ+SMQtc= Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) by nue.mailmanlists.eu (Postfix) with ESMTPS id B86AD83834 for ; Mon, 25 Mar 2024 09:02:58 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=bQ9gh1kz; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=P33MVYZM7DDf0/W4a1KdFJy8xfHMO7gWjuQYeLOq4EQ=; b=bQ9gh1kzCyZw03s/DuCL/cRAAoAGQ5xboMcpr2iD+VTucjidpitl1+etd2zPg3DxdCu8 fkEN8NXO4bk9pqGzp6LstjdM04+PpVr+s/BoTzFuyVNE1Hgmy5i0wKaz+YERQqHCnt9okZ jNcQXTyw8JbxvR6+TFo8MmawyvvUmL7r8aHrQ93+5Hiv9U6AIpexdMCoRW9yxgZ8E4a8sm FwrnmAV64IKFa542wHMJM7mCHPMBEX8Cz78n3NFp1A7KdcaHpsKmeI1O9pjtIw5jnYDmDH PeENwP4nd7TUvSkTQwiMxBPglDTyP/zpYlWzGRA1LAXQ/jegQWp5hlfWr/li+ccw== Received: by recvd-6fc499775c-49mjq with SMTP id recvd-6fc499775c-49mjq-1-66013DC1-9 2024-03-25 09:02:57.418454609 +0000 UTC m=+561727.416836313 Received: from herokuapp.com (unknown) by geopod-ismtpd-13 (SG) with ESMTP id 2VoemQ4FQWC3yarxDpAVFA for ; Mon, 25 Mar 2024 09:02:57.370 +0000 (UTC) Date: Mon, 25 Mar 2024 09:02:57 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20389 X-Redmine-Issue-Author: mdalessio X-Redmine-Issue-Assignee: byroot X-Redmine-Issue-Priority: Normal X-Redmine-Sender: byroot 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-Redmine-MailingListIntegration-Message-Ids: 93909 X-SG-EID: =?us-ascii?Q?u001=2EKmNZ1u3n1vIpO8NNTdp+Q9c0ai7potxbEDLMO7SOJO=2F4KkRUz0d23466m?= =?us-ascii?Q?naiq=2F5fmA4hb60MdRMUAwHZnjIWVFu=2FrqiBOz5c?= =?us-ascii?Q?nOvkBudsSTjemKwMx2kT9uZldB+GMzizITmX4qf?= =?us-ascii?Q?0Ks6td9eyrIkaKlw9FMyiAd1ZCGNXRKU+rp5jgY?= =?us-ascii?Q?9alSNRLqzOccT2=2FniX8elAHPx+V1yKGE62fsgS4?= =?us-ascii?Q?hx4VQtECSBQEo47fD1HaqZRwduRx4FUTpZ4jQkU?= =?us-ascii?Q?8mxebJXeEozySl3ovFAubdovAw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: YLV4METUMA6YPTWHXZNJYOJDRPL6NVGT X-Message-ID-Hash: YLV4METUMA6YPTWHXZNJYOJDRPL6NVGT X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117311] [Ruby master Bug#20389] Issue with chilled strings and mutability after 12be40ae List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "byroot (Jean Boussier) via ruby-core" Cc: "byroot (Jean Boussier)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20389 has been updated by byroot (Jean Boussier). Thank you @nobu, I was about to look into it :) ---------------------------------------- Bug #20389: Issue with chilled strings and mutability after 12be40ae https://bugs.ruby-lang.org/issues/20389#change-107453 * Author: mdalessio (Mike Dalessio) * Status: Closed * Assignee: byroot (Jean Boussier) * ruby -v: ruby 3.4.0dev (2024-03-23T16:40:17Z master 8265a7531f) [x86_64-linux] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED ---------------------------------------- Commit 12be40ae introduced the concept of "chilled" strings when code is compiled with frozen-string-literals not explicitly enabled or disabled. I believe I've found a related bug, which I've bisected to this commit. This reproduction has been simplified from a failing test case in the `http-cookie` gem: ``` ruby puts RUBY_DESCRIPTION re = %r{.(?.*)} input = "x/dir[]/file.html" match = re.match(input) # => "#" thing = match[:thing] puts "before: #{thing.inspect}" input[match.begin(:thing)...match.end(:thing)] = "/dir%5B%5D/file.html" puts "after : #{thing.inspect}" exit 1 unless thing == "/dir[]/file.html" ``` Ruby 3.3.0 and earlier is fine: ``` $ ruby ./issue-chilled-strings.rb ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux] before: "/dir[]/file.html" after : "/dir[]/file.html" ``` Master with frozen string explicitly disabled passes: ``` $ ruby --disable-frozen-string-literal ./issue-chilled-strings.rb ruby 3.4.0dev (2024-03-23T16:40:17Z master 8265a7531f) [x86_64-linux] before: "/dir[]/file.html" after : "/dir[]/file.html" ``` Master with frozen strings explicitly enabled fails as expected: ``` $ ruby --enable-frozen-string-literal ./issue-chilled-strings.rb ruby 3.4.0dev (2024-03-23T16:40:17Z master 8265a7531f) [x86_64-linux] before: "/dir[]/file.html" ./issue-chilled-strings.rb:12:in 'String#[]=': can't modify frozen String: "x/dir[]/file.html" (FrozenError) from ./issue-chilled-strings.rb:12:in '
' ``` But master with no frozen string setting ("chilled") fails, and modifies what should be a frozen string: ``` $ ruby ./issue-chilled-strings.rb ruby 3.4.0dev (2024-03-23T16:40:17Z master 8265a7531f) [x86_64-linux] before: "/dir[]/file.html" after : "/dir%5B%5D/file." ``` I believe in this case, the chilled warning should be emitted, but then the frozen string should not be modified. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/