Re: [hackers] [sbase] basename: Ignore suffix when its an empty string || Carlos J. Torres

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
Date: Mon, 3 Nov 2025 20:04:07 +0100

Hi,

On Mon, Nov 03, 2025 at 07:37:00PM +0100, Hiltjo Posthuma wrote:
> I think theres one case that difers:
>
> basename "" ""
>
> should return "". Now it returns ".".

Not sure about that. From basename(1) in POSIX:

        If string is a null string, it is unspecified whether the
        resulting string is '.' or a null string. In either case,
        skip steps 2 through 6.

Not sure what is saner. Let's open a discussion because I
think both results are right from the point of view of POSIX.

Regards,
Received on Mon Nov 03 2025 - 20:04:07 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 03 2025 - 20:12:38 CET