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=-3.7 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS 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 16D75211B9 for ; Wed, 26 Dec 2018 00:38:17 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 97392121567; Wed, 26 Dec 2018 09:38:13 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 28A39121537 for ; Wed, 26 Dec 2018 09:38:10 +0900 (JST) Received: by filter0144p3las1.sendgrid.net with SMTP id filter0144p3las1-13584-5C22CD6E-3B 2018-12-26 00:38:07.090792297 +0000 UTC m=+441569.890027944 Received: from herokuapp.com (ec2-54-198-3-227.compute-1.amazonaws.com [54.198.3.227]) by ismtpd0058p1mdw1.sendgrid.net (SG) with ESMTP id mQeouDxqTF2bo-PKDLbcxQ for ; Wed, 26 Dec 2018 00:38:06.796 +0000 (UTC) Date: Wed, 26 Dec 2018 00:38:08 +0000 (UTC) From: ko1@atdot.net To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 66139 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15460 X-Redmine-Issue-Author: gettalong X-Redmine-Sender: ko1 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS58Ernp6amMz7hggqJQwiYiVZeE9LBUQ6z55W UnKL2AKUiz99Xk8Y3uJ/HV40wGNLXnryldK8nKwcegM9hmjpWsvWuE6f4CMfnlyW8ud+NKL3Qgoz7w hDSX+SugFoEM8KJyfF9jTFNQZpO6LyAM7N3i X-ML-Name: ruby-core X-Mail-Count: 90720 Subject: [ruby-core:90720] [Ruby trunk Bug#15460] Behaviour of String#setbyte changed 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 #15460 has been updated by ko1 (Koichi Sasada). FYI ``` 7213568733f673da0d82f95e8a1bccf79ba3f0d3 Author: shyouhei Date: Mon Nov 19 09:52:46 2018 +0000 string.c: setbyte silently ignores upper bits The behaviour of String#setbyte has been depending on the width of int, which is not portable. Must check explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e :100644 100644 5a5cbb576c31350a416b2121e5efb85aaffa0676 e55c59136a49fb7d2d70805a65a4c7f56519f2e9 M string.c :040000 040000 2170f3be4ac9d27e26ce361c38beb7874c07436f e71fc9f00ed5602a30e9f504fc015b9bf7b4dad1 M test ``` ---------------------------------------- Bug #15460: Behaviour of String#setbyte changed https://bugs.ruby-lang.org/issues/15460#change-75897 * Author: gettalong (Thomas Leitner) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- I just installed Ruby 2.6.0 for benchmarking reasons and found that the change [string.c: setbyte silently ignores upper bits](https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/65804) broke my library/application HexaPDF. Before using String#setbyte I tested how it would respond to values lower than 0 or greater than 255 and found that it automatically performed the needed modulo 256 operation (at least up to Ruby 2.5.3). Therefore I left out the explicit modulo operation for performance reasons. Would it make sense to change the String#setbyte implementation to perform the modulo operation? This would restore compatibility with prior Ruby versions and may be what people would expect. -- https://bugs.ruby-lang.org/