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=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 66D8220248 for ; Sun, 17 Mar 2019 20:56:29 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id E6F37121E77; Mon, 18 Mar 2019 05:56:24 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id E139F120FFC for ; Mon, 18 Mar 2019 05:56:22 +0900 (JST) Received: by filter0148p3las1.sendgrid.net with SMTP id filter0148p3las1-22978-5C8EB475-15 2019-03-17 20:56:21.77501336 +0000 UTC m=+257962.971710967 Received: from herokuapp.com (unknown [18.208.190.187]) by ismtpd0068p1mdw1.sendgrid.net (SG) with ESMTP id 16WpDVJ-TeiyDuG0R3bE9Q for ; Sun, 17 Mar 2019 20:56:21.504 +0000 (UTC) Date: Sun, 17 Mar 2019 20:56:22 +0000 (UTC) From: kou@cozmixng.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67310 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15662 X-Redmine-Issue-Author: gsamokovarov X-Redmine-Issue-Assignee: kou X-Redmine-Sender: kou 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?OgCtJ0S3gkqIDZ0y6NurOwkms=2FhwVHU2KHZvf7rQCeJPD6bj06iW74XzgyOBOm?= =?us-ascii?Q?cFLZ1Fkk4mXz7klczcCGyo=2FYMYgnR3maSwVojIL?= =?us-ascii?Q?GUIl=2FDykhOKvkJBCmn6o8MLI7AsuyHt4eLjpm2n?= =?us-ascii?Q?RiehxeBTSTB96hYZPm+GANRlOo8tF7HaM4FV298?= =?us-ascii?Q?T1yb0ju26+fezaIEUUMagnXCps7eIxM1tgg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 91857 Subject: [ruby-core:91857] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO 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 #15662 has been updated by kou (Kouhei Sutou). Status changed from Assigned to Closed Thanks! ---------------------------------------- Bug #15662: Fix CSV delegation to missing StringIO https://bugs.ruby-lang.org/issues/15662#change-77128 * Author: gsamokovarov (Genadi Samokovarov) * Status: Closed * Priority: Normal * Assignee: kou (Kouhei Sutou) * Target version: * ruby -v: * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- If you create a CSV from raw content like: csv = CSV.new("h1,h2") You'll get method missing when calling `csv.path` but still, get `true` when you call `csv.respond_to?(:path)`. This tricks 3rd party libraries like carrierwave which try to call `path` on their input if it responds to it. See https://github.com/carrierwaveuploader/carrierwave/blob/a91ab69fdd8052cdf5a5e48ef8baf40939e441fb/lib/carrierwave/sanitized_file.rb#L109-L123 This stops me from passing CSV objects as StringIO's into carrierwave uploads, for example, but the problem can also be manifested in other 3rd party libraries, as responding to a method and returning a `NoMethodError` when calling it is still an unexpected behavior. I have gone through the CSV delegation scheme and made sure that every method that StringIO doesn't respond to returns a meaningful zero value and does not raise a `NoMethodError` while used through a CSV Instance. -- https://bugs.ruby-lang.org/