Subject: bug#69437: closed (Re: bug#69437: basename fails with suffix containing slash)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 03 Aug 2024 19:54:02 +0000

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 [email-masked].

-- 
69437: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69437
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#69437: basename fails with suffix containing slash
From: Rob Browning <[email-masked]>
To: [email-masked]
Cc: Zefram <[email-masked]>
Date: Sat, 03 Aug 2024 14:52:54 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Zefram <[email-masked]> 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

Subject: basename fails with suffix containing slash
From: Zefram <[email-masked]>
To: [email-masked]
Date: Tue, 27 Feb 2024 20:19:44 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

$ 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