Subject: bug#6124: basename/dirname are not POSIX compliant on arg starting with a dash

From: Vincent Lefevre <[email-masked]>
Date: Thu, 6 May 2010 13:15:02 +0200

Hi,

I've reported the following bug in the Debian BTS:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580492

With the basename and dirname utilities from GNU Coreutils, one has:

ypig% POSIXLY_CORRECT=1 basename --
basename: missing operand
Try `basename --help' for more information.
ypig% POSIXLY_CORRECT=1 dirname --
dirname: missing operand
Try `dirname --help' for more information.

instead of:

ypig% busybox basename --
--
ypig% busybox dirname --
.

According to POSIX[*], basename and dirname take no options (examples
in POSIX also assume that), so that this would make BusyBox's behavior
correct.

[*] http://www.opengroup.org/onlinepubs/9699919799/utilities/basename.html
    http://www.opengroup.org/onlinepubs/9699919799/utilities/dirname.html

-- 
Vincent Lefèvre <[email-masked]> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)