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)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 49F9B1F4BE for ; Mon, 21 Oct 2024 08:54:24 +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=v26dWRjx; 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=Z9wgT3FK; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1729500831; bh=hk051yk/jjOPJ8oWaaWS+yJktIATYIkhryapPchSpoM=; 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=v26dWRjxaN7OsA9cfI1InoB6Dd4uNfe6oST350OQaieUMy73ysTxnNu25yr3PJHo2 6JsUUVl8P4IJZn9G7HWp+pUCJnwUHCIU8rNVfPd+HfEuzl1qXsKifJg4+ghCENOFoT IczHrsvIQmzTBwc0GyISa8J2GzvZfXz5F6GvnnsU= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 87CC0448CF for ; Mon, 21 Oct 2024 08:53:51 +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=Z9wgT3FK; dkim-atps=neutral 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 89AF7444F3 for ; Mon, 21 Oct 2024 08:50:12 +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=cUF7+pkutdB09OkO0ykgijlyNH+Bog/S6fh3+vG3YTI=; b=Z9wgT3FKBJT0C0E/QGgA4lCOdvABM4YHwQIore5XXmp5IlFqHn5XwU+PaVbOBCwwbsqg GM6ypcsIXSIo9pDmkfzcGZ9M/nBCQVdlWUJmH9jGrPxpkYjZa2d7xCYRlWU56FYxiZ3NuK 3bMywuwk9QFI0qbtHXaLHZ90ZbbF5mASL+uorwy42uQ5qVmA+aEImfisWfrCyUaUECzOn2 unUp66ya2i8oU2mmf48sD9moRDckMfPb/qso7Av/wKZMQk5IcQfdADuOOJI491TNNkTu7M jNJoRtbbaaU8Z3h36PfOShNS2EacuMFX2Y0Ecz1Q4G/zzG3OBKbj0lDTmUQ3Iw+A== Received: by recvd-7cc7f7d978-tqszr with SMTP id recvd-7cc7f7d978-tqszr-1-671615C3-2B 2024-10-21 08:50:11.458053259 +0000 UTC m=+3336859.821771313 Received: from herokuapp.com (unknown) by geopod-ismtpd-21 (SG) with ESMTP id pDJ9xfMkQ06MQeFweUhb0Q for ; Mon, 21 Oct 2024 08:50:11.415 +0000 (UTC) Date: Mon, 21 Oct 2024 08:50:11 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20802 X-Redmine-Issue-Author: javanthropus X-Redmine-Issue-Priority: Normal X-Redmine-Sender: javanthropus 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: 96171 X-SG-EID: =?us-ascii?Q?u001=2ErGSxngKD6oGl9tWadX4XoV3etLquOoKg0CfRIgtn0=2F=2F51X16iSgr7Y8Wy?= =?us-ascii?Q?1fjCWEM5G6QT6lpC2QanJ2tFrap9W5zaCqDWGhY?= =?us-ascii?Q?=2F96ZJYC5KNRvNqzf96=2F3H=2FUDtEq1wEJY5v4go9A?= =?us-ascii?Q?VqO8A0JHz15AGbe5zdXMkbxZzwSlY=2Fz9paZrrpp?= =?us-ascii?Q?+bAQd1m0KAW4eRrBwqITDuH99j7iNLJL6L7dt4L?= =?us-ascii?Q?F8tXsnxSusdnJRqIY=2FRoRfKzpdEhPSLretxGdbx?= =?us-ascii?Q?Td0OqShYBJkV9HAbUnLUREEhQw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: OQ5VBF7SXF5VFS7GETL3WMQJZAKHLBSY X-Message-ID-Hash: OQ5VBF7SXF5VFS7GETL3WMQJZAKHLBSY 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:119537] [Ruby master Bug#20802] It is possible to set the encoding of an IO instance to one that requires binmode when binmode is not set List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "javanthropus (Jeremy Bopp) via ruby-core" Cc: "javanthropus (Jeremy Bopp)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20802 has been reported by javanthropus (Jeremy Bopp). ---------------------------------------- Bug #20802: It is possible to set the encoding of an IO instance to one that requires binmode when binmode is not set https://bugs.ruby-lang.org/issues/20802 * Author: javanthropus (Jeremy Bopp) * Status: Open * ruby -v: ruby 3.3.4 (2024-07-09 revision be1089c8ec) [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I don't know what problems this may cause, but there are guards against setting the encoding of an IO instance to one such as UTF-16LE when the IO instance is not set to binary mode. Here is a method to bypass those guards: ```ruby f1 = File.open('/dev/null') f2 = File.open('/dev/null') f1.binmode f1.set_encoding('utf-16le') f2.set_encoding('utf-8') f1.reopen(f2) f1.binmode? # <= false f1.external_encoding # <= Encoding::UTF_16LE ``` -- 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/