[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in basename builtin
From: |
Eli Schwartz |
Subject: |
Re: Bug in basename builtin |
Date: |
Wed, 18 Mar 2020 09:07:32 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 3/18/20 8:57 AM, Greg Wooledge wrote:
> On Wed, Mar 18, 2020 at 09:49:06AM +0100, Stefan Krusche wrote:
>> Am Mittwoch, 18. März 2020 schrieb Peng Yu:
>>> Hi,
>>>
>>> $ type basename
>>> basename is a shell builtin
>>> $ basename -- # kill the terminal.
>>>
>>> The above command kill the terminal. Is there a bug?
>>
>> Hallo Peng,
>>
>> this does not happen on my system, Devuan ascii with:
>> $ bash --version
>> GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
>>
>> $ basename --
>> basename: missing operand
>> Try 'basename --help' for more information.
>
> That's the GNU coreutils version of basename. Peng Yu is apparently
> using a loadable builtin.
On my Arch Linux system (which distributes the built contents of
bash.git/examples/loadables/):
[eschwartz@arch ~]$ bash
[eschwartz@arch ~]$ cd /tmp
[eschwartz@arch /tmp]$ enable -f /usr/lib/bash/basename basename
[eschwartz@arch /tmp]$ type basename
basename is a shell builtin
[eschwartz@arch ~]$ basename
basename: usage: basename string [suffix]
[eschwartz@arch /tmp]$ basename foo/bar
bar
[eschwartz@arch /tmp]$ basename -
-
[eschwartz@arch /tmp]$ basename -s
bash: basename: -s: invalid option
basename: usage: basename string [suffix]
[eschwartz@arch /tmp]$ basename --help
basename: basename string [suffix]
Return non-directory portion of pathname.
The STRING is converted to a filename corresponding to the last
pathname component in STRING. If the suffix string SUFFIX is
supplied, it is removed.
[eschwartz@arch /tmp]$ basename --
[eschwartz@arch ~]$ echo $?
139
[eschwartz@arch ~]$
...
Stefan, a GNU coreutils external program wouldn't cause the bash
interpreter to crash if it has a problem. This one here, does.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature