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=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 2B4D71F4C4 for ; Thu, 31 Oct 2024 19:57:08 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=PwBq/gcH; 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=nY+GODYQ; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1730404625; bh=VXhgpqr8AASNLsYlLHtoVvvlDjii1cm4YF6ih+Kh5i4=; 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=PwBq/gcHxtsECMCHXK9IKm687F5OCjl1c+JwYmvmwLM1QfeywhdSdKaEiu1FE7RQU 3Bbw8EIcmsdNaA1Yhlz9jG5/6g0BN77+b/d4kq1h6z9HVBhmode4LMAkeu8jn/JZyc JI08b16G8pIflolF9vgPIXKpOjWbVlnW65TiuIMo= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 69D4444AC9 for ; Thu, 31 Oct 2024 19:57:05 +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=nY+GODYQ; dkim-atps=neutral Received: from s.wrqvtvvn.outbound-mail.sendgrid.net (s.wrqvtvvn.outbound-mail.sendgrid.net [149.72.120.130]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 105D544A67 for ; Thu, 31 Oct 2024 19:56:53 +0000 (UTC) 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=wUIS4PIuV45LTIL9ix3VUeaLXB4XLmJYyWdCwrMyt48=; b=nY+GODYQx6SM8Ve5WqxhKaCf+FcN+SjSkuX6ldEitdf7zk+pn9uApzpDEo28uX0C/hSf m+S3n64YhfKQsUl7hpZYVR1T+lQoyIr/Nql1+b5GGqgXelXPGoVvQ/zH8wFWmicENQY/jd jjnWpPJzBmHIHasNw2JWg2UCfG4CKdt5xdOP7yCFszTgCymwHDe2TfHTOVBH0w4qFMQETB qxfmFpS2lzLO8n0d1xlRBpoL5GjYmCEw0HuACVUe/CXUbPNUtiTo5iNVb3HN2z/kUbc7k9 xX8N6DU3sH3kQBDZ5GD/jE7OtdQ/rByTefCnOducSbkbSt14dK+hajX+tU3WEkVg== Received: by recvd-55fc7fd858-8mxwb with SMTP id recvd-55fc7fd858-8mxwb-1-6723E104-E 2024-10-31 19:56:52.556660639 +0000 UTC m=+4240788.396294560 Received: from herokuapp.com (unknown) by geopod-ismtpd-4 (SG) with ESMTP id MBX9a39XSd2XiwLfLHWFeg for ; Thu, 31 Oct 2024 19:56:52.489 +0000 (UTC) Date: Thu, 31 Oct 2024 19:56:52 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20856 X-Redmine-Issue-Author: hurricup X-Redmine-Issue-Priority: Normal X-Redmine-Sender: Eregon 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: 96324 X-SG-EID: =?us-ascii?Q?u001=2EByjZWvxTCjdoV8K03xEuhE7KqN4thWULFLM7+oH78KY30oYB3qFthsDpL?= =?us-ascii?Q?4w4cbYa3ttBh8bAHPOnE=2FkzPba67JNu7Lnrked2?= =?us-ascii?Q?O7K9VQ=2FJax0pTFvq2zcB4G8YX7S5L3LfiC73Awp?= =?us-ascii?Q?HYmFrZssxFds2Z7jQaPb7X9LMQVDVgVGjKBuZq5?= =?us-ascii?Q?g2E+ZRkmZ180YIeoc3PTam=2FbzEEdmrbTKNF3OtK?= =?us-ascii?Q?eveUfyr8G4FzxGIpj0eJly0JFNde2fpNI2kSnrf?= =?us-ascii?Q?YuGc2=2FR5r9cR96l4tR8eCBMpvg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: VMVUQQYHXYMMXIM6WSLIW5QPMIBIPSUD X-Message-ID-Hash: VMVUQQYHXYMMXIM6WSLIW5QPMIBIPSUD 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.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:119660] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Eregon (Benoit Daloze) via ruby-core" Cc: "Eregon (Benoit Daloze)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20856 has been updated by Eregon (Benoit Daloze). Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED It's a bug of 3.4.0-preview2 and specifically of the Prism compiler, 3.3 and earlier and `--parser=parse.y` succeed for all cases. The order is: * parse that file: * execute it * in that new thread eval is called * that parses `"a == b"`, with outer scopes [[a,x], [s,b]]. ---------------------------------------- Bug #20856: Incorrect and inconsistent multi-thread eval execution https://bugs.ruby-lang.org/issues/20856#change-110317 * Author: hurricup (Alexandr Evstigneev) * Status: Open * ruby -v: 3.4.0-preview2 * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED ---------------------------------------- Consider example: ``` s = Thread.new { a = 5 puts eval("a == b") x = 6 } s.join b = 11 ``` As far as I see it, it should not work. Because at the moment of eval, b is unknown and not even declared (it can even be in condition). But it may be available because file `iseq` already compiled and we know that there is b. So, this works in ruby 3.3 in a script we running, wrapped into the method, or required by other file. But in 3.4-preview2: - it works in file - it works in method - it fails if required from other file with: ``` # terminated with exception (report_on_exception is true): (eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in ': undefined local variable or method 'b' for main (NameError) from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval' from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in ' (eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in ': undefined local variable or method 'b' for main (NameError) from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval' from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in ' ``` And this ^^ is correct behavior if you ask me :) but atm it is inconsistent between the ruby versions and even in the scope of 3.4-preview2 -- 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/lists/ruby-core.ml.ruby-lang.org/