From unknown Sun Jun 22 07:48:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69437: basename fails with suffix containing slash Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 27 Feb 2024 20:26:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69437 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 69437@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17090655595836 (code B ref -1); Tue, 27 Feb 2024 20:26:03 +0000 Received: (at submit) by debbugs.gnu.org; 27 Feb 2024 20:25:59 +0000 Received: from localhost ([127.0.0.1]:51664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rf41T-0001Vv-1t for submit@debbugs.gnu.org; Tue, 27 Feb 2024 15:25:59 -0500 Received: from lists.gnu.org ([209.51.188.17]:48132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rf41M-0001VJ-VY for submit@debbugs.gnu.org; Tue, 27 Feb 2024 15:25:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rf3vb-0003pU-7D for bug-guile@gnu.org; Tue, 27 Feb 2024 15:19:51 -0500 Received: from river.fysh.org ([2001:41d0:d:20da::2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rf3vZ-0000oo-DK for bug-guile@gnu.org; Tue, 27 Feb 2024 15:19:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fysh.org; s=20170316; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yE8qAO9f+oURAJuCFg5Bx36qeLiGrYtWa9wf5fX0py4=; b=4yyzVRhYzIF7El0fvgNBMpeZx2 Au7ApWGg+qPaWcfRgXzVQIzd/dG4ABJ31iuu38xRC+gVeYjMVod92nuB41wO8z1fdACu5ovDE3cKo A0/iQi7LznxNTL45UiUQHk+TbB7Y40/63kuRKgMweuYK4bGU71Yb7WnXq12Rj4Pl7t/I=; Received: from zefram by river.fysh.org with local (Exim 4.96 #2 (Debian)) id 1rf3vU-00GIbN-2C; Tue, 27 Feb 2024 20:19:44 +0000 Date: Tue, 27 Feb 2024 20:19:44 +0000 From: Zefram Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=2001:41d0:d:20da::2; envelope-from=zefram@fysh.org; helo=river.fysh.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) $ guile-3.0.9 -c '(write (basename "foo/bar" "o/bar")) (newline)' Backtrace: [...] ERROR: In procedure basename: Value out of range: 18446744073709551614 Looks like this decides based on the whole pathname that the five-character suffix matches, and then tries to remove that suffix from the three-character basename. This is not sensible behaviour. It should probably signal an error if given any suffix argument that contains a slash character. If not, then it should be comparing the suffix against the basename, not the complete pathname, with the effect that a suffix containing a slash will never be matched and so no attempt will be made to remove it. -zefram From unknown Sun Jun 22 07:48:57 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Zefram Subject: bug#69437: closed (Re: bug#69437: basename fails with suffix containing slash) Message-ID: References: <87a5htz8mh.fsf@trouble.defaultvalue.org> X-Gnu-PR-Message: they-closed 69437 X-Gnu-PR-Package: guile Reply-To: 69437@debbugs.gnu.org Date: Sat, 03 Aug 2024 19:54:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1722714842-13174-1" This is a multi-part message in MIME format... ------------=_1722714842-13174-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #69437: basename fails with suffix containing slash which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 69437@debbugs.gnu.org. --=20 69437: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D69437 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1722714842-13174-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 69437-done) by debbugs.gnu.org; 3 Aug 2024 19:53:17 +0000 Received: from localhost ([127.0.0.1]:54825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saKoW-0003OC-SA for submit@debbugs.gnu.org; Sat, 03 Aug 2024 15:53:17 -0400 Received: from defaultvalue.org ([45.33.119.55]:54614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saKoV-0003O4-2s for 69437-done@debbugs.gnu.org; Sat, 03 Aug 2024 15:53:15 -0400 Received: from trouble.defaultvalue.org (localhost [127.0.0.1]) (Authenticated sender: rlb@defaultvalue.org) by defaultvalue.org (Postfix) with ESMTPSA id A971F20489; Sat, 3 Aug 2024 14:52:54 -0500 (CDT) Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id 4F50914E05C; Sat, 3 Aug 2024 14:52:54 -0500 (CDT) From: Rob Browning To: 69437-done@debbugs.gnu.org Subject: Re: bug#69437: basename fails with suffix containing slash In-Reply-To: (zefram@fysh.org's message of "Tue, 27 Feb 2024 20:19:44 +0000") References: Date: Sat, 03 Aug 2024 14:52:54 -0500 Message-ID: <87a5htz8mh.fsf@trouble.defaultvalue.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 69437-done Cc: Zefram X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Zefram writes: > $ guile-3.0.9 -c '(write (basename "foo/bar" "o/bar")) (newline)' > Backtrace: > [...] > ERROR: In procedure basename: > Value out of range: 18446744073709551614 Hopefully fixed in main now via: commit c03115c39d35784e87187b467e783d21a326eaf2 basename: check suffix against basename, not full argument * libguile/filesys: check suffix against basename, not full argument. Thanks for the report -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 ------------=_1722714842-13174-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Feb 2024 20:25:59 +0000 Received: from localhost ([127.0.0.1]:51664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rf41T-0001Vv-1t for submit@debbugs.gnu.org; Tue, 27 Feb 2024 15:25:59 -0500 Received: from lists.gnu.org ([209.51.188.17]:48132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rf41M-0001VJ-VY for submit@debbugs.gnu.org; Tue, 27 Feb 2024 15:25:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rf3vb-0003pU-7D for bug-guile@gnu.org; Tue, 27 Feb 2024 15:19:51 -0500 Received: from river.fysh.org ([2001:41d0:d:20da::2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rf3vZ-0000oo-DK for bug-guile@gnu.org; Tue, 27 Feb 2024 15:19:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fysh.org; s=20170316; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yE8qAO9f+oURAJuCFg5Bx36qeLiGrYtWa9wf5fX0py4=; b=4yyzVRhYzIF7El0fvgNBMpeZx2 Au7ApWGg+qPaWcfRgXzVQIzd/dG4ABJ31iuu38xRC+gVeYjMVod92nuB41wO8z1fdACu5ovDE3cKo A0/iQi7LznxNTL45UiUQHk+TbB7Y40/63kuRKgMweuYK4bGU71Yb7WnXq12Rj4Pl7t/I=; Received: from zefram by river.fysh.org with local (Exim 4.96 #2 (Debian)) id 1rf3vU-00GIbN-2C; Tue, 27 Feb 2024 20:19:44 +0000 Date: Tue, 27 Feb 2024 20:19:44 +0000 From: Zefram To: bug-guile@gnu.org Subject: basename fails with suffix containing slash Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=2001:41d0:d:20da::2; envelope-from=zefram@fysh.org; helo=river.fysh.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) $ guile-3.0.9 -c '(write (basename "foo/bar" "o/bar")) (newline)' Backtrace: [...] ERROR: In procedure basename: Value out of range: 18446744073709551614 Looks like this decides based on the whole pathname that the five-character suffix matches, and then tries to remove that suffix from the three-character basename. This is not sensible behaviour. It should probably signal an error if given any suffix argument that contains a slash character. If not, then it should be comparing the suffix against the basename, not the complete pathname, with the effect that a suffix containing a slash will never be matched and so no attempt will be made to remove it. -zefram ------------=_1722714842-13174-1--