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.6 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 37D951F45A for ; Tue, 13 Aug 2019 23:49:56 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A936D1209DD; Wed, 14 Aug 2019 08:49:49 +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 585811209C5 for ; Wed, 14 Aug 2019 08:49:46 +0900 (JST) Received: by filter0032p3iad2.sendgrid.net with SMTP id filter0032p3iad2-32291-5D534C9C-21 2019-08-13 23:49:48.680360209 +0000 UTC m=+1571548.174191575 Received: from herokuapp.com (unknown [54.224.29.177]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id hF-StQbCRWWS8j4RS57Kww for ; Tue, 13 Aug 2019 23:49:48.710 +0000 (UTC) Date: Tue, 13 Aug 2019 23:49:48 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 69878 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15267 X-Redmine-Issue-Author: nobu X-Redmine-Sender: jeremyevans0 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?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIAQBUq4FKlQnLsump0MP+prkzs98N4IXdPz051?= =?us-ascii?Q?ehr2wWU+J2sqdbNQejFV=2F=2FZ0uge=2F=2FSb8mwxf2N2?= =?us-ascii?Q?aGSSIe9DVnhNEc9MDtW4Zj0LG5j0wtJgIMB0z8T?= =?us-ascii?Q?ghYSiUY4ZmEdgkVAWENsV4lBoidip0Xva4w=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 94331 Subject: [ruby-core:94331] [Ruby master Bug#15267] File.basename + File.extname does not restore the original name 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 #15267 has been updated by jeremyevans0 (Jeremy Evans). File file-basename-trailing-dot-15267.patch added Attached is a patch that fixes this issue. With the patch: ```ruby name = 'file.' File.basename(name, '.*') # => "file." File.extname(name) # => "" ``` ---------------------------------------- Bug #15267: File.basename + File.extname does not restore the original name https://bugs.ruby-lang.org/issues/15267#change-80723 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Related to #15224, I found the case `File.basename(name, '.*')+File.extname(name) == File.basename(name)` is not true. ```ruby name = 'file.' File.basename(name, '.*') #=> "name" File.extname(name) #=> "" ``` Both do not contain the last dot. basename(1) seems to result in the base name with the dot, when stripping a wildcard suffix. ``` $ basename name. '.*' name. ``` ---Files-------------------------------- file-basename-trailing-dot-15267.patch (1.96 KB) -- https://bugs.ruby-lang.org/