GNU bug report logs -
#6124
basename/dirname are not POSIX compliant on arg starting with a dash
Previous Next
Reported by: Vincent Lefevre <vincent <at> vinc17.net>
Date: Thu, 6 May 2010 11:36:02 UTC
Severity: normal
Tags: notabug
Merged with 6123
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 05/06/2010 08:24 AM, Vincent Lefevre wrote:
>> Default Behavior: When this section is listed as "None.", it means
>> that the implementation need not support any options. Standard utilities
>> that do not accept options, but that do accept operands, shall recognize
>> "--" as a first argument to be discarded.
>
> OK, an alternative way would be that an exception is added to POSIX,
> just like for "echo".
Please no. echo has an exception precisely because it has historical
baggage, and that is what makes echo so pitiful that POSIX itself states
that printf(1) is more portable than echo(1). Relatively newer
applications, like basename and dirname, that were first written in an
age when consistency was more important, should not be burdened with the
historical baggage of ancient echo(1). And changing it now is too late;
just as you argue about the number of broken scripts that are not robust
because they failed to use --, you have to also consider the number of
correct scripts that have been written with the correct assumption that
basename and dirname accept --: it has been 9 years since POSIX 2001
first codified that behavior.
Besides, we would much prefer to keep 'basename --help' as a GNU
extension. Not having 'POSIXLY_CORRECT=1 /bin/echo --help' give useful
help is an annoyance that we would rather avoid repeating.
>
> However, if extensions are allowed, this would mean that many scripts
> would have to be fixed.
Yes, many broken scripts need to be fixed. But that is the fault of
those broken scripts, not coreutils.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 14 years and 117 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.