From unknown Tue Jun 24 05:09:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8420 <8420@debbugs.gnu.org> To: bug#8420 <8420@debbugs.gnu.org> Subject: Status: dirname Reply-To: bug#8420 <8420@debbugs.gnu.org> Date: Tue, 24 Jun 2025 12:09:13 +0000 retitle 8420 dirname=20 reassign 8420 coreutils submitter 8420 "Michele Marigliano" severity 8420 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 11:28:59 2011 Received: (at submit) by debbugs.gnu.org; 4 Apr 2011 15:29:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6li6-0004KW-PQ for submit@debbugs.gnu.org; Mon, 04 Apr 2011 11:28:59 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6kVJ-0002Z4-Od for submit@debbugs.gnu.org; Mon, 04 Apr 2011 10:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6kVC-00069s-U1 for submit@debbugs.gnu.org; Mon, 04 Apr 2011 10:11:36 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RECEIVED_FROM_WINDOWS_HOST autolearn=no version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:57757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q6kVB-00069c-Ox for submit@debbugs.gnu.org; Mon, 04 Apr 2011 10:11:34 -0400 Received: from [140.186.70.92] (port=42764 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6kV9-0001vs-Ci for bug-coreutils@gnu.org; Mon, 04 Apr 2011 10:11:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6k3c-0005i3-Lo for bug-coreutils@gnu.org; Mon, 04 Apr 2011 09:43:05 -0400 Received: from pop3out.finsiel.it ([193.43.104.48]:27241 helo=out.almavivaitalia.it) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Q6k3c-0005h9-6u for bug-coreutils@gnu.org; Mon, 04 Apr 2011 09:43:04 -0400 Received: from POSTA01.itmaster.local ([156.54.185.23]) by out.almavivaitalia.it with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Apr 2011 15:45:04 +0200 Received: from AGRTEST ([10.100.8.131]) by POSTA01.itmaster.local with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Apr 2011 15:43:00 +0200 From: "Michele Marigliano" To: Subject: dirname Date: Mon, 4 Apr 2011 15:43:36 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0699_01CBF2DF.10025C10" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcvyzkwhLwMUpYbiS9OBrlJAEPoC8w== Content-Language: it X-OriginalArrivalTime: 04 Apr 2011 13:43:00.0335 (UTC) FILETIME=[3698A7F0:01CBF2CE] X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP4, XP SP1+ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 04 Apr 2011 11:28:58 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) This is a multi-part message in MIME format. ------=_NextPart_000_0699_01CBF2DF.10025C10 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I execute the following bash command on RH 5.3 CURRENT_DIR=`/usr/bin/dirname $0` /usr/bin/dirname: invalid option -- b Try `/usr/bin/dirname --help' for more information. [oracle@mpawls ~]$ /usr/bin/dirname --version dirname (GNU coreutils) 5.97 Copyright (C) 2006 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License . There is NO WARRANTY, to the extent permitted by law. Written by David MacKenzie and Jim Meyering. $ echo $0 -bash $ dirname dirname: missing operand Try `dirname --help' for more information. $ dirname -b dirname: invalid option -- b Try `dirname --help' for more information. I tried it also on Centos 5.5 with same result. Instead on RH 4.x------------------------------------------ $ CURRENT_DIR=`/usr/bin/dirname $0` $ /usr/bin/dirname --version dirname (GNU coreutils) 5.2.1 Written by David MacKenzie and Jim Meyering. Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ $ echo $0 -bash $ dirname dirname: too few arguments Try `dirname --help' for more information. $ dirname -b . $ Best wish Michael ------=_NextPart_000_0699_01CBF2DF.10025C10 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

I execute = the following bash command on RH 5.3

CURRENT_DIR=3D`/usr/bin/dirname = $0`

/usr/bin/dirname: invalid option -- = b

Try `/usr/bin/dirname --help' for more = information.

[oracle@mpawls ~]$ = /usr/bin/dirname --version

dirname = (GNU coreutils) 5.97

Copyright (C) 2006 Free Software Foundation, = Inc.

This is free software.  You may = redistribute copies of it under the terms of

the GNU = General Public License = <http://www.gnu.org/licenses/gpl.html>.

There = is NO WARRANTY, to the extent permitted by = law.

 

Written = by David MacKenzie and Jim Meyering.

$ echo = $0

-bash

$ = dirname

dirname: missing = operand

Try `dirname --help' for more = information.

$ dirname = -b

dirname: invalid option -- = b

Try `dirname --help' for more = information.

 

I tried it = also on Centos 5.5 with same result.

 

Instead on = RH 4.x------------------------------------------

$ = CURRENT_DIR=3D`/usr/bin/dirname $0`

$ = /usr/bin/dirname --version

dirname = (GNU coreutils) 5.2.1

Written = by David MacKenzie and Jim Meyering.

 

Copyright (C) 2004 Free Software Foundation, = Inc.

This is free software; see the source for = copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or = FITNESS FOR A PARTICULAR PURPOSE.

$

$ echo = $0

-bash

$ = dirname

dirname: too few = arguments

Try `dirname --help' for more = information.

$ dirname = -b

.

$

 

Best = wish

Michael

 

 

------=_NextPart_000_0699_01CBF2DF.10025C10-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 12:02:28 2011 Received: (at 8420-done) by debbugs.gnu.org; 4 Apr 2011 16:02:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6mEW-00055D-Cl for submit@debbugs.gnu.org; Mon, 04 Apr 2011 12:02:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6mET-00054z-5S for 8420-done@debbugs.gnu.org; Mon, 04 Apr 2011 12:02:27 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p34G2FhA009230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Apr 2011 12:02:15 -0400 Received: from [10.3.113.73] (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p34G2Few021862; Mon, 4 Apr 2011 12:02:15 -0400 Message-ID: <4D99EB86.1080901@redhat.com> Date: Mon, 04 Apr 2011 10:02:14 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 MIME-Version: 1.0 To: Michele Marigliano Subject: Re: bug#8420: dirname References: In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig0FBC3FDFC2799237F8164477" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 8420-done Cc: 8420-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0FBC3FDFC2799237F8164477 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable tag 8420 + invalid thanks On 04/04/2011 07:43 AM, Michele Marigliano wrote: > Hi,=20 >=20 > =20 >=20 > I execute the following bash command on RH 5.3=20 >=20 > CURRENT_DIR=3D`/usr/bin/dirname $0` >=20 > /usr/bin/dirname: invalid option -- b Thanks for the report. However, this is not a bug in dirname, but in your usage pattern. You are invoking "dirname -bash", which dirname (rightly) interprets as the attempt to be the -b option, but dirname does not have a -b option. You need to use -- to mark the end of options and the start of arguments: dirname -- "$0" > dirname (GNU coreutils) 5.97 Wow, that's old. The latest stable version is 8.10. > $ /usr/bin/dirname --version >=20 > dirname (GNU coreutils) 5.2.1 Wow, that's even older, but same story. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig0FBC3FDFC2799237F8164477 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNmeuGAAoJEKeha0olJ0NqD9YIAJFOsjotDI6p+Fr0NteqJuhp JJ2yOShvjQODVavHYAIWzbHv3s3l/HPMasTs1dGHr+RNAAegXpT+P7F2qAMt64SP g7aigg+M/eMPiHA2g+707siQciSp7vCMrPHVRyZCyS2fGIJXob0f3oPHXiZ3gHhI SGL9H9ea+TJwPtplK1ZC0DVDfaUqislnyennYYylsvtSjJmAE419gMknV7IGwf4X /z9kOfP2PGen8w72hpaR9Uwujgv90KxsJmxlqFPKczb2S75ssMdxvntMIOTogBuO 1iDseQVA9fTeEnBZm6HUBP8lEy0pGCBNNGIGAozHllQSFXS0Hh0PJef+L+7/4v4= =S6dF -----END PGP SIGNATURE----- --------------enig0FBC3FDFC2799237F8164477-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 12:18:04 2011 Received: (at submit) by debbugs.gnu.org; 4 Apr 2011 16:18:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6mTb-0005Ql-JD for submit@debbugs.gnu.org; Mon, 04 Apr 2011 12:18:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6mPg-0005KB-90 for submit@debbugs.gnu.org; Mon, 04 Apr 2011 12:14:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6mPa-0005QV-8z for submit@debbugs.gnu.org; Mon, 04 Apr 2011 12:13:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:50516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q6mPZ-0005Q5-Hb for submit@debbugs.gnu.org; Mon, 04 Apr 2011 12:13:54 -0400 Received: from [140.186.70.92] (port=51158 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6mPK-0003g6-8e for bug-coreutils@gnu.org; Mon, 04 Apr 2011 12:13:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6mPE-0005MZ-G9 for bug-coreutils@gnu.org; Mon, 04 Apr 2011 12:13:33 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:45546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q6mPD-0005M4-Rn for bug-coreutils@gnu.org; Mon, 04 Apr 2011 12:13:32 -0400 Received: from localhost.localdomain (unknown [78.231.73.92]) by smtp5-g21.free.fr (Postfix) with ESMTP id F178CD481F6 for ; Mon, 4 Apr 2011 18:13:25 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 67BB9971E25; Mon, 4 Apr 2011 18:13:24 +0200 (CEST) Date: Mon, 4 Apr 2011 18:13:24 +0200 From: Etienne Buira To: bug-coreutils@gnu.org Subject: Re: bug#8420: dirname Message-ID: <20110404161324.GA8245@epicure> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 04 Apr 2011 12:18:02 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) On Mon, Apr 04, 2011 at 03:43:36PM +0200, Michele Marigliano wrote: > Hi, Hi. > I execute the following bash command on RH 5.3 > > CURRENT_DIR=`/usr/bin/dirname $0` Beware that it will give the script dirname (if specified), not the current working directory (that you can get using pwd). > /usr/bin/dirname: invalid option -- b > > Try `/usr/bin/dirname --help' for more information. > > [oracle@mpawls ~]$ /usr/bin/dirname --version > > dirname (GNU coreutils) 5.97 You might want to upgrade, it is an ancient version. > $ echo $0 > > -bash Options are introduced by a hyphen (which your binary name starts with), if you want to tell that what follows is not option anymore, you want to use '--'. So your lines looks like that: CURRENT_DIR=`/usr/bin/dirname -- $0` (works at least with coreutils8.7, don't know about your version). > $ echo $0 > > -bash > > $ dirname > > dirname: too few arguments Yes, it understood it like "dirname -b -a -s -h", whithout any filepath. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 13:23:31 2011 Received: (at 8420) by debbugs.gnu.org; 4 Apr 2011 17:23:31 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6nUx-0006si-8X for submit@debbugs.gnu.org; Mon, 04 Apr 2011 13:23:31 -0400 Received: from mail-vx0-f172.google.com ([209.85.220.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6nUv-0006sX-Lk for 8420@debbugs.gnu.org; Mon, 04 Apr 2011 13:23:30 -0400 Received: by vxg33 with SMTP id 33so4222331vxg.3 for <8420@debbugs.gnu.org>; Mon, 04 Apr 2011 10:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=cXR6Z/HkY3k96I4MQ3GQMN+LTZBh4Yb4tDNrdKaXCr8=; b=TXJCtZgsvq6hyOJC3udK0CntY0OnKzzETQ1WWiLDSw8i/usarzKCm6ctZ/7XqCjgZK ZFA2LzQPHfdFzOQC3/Y+NOEDwKDSxNxDI5qvz34fa7Xolk1reN1lG/ZTxkDVi5dzJktU Kn/7K58HIzcoXk1RpDHjJb31ymVo2eX6v7a2o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=t7A0EDu1g0HTJFzk50RlZJvCo8WkNsHqIalgq6Nej1LW5FU4EanOF2SmAceohY0j7M FEoHYWVCojvBJ1eBLPnSgYLW835OKgBS2cifcDpxkQxlOW03WM9zr8u6AT57iTpCZ8oJ /LOJI0sK6Fj8stZntj6m9h66ACo+3I7c53bDM= MIME-Version: 1.0 Received: by 10.52.71.97 with SMTP id t1mr2753004vdu.246.1301937803980; Mon, 04 Apr 2011 10:23:23 -0700 (PDT) Received: by 10.52.157.132 with HTTP; Mon, 4 Apr 2011 10:23:23 -0700 (PDT) In-Reply-To: References: Date: Mon, 4 Apr 2011 17:23:23 +0000 Message-ID: Subject: Re: bug#8420: dirname From: Bjartur Thorlacius To: Michele Marigliano Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) You should probably not be using $0, as it doesn't contain a pathname. Nonetheless, I believe there's truly a bug. Retyped from the manual for dirname 8.5: SYNOPSIS dirname NAME dirname OPTION While simple, this doesn't describe the GNU implementation, which is more like: dirname -- NAME dirname OPTION where OPTION begins with a hyphen or two. The '97 SUS 2 spec has the most simple synopsis: dirname string GNU dirname 8.5 (and some earlier versions) and FreeBSD dirname as shipped with an OS X 10.4 fail to filter strings starting with an ASCII hyphen-minus, followed by one or more characters. FreeBSD dirname conformingly fails with exit code 1 (presumably EXIT_FAILURE) in all cases except if argv[1] is "--", in which case both GNU and FreeBSD dirname ignore it, and use argv[2] instead. As does GNU dirname 8.5, except for the strings "--version" and "--help", in which case it writes non-conforming user messages to stdout and exits successfully. Busybox 1.14 considers the string "--help" as invalid, and writes usage message to stderr and exits unsuccessfully. It's conforms to all aspects of the standard, but the definition of a valid pathname. It fails uniformly in the undefined case of more than two arguments. Henceforth, there's no portable way to invoke dirname, as GNU and FreeBSD dirnames fail if invoked as per SUS (with GNU dirname sometimes exiting successfully, to confuse matters further), and busybox fails if invoked per GNU conventions. Note bene that the former method has to be tried first as GNU dirname may fail successfully. dirname() { env dirname -- "$1" || env dirname "$1" } ------------ tl;dr dirname -bash should output a single dot followed by a newline. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 13:42:55 2011 Received: (at 8420) by debbugs.gnu.org; 4 Apr 2011 17:42:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6nni-0007IF-E2 for submit@debbugs.gnu.org; Mon, 04 Apr 2011 13:42:55 -0400 Received: from pop3out.finsiel.it ([193.43.104.48]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Q6nhe-00079Z-3O for 8420@debbugs.gnu.org; Mon, 04 Apr 2011 13:36:43 -0400 Received: from POSTA01.itmaster.local ([156.54.185.23]) by pop3out.finsiel.it with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Apr 2011 19:36:31 +0200 Received: from AGRTEST ([10.100.8.131]) by POSTA01.itmaster.local with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Apr 2011 19:36:31 +0200 From: "Michele Marigliano" Subject: I: bug#8420: dirname Date: Mon, 4 Apr 2011 19:37:07 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Acvy4ay/2BIkMAyyRe2xEsYTm7unDQAAcVVgAALcGEA= Content-Language: it X-OriginalArrivalTime: 04 Apr 2011 17:36:31.0414 (UTC) FILETIME=[D5D9A560:01CBF2EE] X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: 8420 X-Mailman-Approved-At: Mon, 04 Apr 2011 13:42:52 -0400 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) Ooopss.... -----Messaggio originale----- Da: Michele Marigliano [mailto:m.marigliano@almavivaitalia.it]=20 Inviato: luned=EC 4 aprile 2011 18.32 A: 'Eric Blake' Oggetto: R: bug#8420: dirname Thanks for your reply. I agree with you, but I was installing some software on RH 5.3 and when = I was going to run a script it exit soon because its first line (CURRENT_DIR=3D`/usr/bin/dirname $0`) was in error. So I copyed that line in an interactive bash shell ad I noticed that $ CURRENT_DIR=3D`/usr/bin/dirname $0` /usr/bin/dirname: invalid option -- b In a bash script $0 should be script name, so I didn't understand why it didn't work. In anycase I tried that line also on Centos 5.5 with same error, of = course, but when I tried it on RH 4.x it didn't report any error. This was a quite strange, I thought, so I have reported you it to know = if this behavior is all right. At end, I resolved it running the script in this way: ./script.sh and NOT . script.sh (my first run with error). Bye Michael PS: sorry for my bad English. -----Messaggio originale----- Da: Eric Blake [mailto:eblake@redhat.com]=20 Inviato: luned=EC 4 aprile 2011 18.02 A: Michele Marigliano Cc: 8420-done@debbugs.gnu.org Oggetto: Re: bug#8420: dirname tag 8420 + invalid thanks On 04/04/2011 07:43 AM, Michele Marigliano wrote: > Hi, >=20 > =20 >=20 > I execute the following bash command on RH 5.3 >=20 > CURRENT_DIR=3D`/usr/bin/dirname $0` >=20 > /usr/bin/dirname: invalid option -- b Thanks for the report. However, this is not a bug in dirname, but in = your usage pattern. You are invoking "dirname -bash", which dirname (rightly) interprets as the attempt to be the -b option, but dirname = does not have a -b option. You need to use -- to mark the end of options and = the start of arguments: dirname -- "$0" > dirname (GNU coreutils) 5.97 Wow, that's old. The latest stable version is 8.10. > $ /usr/bin/dirname --version >=20 > dirname (GNU coreutils) 5.2.1 Wow, that's even older, but same story. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 13:53:02 2011 Received: (at 8420) by debbugs.gnu.org; 4 Apr 2011 17:53:02 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6nxV-0007X3-Ul for submit@debbugs.gnu.org; Mon, 04 Apr 2011 13:53:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6nxT-0007Wh-80 for 8420@debbugs.gnu.org; Mon, 04 Apr 2011 13:53:00 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p34Hqnvw018849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Apr 2011 13:52:49 -0400 Received: from [10.3.113.73] (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p34HqmIG028149; Mon, 4 Apr 2011 13:52:48 -0400 Message-ID: <4D9A0570.5050009@redhat.com> Date: Mon, 04 Apr 2011 11:52:48 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 MIME-Version: 1.0 To: Bjartur Thorlacius Subject: Re: bug#8420: dirname References: In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigCB74A6B686C3D6429CDD62C9" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org, Michele Marigliano X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCB74A6B686C3D6429CDD62C9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/04/2011 11:23 AM, Bjartur Thorlacius wrote: > You should probably not be using $0, as it doesn't contain a pathname. >=20 > Nonetheless, I believe there's truly a bug. > Retyped from the manual for dirname 8.5: > SYNOPSIS > dirname NAME > dirname OPTION > While simple, this doesn't describe the GNU implementation, which is mo= re like: > dirname -- NAME > dirname OPTION > where OPTION begins with a hyphen or two. > The '97 SUS 2 spec has the most simple synopsis: > dirname string Coreutils complies with SUSv2, as well as SUSv3 (POSIX 2001) and SUSv4 (POSIX 2008). Remember, POSIX states that _any_ standardized app _may_, but not _must_, accept options unless explicitly documented otherwise (as is the case for 'echo'); and therefore, all compliant apps not documented otherwise _must_ accept -- for end-of-options, and all compliant clients _must_ supply -- if they expect that the first argument might begin with a -. All of this without having to explicitly document -- on every utility, because it was documented globally instead.= >=20 > GNU dirname 8.5 (and some earlier versions) and FreeBSD dirname as > shipped with an OS X 10.4 fail to filter strings starting with an > ASCII hyphen-minus, followed by one or more characters. Please give a demonstration of an actual situation to back up your assertion of a bug; until you do that, I have to assume that your test is flawed and that GNU coreutils is standard-compliant. > FreeBSD > dirname conformingly fails with exit code 1 (presumably EXIT_FAILURE) > in all cases except if argv[1] is "--", in which case both GNU and > FreeBSD dirname ignore it, and use argv[2] instead. As does GNU > dirname 8.5, except for the strings "--version" and "--help", in which > case it writes non-conforming user messages to stdout and exits > successfully. The options --version and --help are _explicitly_ standards-conforming extensions. The standard requires that any application (unless explicitly documented otherwise, as in the case of 'echo') may support extensions to the option parsing syntax, and since the standard requires that standardized options _only_ come from the set a-zA-VX-Z0-9 (-W is reserved for the implementation), then the use of --xyz is an appropriate implementation-specific extension to select the '-' short option (which in the GNU world is in reality turning on long-option parsing). _ANY_ implementation of dirname that rejects 'dirname -- a' as invalid is not standards-compliant, and the bug should be raised against that version of dirname. > tl;dr dirname -bash should output a single dot followed by a newline. Wrong conclusion. That invocation is in violation of the standards, so it has unspecified behavior. It _might_ output '.' if "-bash" were treated as a filename, but the standards _also_ state that it is valid to be treated as the "-b" option (since the standard explicitly permits dirname to have extensions of options, even if no options are standardized); which is exactly how GNU coreutils behaves. The _only_ standardized way to take the dirname of "-bash" is to use "--": dirname -- -bash --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigCB74A6B686C3D6429CDD62C9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNmgVwAAoJEKeha0olJ0NqD6AIAI7t97Rozt90vuF29ayMVZ59 /ug7+VrPb28mGb7HPytWQYiG/fLn8VL/VTF87Ay6FlTkvbGYFVxrfpMNCm37N6R6 vKE3AnDCbnwiHmHgZHNp22ddEad2hN8HsVTUwwQBr181/czotc/t7GenqxdEJ2eH OwjmJsf0WZ34vadgab7I0Z1BO5r6gQReE8XscdK2uGYz/8aFpGEcPJCXB+QZ+Y0c HKnWQKiZMfkymrewE3RGOEgVHWhXrMwSs4z6DlpNOOHfk43qmudRqcExACJ9Kz/+ URndrfH/oNCksLkEE6wjmn7pSRDv3e+0hkq3+WgsX3BTD6/8fSYJYIHbuhoMXWA= =qH9m -----END PGP SIGNATURE----- --------------enigCB74A6B686C3D6429CDD62C9-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 14:39:54 2011 Received: (at 8420) by debbugs.gnu.org; 4 Apr 2011 18:39:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6ogr-0000ur-SO for submit@debbugs.gnu.org; Mon, 04 Apr 2011 14:39:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6ogo-0000uc-Im for 8420@debbugs.gnu.org; Mon, 04 Apr 2011 14:39:52 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p34IdgBp001492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Apr 2011 14:39:42 -0400 Received: from [10.3.113.73] (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p34IdeUv003157; Mon, 4 Apr 2011 14:39:41 -0400 Message-ID: <4D9A106C.1010809@redhat.com> Date: Mon, 04 Apr 2011 12:39:40 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 MIME-Version: 1.0 To: Michele Marigliano Subject: Re: bug#8420: I: bug#8420: dirname References: In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig457197A16533840A2B1B30C5" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig457197A16533840A2B1B30C5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 04/04/2011 11:37 AM, Michele Marigliano wrote: > At end, I resolved it running the script in this way: > ./script.sh > and NOT > . script.sh (my first run with error). There is a large difference between sourcing a file in the current shell (. script.sh, where $0 remains unchanged) and executing a script (./script, where $0 changes to the script name); and as you discovered, there are a large number of scripts that are not usable when sourced instead of run as a script. At any rate, glad to hear that you got things sorted out. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig457197A16533840A2B1B30C5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNmhBsAAoJEKeha0olJ0NqsKcIAKU5anJEzhpQ6WCv45uXcmJO KIXUOpGkmV+kEknvnxLxBd9xYaJXXsBFdcWa/ORzh8e+csIMrd8sHQuoH1h3dWw4 JjeemLI32v65rgJMWE4AiUX8IBf9fL2sz7lF8MQXcTPjMkq/vJCmpCqgJYECiCBO SReRD4jlI4adNylLug+hM04iqPCGgWv+Po7oB8L+whM0Wx29yGhKHEmR4tz23aEz jhR167fp2w1kN8gAzNAz0nbqyvA4KlxvIifF59ZpugssV+1EdJMJ6ilzbTW4LyP8 SGsqV8v7a3cc3kKJaq96yqcevd/K7wD5FwoY+fsm03doehMseAEqO0mOMHtKzog= =4xuE -----END PGP SIGNATURE----- --------------enig457197A16533840A2B1B30C5-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 14:49:45 2011 Received: (at 8420) by debbugs.gnu.org; 4 Apr 2011 18:49:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6oqO-00018k-Hp for submit@debbugs.gnu.org; Mon, 04 Apr 2011 14:49:44 -0400 Received: from mail-vx0-f172.google.com ([209.85.220.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6oqM-00018Z-RL for 8420@debbugs.gnu.org; Mon, 04 Apr 2011 14:49:43 -0400 Received: by vxg33 with SMTP id 33so4300885vxg.3 for <8420@debbugs.gnu.org>; Mon, 04 Apr 2011 11:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=4eSx73JpaIyq2A7KYjLcwpJw+mqL8cCQMVegUTeHrQk=; b=DUHxyMCaNfyQMU1nr2ab8j998QUiu59aWTIXNaq+ppeDf0rT2omU0x2E7Vgi4ltFBy tNpIFrAzK1P2RPsLaCMMP00kRq3RiYkJTuwtsR/hmVC6SzfeflR1Why2Oo8dLkrytlf2 inRrPtTbZKMXuI0zk7Y9SpErtg2g96mNrZMVU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=a3p/4ljeD6w0lFJreVZ71xpPsyfvPFTH4bMiDlaxZpmn+g9TN5X2VJepcnwRlxDDu8 jXYG8GwBK6dwa1R7JbSYjdqZj7xKyWmfxcVMlJUb6qnQj0Oc2O3NMi2r9C8YWAXdMWBo TWMaA0FTlNgtHU186Q5gJyEwEnR27si1gTzmw= MIME-Version: 1.0 Received: by 10.52.70.82 with SMTP id k18mr4535586vdu.286.1301942977255; Mon, 04 Apr 2011 11:49:37 -0700 (PDT) Received: by 10.52.157.132 with HTTP; Mon, 4 Apr 2011 11:49:36 -0700 (PDT) In-Reply-To: <4D9A0570.5050009@redhat.com> References: <4D9A0570.5050009@redhat.com> Date: Mon, 4 Apr 2011 18:49:36 +0000 Message-ID: Subject: Re: bug#8420: dirname From: Bjartur Thorlacius To: Eric Blake Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) On 4/4/11, Eric Blake wrote: > On 04/04/2011 11:23 AM, Bjartur Thorlacius wrote: >> You should probably not be using $0, as it doesn't contain a pathname. >> >> Nonetheless, I believe there's truly a bug. >> Retyped from the manual for dirname 8.5: >> SYNOPSIS >> dirname NAME >> dirname OPTION >> While simple, this doesn't describe the GNU implementation, which is more >> like: >> dirname -- NAME >> dirname OPTION >> where OPTION begins with a hyphen or two. >> The '97 SUS 2 spec has the most simple synopsis: >> dirname string > > Coreutils complies with SUSv2, as well as SUSv3 (POSIX 2001) and SUSv4 > (POSIX 2008). Remember, POSIX states that _any_ standardized app _may_, > but not _must_, accept options unless explicitly documented otherwise > (as is the case for 'echo'); and therefore, all compliant apps not > documented otherwise _must_ accept -- for end-of-options, and all > compliant clients _must_ supply -- if they expect that the first > argument might begin with a -. All of this without having to explicitly > document -- on every utility, because it was documented globally instead. > >> >> GNU dirname 8.5 (and some earlier versions) and FreeBSD dirname as >> shipped with an OS X 10.4 fail to filter strings starting with an >> ASCII hyphen-minus, followed by one or more characters. > > Please give a demonstration of an actual situation to back up your > assertion of a bug; until you do that, I have to assume that your test > is flawed and that GNU coreutils is standard-compliant. > >> FreeBSD >> dirname conformingly fails with exit code 1 (presumably EXIT_FAILURE) >> in all cases except if argv[1] is "--", in which case both GNU and >> FreeBSD dirname ignore it, and use argv[2] instead. As does GNU >> dirname 8.5, except for the strings "--version" and "--help", in which >> case it writes non-conforming user messages to stdout and exits >> successfully. > > The options --version and --help are _explicitly_ standards-conforming > extensions. The standard requires that any But then again, are these extensions needed, or even desired? Implementing only the standard synopsis would be much simpler. Ideally, dirname shouldn't even check if it's arguments start with a hyphen or not (save for checking caller for standards compliance). > application (unless > explicitly documented otherwise, as in the case of 'echo') may support > extensions to the option parsing syntax, and since the standard requires > that standardized options _only_ come from the set a-zA-VX-Z0-9 (-W is > reserved for the implementation), then the use of --xyz is an > appropriate implementation-specific extension to select the '-' short > option (which in the GNU world is in reality turning on long-option > parsing). > It's quite confusing, however, to silently interpret argv[1] as an option and write output not conforming to the format specified in STDOUT. > _ANY_ implementation of dirname that rejects 'dirname -- a' as invalid > is not standards-compliant, and the bug should be raised against that > version of dirname. > >> tl;dr dirname -bash should output a single dot followed by a newline. > > Wrong conclusion. That invocation is in violation of the standards, so > it has unspecified behavior. It _might_ output '.' if "-bash" were > treated as a filename, but the standards _also_ state that it is valid > to be treated as the "-b" option (since the standard explicitly permits > dirname to have extensions of options, even if no options are > standardized); which is exactly how GNU coreutils behaves. The _only_ > standardized way to take the dirname of "-bash" is to use "--": > > dirname -- -bash > I see now that portable application programs should *always* invoke dirname with argv[1] set to "--". Anyone up for filing a bug against busybox? From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 04 15:03:32 2011 Received: (at 8420) by debbugs.gnu.org; 4 Apr 2011 19:03:32 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6p3k-0001Rg-0G for submit@debbugs.gnu.org; Mon, 04 Apr 2011 15:03:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6p3h-0001RT-2O for 8420@debbugs.gnu.org; Mon, 04 Apr 2011 15:03:30 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p34J3N0C018269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Apr 2011 15:03:23 -0400 Received: from [10.3.113.73] (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p34J3M78018065; Mon, 4 Apr 2011 15:03:22 -0400 Message-ID: <4D9A15F9.2090907@redhat.com> Date: Mon, 04 Apr 2011 13:03:21 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 MIME-Version: 1.0 To: Bjartur Thorlacius Subject: Re: bug#8420: dirname References: <4D9A0570.5050009@redhat.com> In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig7EADDD095FF607EBD94F9014" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7EADDD095FF607EBD94F9014 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/04/2011 12:49 PM, Bjartur Thorlacius wrote: >> The options --version and --help are _explicitly_ standards-conforming= >> extensions. The standard requires that any > But then again, are these extensions needed, or even desired? Needed? Debatable (as you've proven by keeping this thread alive). Desired? Yes, GNU Coding Standards require that _all_ GNU software (including GNU coreutils) support --help and --version unless standards forbid otherwise (which is why 'POSIXLY_CORRECT=3D echo --help' is one of= the few exceptions in coreutils). > Implementing only the standard synopsis would be much simpler. You aren't listening - simplicity has nothing to do with this. The standard _explicitly_ permits --help and --version as extensions, and _mandates_ that any portable client software must be aware that extensions are permitted, and therefore the burden is on the client (and not on dirname itself) to supply the -- end-of-options argument if the operand starts with -. > Ideally, dirname shouldn't even check if it's arguments start with a > hyphen or not (save for checking caller for standards compliance). > It's quite confusing, however, to silently interpret argv[1] as an > option and write output not conforming to the format specified in > STDOUT. That is _NOT_ confusing, but permitted by the standards. If you want to find the dirname of a file named --version, then use 'dirname -- --version'. It's as simple as that. The behavior of 'dirname --version' is _NOT_ mandated by the standard, and if you invoke it, you are invoking unspecified behavior, and you deserve any breakage that you get, including both breakage due to coreutils treating it as an extension option and printing something to stdout, as well as breakage for another application rejecting it as an unknown option, as well as implementations that happen to treat it as a filename and printing '.' since it isn't a known option for that implementation. But the point remains - the standard does _NOT_ require 'dirname --version' to treat --version as a file name. >> dirname -- -bash >> > I see now that portable application programs should *always* invoke > dirname with argv[1] set to "--". >=20 > Anyone up for filing a bug against busybox? Wouldn't be the first time we've had to tell busybox that they are non-compliant for not honoring --. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#= tag_17_04 OPTIONS 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. The requirement for recognizing "--" is because conforming applications need a way to shield their operands from any arbitrary options that the implementation may provide as an extension. For example, if the standard utility foo is listed as taking no options, and the application needed to give it a pathname with a leading , it could safely do it as: foo -- -myfile and avoid any problems with -m used as an extension. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig7EADDD095FF607EBD94F9014 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNmhX6AAoJEKeha0olJ0NqtakH/ApgQOo00uOg0dSaXCTqUbZ8 AI8Rn84fiuxU4ZiImQ68fHDvQt1EPMaFlqnbouhPJUVjQh0oV/ZYwxfokbYD3ilL rMliSjT//bYwcO6u0ImCM1TTyrHme9AWzlnSQElQeW2UZlf9XlwY38ebozNjTtcM CFVgapc4rziEgsp0Y6d3RPRWzBdclsP/iYO68z2FyU505vZ1pLgy8LgID316Lx9c EnWu4TMfVlxoAtkWor6S1g3BDm6aw0c29A+7cTqnmADT3kbpIYJtiIGl+pnBKGec oLDG2Z814Svou2feZ1KffL8YJ+QabCU+36TxQY15G5ZQTYkkfeYncTbWkaDrUyU= =oIKn -----END PGP SIGNATURE----- --------------enig7EADDD095FF607EBD94F9014-- From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 05 05:07:13 2011 Received: (at 8420) by debbugs.gnu.org; 5 Apr 2011 09:07:13 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q72EC-0002ze-PJ for submit@debbugs.gnu.org; Tue, 05 Apr 2011 05:07:13 -0400 Received: from pop3out.finsiel.it ([193.43.104.48] helo=out.almavivaitalia.it) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Q72E9-0002zR-7t for 8420@debbugs.gnu.org; Tue, 05 Apr 2011 05:07:11 -0400 Received: from POSTA01.itmaster.local ([156.54.185.23]) by out.almavivaitalia.it with Microsoft SMTPSVC(6.0.3790.4675); Tue, 5 Apr 2011 11:09:07 +0200 Received: from AGRTEST ([10.100.8.131]) by POSTA01.itmaster.local with Microsoft SMTPSVC(6.0.3790.4675); Tue, 5 Apr 2011 11:07:02 +0200 From: "Michele Marigliano" To: "'Eric Blake'" References: <4D9A106C.1010809@redhat.com> In-Reply-To: <4D9A106C.1010809@redhat.com> Subject: R: bug#8420: I: bug#8420: dirname Date: Tue, 5 Apr 2011 11:07:38 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Acvy96poTFpqQ4x+RvSrc1f5YQmncgAdPFYw Content-Language: it X-OriginalArrivalTime: 05 Apr 2011 09:07:02.0300 (UTC) FILETIME=[D3A6C5C0:01CBF370] X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) I realize it. Anyway, I am very sorry for my bad warning. Thank you very much for your attention. Bye Michael -----Messaggio originale----- Da: Eric Blake [mailto:eblake@redhat.com]=20 Inviato: luned=EC 4 aprile 2011 20.40 A: Michele Marigliano Cc: 8420@debbugs.gnu.org Oggetto: Re: bug#8420: I: bug#8420: dirname On 04/04/2011 11:37 AM, Michele Marigliano wrote: > At end, I resolved it running the script in this way: > ./script.sh > and NOT > . script.sh (my first run with error). There is a large difference between sourcing a file in the current shell = (. script.sh, where $0 remains unchanged) and executing a script (./script, where $0 changes to the script name); and as you discovered, there are a large number of scripts that are not usable when sourced instead of run = as a script. At any rate, glad to hear that you got things sorted out. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 05 15:08:42 2011 Received: (at 8420) by debbugs.gnu.org; 5 Apr 2011 19:08:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7BcI-0008Ug-4H for submit@debbugs.gnu.org; Tue, 05 Apr 2011 15:08:42 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7BcF-0008UU-D5 for 8420@debbugs.gnu.org; Tue, 05 Apr 2011 15:08:40 -0400 Received: by vws12 with SMTP id 12so532164vws.3 for <8420@debbugs.gnu.org>; Tue, 05 Apr 2011 12:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=dNF9yQJjH37ocOcIaBMxDKrD4euJ7yykJfngE6MnoXA=; b=H4GuBeeBdRu17+Up/P314AXvjokptdoHIHTR83aty95GtaypOfA5yR+9bzuje+Krkp zP2/HRf5mIujZdZGB5176+LZ1tqFGGY4FrW6aWxO/AOc5RXxtyPhEaQwBjbJEn9VVgBg DbFIsgq7lZduWNtHUrUFmMxsitxrNADUAZrLY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=iZtt+42E9UtnJONL+m0hvMztDso3ceZ5ECnvypWvtPDQ7wNHAvwsAwf8UyIb7QmztN jQ6veyjrAUiAX0JdWm4MEuXMg9gqanaP0KiNoNdZpmle9vQ2uv7jp5+FwTt+kaLDRNA4 O4lV0TV0yQPocjArnYC+ocTpwououdWIgemm4= MIME-Version: 1.0 Received: by 10.52.167.230 with SMTP id zr6mr104107vdb.6.1302030511980; Tue, 05 Apr 2011 12:08:31 -0700 (PDT) Received: by 10.52.157.132 with HTTP; Tue, 5 Apr 2011 12:08:31 -0700 (PDT) In-Reply-To: <4D9A15F9.2090907@redhat.com> References: <4D9A0570.5050009@redhat.com> <4D9A15F9.2090907@redhat.com> Date: Tue, 5 Apr 2011 19:08:31 +0000 Message-ID: Subject: Re: bug#8420: dirname From: Bjartur Thorlacius To: Eric Blake Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) On 4/4/11, Eric Blake wrote: > On 04/04/2011 12:49 PM, Bjartur Thorlacius wrote: >>> The options --version and --help are _explicitly_ standards-conforming >>> extensions. The standard requires that any >> But then again, are these extensions needed, or even desired? > > Needed? Debatable (as you've proven by keeping this thread alive). > Desired? Yes, GNU Coding Standards require that _all_ GNU software > (including GNU coreutils) support --help and --version unless standards > forbid otherwise (which is why 'POSIXLY_CORRECT= echo --help' is one of > the few exceptions in coreutils). > *Adding POSIXLY_CORRECT='' to environ* The holiness of the current GNU Coding Standards is a matter for debate in itself, but for another mailing list - traditionally dev@suckless.org ;P. >> Implementing only the standard synopsis would be much simpler. > > You aren't listening - simplicity has nothing to do with this. The > standard _explicitly_ permits --help and --version as extensions, and I differentiate between permitting and requiring. But I acknowledge the GNU Coding Standards as next in chain when The Open Group doesn't mandate one way or another. > _mandates_ that any portable client software must be aware that > extensions are permitted, and therefore the burden is on the client (and > not on dirname itself) to supply the -- end-of-options argument if the > operand starts with -. > True. I raised the issue as this wasn't clear from Open Groups' document on dirname, and this argv format was incompatible with my version of busybox. >> Ideally, dirname shouldn't even check if it's arguments start with a >> hyphen or not (save for checking caller for standards compliance). > >> It's quite confusing, however, to silently interpret argv[1] as an >> option and write output not conforming to the format specified in >> STDOUT. > > That is _NOT_ confusing, but permitted by the standards. > > If you want to find the dirname of a file named --version, then use > 'dirname -- --version'. It's as simple as that. > > The behavior of 'dirname --version' is _NOT_ mandated by the standard, > and if you invoke it, you are invoking unspecified behavior, and you > deserve any breakage that you get, including both breakage due to > coreutils treating it as an extension option and printing something to > stdout, as well as breakage for another application rejecting it as an > unknown option, as well as implementations that happen to treat it as a > filename and printing '.' since it isn't a known option for that > implementation. But the point remains - the standard does _NOT_ require > 'dirname --version' to treat --version as a file name. > It'd be more intuitive to print usage messages to stderr (as you most like don't want the message to be piped through the rest of the pipeline). >>> dirname -- -bash >>> >> I see now that portable application programs should *always* invoke >> dirname with argv[1] set to "--". >> >> Anyone up for filing a bug against busybox? > > Wouldn't be the first time we've had to tell busybox that they are > non-compliant for not honoring --. > Sadly, I don't find that hard to believe :[. > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tag_17_04 > > OPTIONS > 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. > Thanks. I expected to see explicit references to documents such as this one in a formal standard, but I guess I need to lie down and read it in its entirety. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 05 15:51:05 2011 Received: (at 8420) by debbugs.gnu.org; 5 Apr 2011 19:51:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7CHJ-0000yV-73 for submit@debbugs.gnu.org; Tue, 05 Apr 2011 15:51:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7CHG-0000y0-6X for 8420@debbugs.gnu.org; Tue, 05 Apr 2011 15:51:03 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p35JouM0021215 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Apr 2011 15:50:56 -0400 Received: from [10.3.113.117] (ovpn-113-117.phx2.redhat.com [10.3.113.117]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p35JotZr031064; Tue, 5 Apr 2011 15:50:55 -0400 Message-ID: <4D9B729F.1020301@redhat.com> Date: Tue, 05 Apr 2011 13:50:55 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 MIME-Version: 1.0 To: Bjartur Thorlacius Subject: Re: bug#8420: dirname References: <4D9A0570.5050009@redhat.com> <4D9A15F9.2090907@redhat.com> In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig60BF98A8B5623A36C7163EF9" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig60BF98A8B5623A36C7163EF9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/05/2011 01:08 PM, Bjartur Thorlacius wrote: >> _mandates_ that any portable client software must be aware that >> extensions are permitted, and therefore the burden is on the client (a= nd >> not on dirname itself) to supply the -- end-of-options argument if the= >> operand starts with -. >> > True. I raised the issue as this wasn't clear from Open Groups' > document on dirname, and this argv format was incompatible with my > version of busybox. Umm, I _was_ quoting Open Group's formal document on dirname, which is why I'm quite confident that the bug is in busybox for not complying with the Open Group standard when it comes to -- handling. But I will concede the fact that it can be a bit inconvenient that you have to read the section on global utility behavior, even if in the long run it makes more sense to have text just once in that global section than to duplicate global behavior descriptions into every utility page (even if too many people end up skipping over the global behavior pages). >> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.ht= ml#tag_17_04 >> >> OPTIONS >> Default Behavior: When this section is listed as "None.", it means tha= t >> the implementation need not support any options. Standard utilities th= at >> do not accept options, but that do accept operands, shall recognize "-= -" >> as a first argument to be discarded. >> > Thanks. I expected to see explicit references to documents such as > this one in a formal standard, but I guess I need to lie down and read > it in its entirety. That link is the Open Group's online version of IEEE Std 1003.1-2008 (aka POSIX 2008, which in turn is included by reference in SUSv4); if you have the pdf of the Open Group standard, I was quoting from XCU 1.4, page 2288, lines 71982-71992. Since dirname states "OPTIONS None." at page 2608 line 84080 later in the same document, the global handling applies to dirname. Contrast that with the wording for echo at line 8430= 1: The echo utility shall not recognize the "--" argument in the manner specified by Guideline 10 of XBD Section 12.2 (on page 215); "--" shall be recognized as a string operand. since echo is one of the (few) utilities that does not fall under the global rules. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig60BF98A8B5623A36C7163EF9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNm3KfAAoJEKeha0olJ0NqozMIAK45dr3jPtKAcxaI2+UmQeXj pcMJqjYVPXDx/fCugMN88TWcwUJyoNXd2unvje9aoa5J8167oOwxGmnmyYuWC092 yjZpe+aH7O43Vu4IAoBkNpxoEB4msYK4E8+PXbjkTKj+BN0x0C3SkvuV4xCOQ10y SWYXmsx+A36FDxwBMuETw5WQedlkK9zu0ZEbRvGEKYjsiNsXTalCxXRnENm1glm1 73JamTIm+FdrIk+AueCDQmye+nQMRI+kX3w35WGFI+c8jLTLNgCuEAOchVLWk0js /6tSqJ2ovTjprGbVTVXXdUi8qOnYz9OxvVrxO41ti42ye/DgyHQUTxKThcz4jnk= =ekdd -----END PGP SIGNATURE----- --------------enig60BF98A8B5623A36C7163EF9-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 07 12:48:22 2011 Received: (at 8420) by debbugs.gnu.org; 7 Apr 2011 16:48:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7sNa-0003pA-5v for submit@debbugs.gnu.org; Thu, 07 Apr 2011 12:48:22 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7sNY-0003ow-5I for 8420@debbugs.gnu.org; Thu, 07 Apr 2011 12:48:21 -0400 Received: by vws12 with SMTP id 12so2051762vws.3 for <8420@debbugs.gnu.org>; Thu, 07 Apr 2011 09:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=yjnKaul6Ht9rNryK6oO3z4fLynGXdBCsmHlssDAcPts=; b=urJEuPnaR/eybvA7otDb2IzdWuuL11pj8HCJqULXqnFW+9bh/sId201q8IMBloGn7A BXMVvvvbevJZircL7grRyFMbSo8FIfJtB/oI0seZhxxL1zLAf+DfjBVLGmvsYRChwuR8 sYq6SjWj/W+uBItV65iM6CsVFDRDGtn8MptzY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=VjY1v3dDJlJEXnYr85P+mQGhh1HWxPT66gDC2fV3Tyx78R/bWwV8DET3pIQW/0gfQQ 53/uOYueIgxeMmK+Zg1Dxu7sUjxaM8qKTPsMW7tal/pi/ma6p+Ygey5R61W+AiM4GyA6 EG1UqeBlc7IEd8XjBMy/zDGcwvgSrgeaQypyo= MIME-Version: 1.0 Received: by 10.52.72.103 with SMTP id c7mr1612962vdv.89.1302194894652; Thu, 07 Apr 2011 09:48:14 -0700 (PDT) Received: by 10.52.157.65 with HTTP; Thu, 7 Apr 2011 09:48:14 -0700 (PDT) In-Reply-To: <4D9B729F.1020301@redhat.com> References: <4D9A0570.5050009@redhat.com> <4D9A15F9.2090907@redhat.com> <4D9B729F.1020301@redhat.com> Date: Thu, 7 Apr 2011 16:48:14 +0000 Message-ID: Subject: Re: bug#8420: dirname From: Bjartur Thorlacius To: Eric Blake Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8420 Cc: 8420@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) On 4/5/11, Eric Blake wrote: > On 04/05/2011 01:08 PM, Bjartur Thorlacius wrote: >>> _mandates_ that any portable client software must be aware that >>> extensions are permitted, and therefore the burden is on the client (and >>> not on dirname itself) to supply the -- end-of-options argument if the >>> operand starts with -. >>> >> True. I raised the issue as this wasn't clear from Open Groups' >> document on dirname, and this argv format was incompatible with my >> version of busybox. > > Umm, I _was_ quoting Open Group's formal document on dirname, which is > why I'm quite confident that the bug is in busybox for not complying > with the Open Group standard when it comes to -- handling. But I will > concede the fact that it can be a bit inconvenient that you have to read > the section on global utility behavior, even if in the long run it makes > more sense to have text just once in that global section than to > duplicate global behavior descriptions into every utility page (even if > too many people end up skipping over the global behavior pages). > >>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tag_17_04 >>> >>> OPTIONS >>> 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. >>> >> Thanks. I expected to see explicit references to documents such as >> this one in a formal standard, but I guess I need to lie down and read >> it in its entirety. > > That link is the Open Group's online version of IEEE Std 1003.1-2008 > (aka POSIX 2008, which in turn is included by reference in SUSv4); if > you have the pdf of the Open Group standard, I was quoting from XCU 1.4, > page 2288, lines 71982-71992. Since dirname states "OPTIONS None." at > page 2608 line 84080 later in the same document, the global handling > applies to dirname. Contrast that with the wording for echo at line 84301: > Yeah, it clearly applies. I'm simply spoiled by other standards groups putting explicit references to dependancies into every document. HTML5 states that elements may have 'global attributes' when that applies, even in the single file version. Heck RFCs reference RFC 2119 [http://www.ietf.org/rfc/rfc2119.txt] to clarify what terminology they're using. The document I read can clearly not be considered standalone. From unknown Tue Jun 24 05:09:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 06 May 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator