From debbugs-submit-bounces@debbugs.gnu.org Tue May 11 17:29:07 2010 Received: (at submit) by debbugs.gnu.org; 11 May 2010 21:29:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBx0k-0006Az-HY for submit@debbugs.gnu.org; Tue, 11 May 2010 17:29:07 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBwpc-00065i-KH for submit@debbugs.gnu.org; Tue, 11 May 2010 17:17:37 -0400 Received: from lists.gnu.org ([199.232.76.165]:42324) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OBwpY-0007Jk-85 for submit@debbugs.gnu.org; Tue, 11 May 2010 17:17:32 -0400 Received: from [140.186.70.92] (port=38010 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBwpW-00020N-PM for bug-coreutils@gnu.org; Tue, 11 May 2010 17:17:31 -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_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBwpU-00057v-Cp for bug-coreutils@gnu.org; Tue, 11 May 2010 17:17:30 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:34022) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBwpU-00057f-8Y for bug-coreutils@gnu.org; Tue, 11 May 2010 17:17:28 -0400 Received: by vws7 with SMTP id 7so2346478vws.0 for ; Tue, 11 May 2010 14:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=JlMKO08vGGB39WC/uPS5y2esQNN7VHywb9gGJcC9hDI=; b=tZqvVdm3TL0ugYBOYnZWvnzLPAcn6UrJm0kcFzDFkT6DNapG1SwkYzjlpOTfE6+k/H Q0mz1CydclWHOutq6HO0EnTF0B3fQ3gDt70TwWi+UYhsANtn0f+biSuNrQc1CrcljdFV Zv+y/TuVPuziuA00RMIOSWBfrlPmNiZpjr0Wk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=cweIQWWb1lbldznRvpqdJtaJawW+MlV7kO9IEygO0DyLCMMXjIPOJ7WXUeiOaG+5Rz fHHcCLHM4Z16qwCi0C3OnzCBmVnYv6umPN3b+nsn3fo5fwU4ScecKkkWhP2biQo37I85 M7ULn1u6BlvqSXSEptNPtkBvddA0egGw0PIP8= Received: by 10.220.123.136 with SMTP id p8mr4928364vcr.104.1273612646227; Tue, 11 May 2010 14:17:26 -0700 (PDT) Received: from [192.168.0.9] (modemcable214.161-200-24.mc.videotron.ca [24.200.161.214]) by mx.google.com with ESMTPS id b22sm53889849vcp.20.2010.05.11.14.17.23 (version=SSLv3 cipher=RC4-MD5); Tue, 11 May 2010 14:17:24 -0700 (PDT) Message-ID: <4BE9C962.7000007@gmail.com> Date: Tue, 11 May 2010 17:17:22 -0400 From: Filipus Klutiero User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100411 Icedove/3.0.4 MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: dirname manpage and info page partially wrong/misleading Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 11 May 2010 17:29:05 -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: -4.6 (----) This report is about 2 separate issues in the dirname documentation. The info page is much better than the manual page, but says: > `dirname' prints all but the final slash-delimited component of a > string (presumably a file name, but also works on directories). The parenthese is wrong; there is no reason to presume the file given is a regular file, dirname is equally useful on directories. "presumably" should perhaps be replaced by "usually", or removed. The manual page is much more confusing, saying: > DESCRIPTION > > > Print NAME with its trailing /component removed; if NAME contains no > /'s, output `.' (meaning the current directory). dirname is more complex than just removing a trailing slash followed by a pathname component if that is the ending. For example, it also removes a slash followed by a pathname component followed by a slash, if that is how the path terminates. The manual should probably adopt the info page's formulation, which is more vague, but not wrong. From debbugs-submit-bounces@debbugs.gnu.org Fri May 14 19:05:23 2010 Received: (at 6175) by debbugs.gnu.org; 14 May 2010 23:05:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OD3wY-0001h3-NR for submit@debbugs.gnu.org; Fri, 14 May 2010 19:05:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OD3wV-0001gw-Vb for 6175@debbugs.gnu.org; Fri, 14 May 2010 19:05:21 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4EN5GM9023367 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 May 2010 19:05:16 -0400 Received: from [10.11.9.238] (vpn-9-238.rdu.redhat.com [10.11.9.238]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4EN5AJw008916; Fri, 14 May 2010 19:05:13 -0400 Message-ID: <4BEDD71D.5020806@redhat.com> Date: Fri, 14 May 2010 17:05:01 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4 MIME-Version: 1.0 To: Filipus Klutiero Subject: Re: bug#6175: dirname manpage and info page partially wrong/misleading References: <4BE9C962.7000007@gmail.com> In-Reply-To: <4BE9C962.7000007@gmail.com> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDBD3CA09D41FD0A2FA787CD6" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Spam-Score: -10.0 (----------) X-Debbugs-Envelope-To: 6175 Cc: 6175@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.1 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDBD3CA09D41FD0A2FA787CD6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 05/11/2010 03:17 PM, Filipus Klutiero wrote: > This report is about 2 separate issues in the dirname documentation. Th= e > info page is much better than the manual page, but says: >> `dirname' prints all but the final slash-delimited component of a >> string (presumably a file name, but also works on directories). > The parenthese is wrong; there is no reason to presume the file given i= s > a regular file, dirname is equally useful on directories. "presumably" > should perhaps be replaced by "usually", or removed. Thanks for the report. Would you like to try your hand at writing this patch? If not, I might be able to get around to this sometime next week (I've got several little TODO patches piled up now...) >=20 > The manual page is much more confusing, saying: The man page is auto-generated from 'dirname --help' output; the patch here would be to src/dirname.c, along with the matching patch to doc/coreutils.texi. >=20 > dirname is more complex than just removing a trailing slash followed by= > a pathname component if that is the ending. For example, it also remove= s > a slash followed by a pathname component followed by a slash, if that i= s > how the path terminates. The manual should probably adopt the info > page's formulation, which is more vague, but not wrong. POSIX has a definite definition of a file name component - any sequence that does not include a slash. It also has definite rules for dirname to remove the trailing component: everything that occurs after the last slash once trailing slashes are removed (with a special case for all slashes). The point is that dirname removes trailing slashes, then one component, then again removes trailing slashes. Perhaps a more correct formulation, while still being concise, is along these lines: Strip the last component and resulting trailing slashes; if the file name contains only one component, print '.'. But I welcome your ideas for a coherent sentence. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigDBD3CA09D41FD0A2FA787CD6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJL7dceAAoJEKeha0olJ0Nq1JgIAIBPAaSXV9ixbrtq4+kB1goL N1mOt6bopVDXhlRaNfwBzj4dNAYpi2fSfUWQi/siVzBbejV3APxl7ec9lA0u73/N DJnKUzo0Nt1kE2AP1TXPT3XvAY5uKUys+D+KEzMc0oS55rFmRLXwJ9viJtXmbrlo Dwu4ljgXEeFcAEXdlWXBoyiMgBY5K8w4KM5DbY3dXRXWQ8eoI45tjMMUwP4MpD1K TjSUsOwTPJjoyp98dmkXXvIHU3GlQZ9YtUSVIguUcVrLb1/VkA0adMu4qMQATNNP VSWdT6jeY4wo7c2lScs5AaZ2GVPfXFVUtcrVsoLNNVU5KJZka4niypOOy0TM8oo= =ne47 -----END PGP SIGNATURE----- --------------enigDBD3CA09D41FD0A2FA787CD6-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 17 11:17:23 2010 Received: (at 6175) by debbugs.gnu.org; 17 May 2010 15:17:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OE24I-0004jk-S5 for submit@debbugs.gnu.org; Mon, 17 May 2010 11:17:23 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OE24G-0004jf-3W for 6175@debbugs.gnu.org; Mon, 17 May 2010 11:17:20 -0400 Received: by vws13 with SMTP id 13so3604361vws.3 for <6175@debbugs.gnu.org>; Mon, 17 May 2010 08:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=R9XdhRHtdNrIzYq7nVldCWjOF71gJKbUAIHXpxg9XOo=; b=Hb2TIuC/nsz7sfMTT1MfXl7mVZaVOuy8kbMGjZV/zg+u1aniLbS88sK9MZkijhBMM0 npDaETqjQHrZhyguYETQtjuAUo5U/7PmbzBQ51I9Gh/Z+7fVQfZkE3uwODa3PF0vFXv4 wgu3osIIoPdpsGR35L8mT/8iU/1EyJwiojQEA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=xc7mKQ3Pqsv3hdpyre9VJV3u3sNB8f0wD85We5ZF5CGzPG5+yVvu+r5dURFXaJWwuq QNx3UwvC+znp9WQ/RWdwnQQZDS/G/ioDxYv08mKp0Sv4XGMlYYMg7Bsw2pvSV/KvRKFN xitm1zDqQsz+ksVdfpUHZ7Bx6AM9uUhOCyjl8= Received: by 10.224.58.88 with SMTP id f24mr2932910qah.26.1274109434393; Mon, 17 May 2010 08:17:14 -0700 (PDT) Received: from [192.168.0.9] (modemcable214.161-200-24.mc.videotron.ca [24.200.161.214]) by mx.google.com with ESMTPS id 22sm3328430qyk.2.2010.05.17.08.17.09 (version=SSLv3 cipher=RC4-MD5); Mon, 17 May 2010 08:17:09 -0700 (PDT) Message-ID: <4BF15DF4.1070803@gmail.com> Date: Mon, 17 May 2010 11:17:08 -0400 From: Filipus Klutiero User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100411 Icedove/3.0.4 MIME-Version: 1.0 To: Eric Blake Subject: Re: bug#6175: dirname manpage and info page partially wrong/misleading References: <4BE9C962.7000007@gmail.com> <4BEDD71D.5020806@redhat.com> In-Reply-To: <4BEDD71D.5020806@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 6175 Cc: 6175@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: -2.8 (--) On 2010-05-14 19:05, Eric Blake wrote: > On 05/11/2010 03:17 PM, Filipus Klutiero wrote: > >> This report is about 2 separate issues in the dirname documentation. The >> info page is much better than the manual page, but says: >> >>> `dirname' prints all but the final slash-delimited component of a >>> string (presumably a file name, but also works on directories). >>> >> The parenthese is wrong; there is no reason to presume the file given is >> a regular file, dirname is equally useful on directories. "presumably" >> should perhaps be replaced by "usually", or removed. >> > Thanks for the report. > > Would you like to try your hand at writing this patch? If not, I might > be able to get around to this sometime next week (I've got several > little TODO patches piled up now...) > > >> The manual page is much more confusing, saying: >> > The man page is auto-generated from 'dirname --help' output; the patch > here would be to src/dirname.c, along with the matching patch to > doc/coreutils.texi. > Thanks for the direction. I would feel comfortable to write a patch, but I'm reluctant to spend time on making a first coreutils contribution (I have no intention to make more). I don't know coreutils nor POSIX that much. I looked at the manual page because I had no idea what dirname did (in fact, I was trying to understand PHP dirname's behavior). I still probably can't describe its behavior perfectly, so I don't mind waiting for someone more competent will look at it... I would probably just go with the info page's vague description anyway. > >> dirname is more complex than just removing a trailing slash followed by >> a pathname component if that is the ending. For example, it also removes >> a slash followed by a pathname component followed by a slash, if that is >> how the path terminates. The manual should probably adopt the info >> page's formulation, which is more vague, but not wrong. >> > POSIX has a definite definition of a file name component - any sequence > that does not include a slash. It also has definite rules for dirname > to remove the trailing component: everything that occurs after the last > slash once trailing slashes are removed (with a special case for all > slashes). The point is that dirname removes trailing slashes, then one > component, then again removes trailing slashes. Perhaps a more correct > formulation, while still being concise, is along these lines: > > Strip the last component and resulting trailing slashes; if the file > name contains only one component, print '.'. > > But I welcome your ideas for a coherent sentence. > That sounds more correct and comprehensible. I don't know how many corner cases there are and if they can all be covered in the help, but there's also the no component case: $ dirname '' prints ".". $ dirname / prints "/". From debbugs-submit-bounces@debbugs.gnu.org Mon May 17 11:36:28 2010 Received: (at 6175) by debbugs.gnu.org; 17 May 2010 15:36: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 1OE2Ml-0004sj-Qg for submit@debbugs.gnu.org; Mon, 17 May 2010 11:36:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OE2Mi-0004sb-5w for 6175@debbugs.gnu.org; Mon, 17 May 2010 11:36:25 -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.13.8/8.13.8) with ESMTP id o4HFaIsA029881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 May 2010 11:36:19 -0400 Received: from [10.11.10.77] (vpn-10-77.rdu.redhat.com [10.11.10.77]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4HFaHK4023723; Mon, 17 May 2010 11:36:18 -0400 Message-ID: <4BF16269.7000200@redhat.com> Date: Mon, 17 May 2010 09:36:09 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4 MIME-Version: 1.0 To: Filipus Klutiero Subject: Re: bug#6175: dirname manpage and info page partially wrong/misleading References: <4BE9C962.7000007@gmail.com> <4BEDD71D.5020806@redhat.com> <4BF15DF4.1070803@gmail.com> In-Reply-To: <4BF15DF4.1070803@gmail.com> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig70F1E1D407D2EBD177329293" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Spam-Score: -9.3 (---------) X-Debbugs-Envelope-To: 6175 Cc: 6175@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.1 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig70F1E1D407D2EBD177329293 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 05/17/2010 09:17 AM, Filipus Klutiero wrote: >> Strip the last component and resulting trailing slashes; if the file >> name contains only one component, print '.'. >> >> But I welcome your ideas for a coherent sentence. >> =20 > That sounds more correct and comprehensible. I don't know how many > corner cases there are and if they can all be covered in the help, but > there's also the no component case: > $ dirname '' > prints ".". Yes, that's a corner case not covered by the above sentence, which we could fix with "if the file name contains less than two components, print '.'". > $ dirname / > prints "/". I tend to classify the all-slash corner case as being one component, not zero components. You can view it as the root directory being contained in (well, reachable from) the root directory, as evidenced by '/../' resolving to '/'. But that doesn't work as well with the '<2 components' wording above, so I'm feeling more comfortable with leaving the corner-cases undocumented in the terse --help output, by using your view that '/' has no components rather than 1, and anyone worried about the two corner cases of '' and '/' can read the info page. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig70F1E1D407D2EBD177329293 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJL8WJpAAoJEKeha0olJ0Nqc2sIALCj/h/27zOFqI5rLlz2y9yp M5Of8lLjvTrvGaung1i08Qr014Yd687ezNqcol8h0LRgi3MAOR2RATxBnh2z0WAX g0/t6xgvOmmexRwFvaRnODnEloM54mfgZ9oDKM8yYSsZNdun0i5L5Dnd+Xs6tpIW HOcjAEImyTOzzceO5RWbTU7vy+CyB5ypHXhwtP4R25PEVMZeDqKLeLbBFO+jvPVv YGWeiWkRLug4m2l01Yv16B4pOGqWzd5mEVFvYt2fw7XTSe4Ht3pAtfKurVGDlUbS +VdDIf1KXaFhmXAdXuSzevgDykyXY9dnuJN1h9EOg8Zre9uRs1XP4YQnYzaGlh4= =CFmR -----END PGP SIGNATURE----- --------------enig70F1E1D407D2EBD177329293-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 17 15:48:33 2010 Received: (at 6175) by debbugs.gnu.org; 17 May 2010 19:48:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OE6Ii-0006kj-Mg for submit@debbugs.gnu.org; Mon, 17 May 2010 15:48:33 -0400 Received: from mail-qy0-f175.google.com ([209.85.221.175]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OE6Ig-0006kc-68 for 6175@debbugs.gnu.org; Mon, 17 May 2010 15:48:30 -0400 Received: by qyk5 with SMTP id 5so8254491qyk.3 for <6175@debbugs.gnu.org>; Mon, 17 May 2010 12:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=jHS/3+n9v7Msx8m4fcQtG7XHZM1MTnu/BD+jQLF606o=; b=g8e90Dx6E1A3MpGnRx0ZqRuEvtUw64Ozx4peeccFNfqpvUl+AMG0FrX0+9sFrCAuYX QvWOu+yp15p1N8IkeF/5rS+rM2pwOcdq0++EljVhmU2UiXaiTJR+lwgB6ZkkpIuQZA+D FJ3krfw1ReJOsuozgWBiKx0v9gGh7r/nNBCaU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=j2gprJL1/y8a6IS3C3rFKlv8XfevadAW+1PWDo+1BNLN38i1QO96VH6z+ApOXylJdF x4/ks7nqY2e7wOeavYKrVCios1WvrKfse31HP6CdwCUSRfOtj1q1N3OZJbnFZuGtxJxY 9Pulg6Bjp4ZUIX6d15DjSW4eJ6emYZPzxv5BQ= Received: by 10.224.87.194 with SMTP id x2mr3109888qal.188.1274125704876; Mon, 17 May 2010 12:48:24 -0700 (PDT) Received: from [192.168.0.9] (modemcable214.161-200-24.mc.videotron.ca [24.200.161.214]) by mx.google.com with ESMTPS id 21sm3438279qyk.13.2010.05.17.12.48.23 (version=SSLv3 cipher=RC4-MD5); Mon, 17 May 2010 12:48:24 -0700 (PDT) Message-ID: <4BF19D86.7010005@gmail.com> Date: Mon, 17 May 2010 15:48:22 -0400 From: Filipus Klutiero User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100411 Icedove/3.0.4 MIME-Version: 1.0 To: Eric Blake Subject: Re: bug#6175: dirname manpage and info page partially wrong/misleading References: <4BE9C962.7000007@gmail.com> <4BEDD71D.5020806@redhat.com> <4BF15DF4.1070803@gmail.com> <4BF16269.7000200@redhat.com> In-Reply-To: <4BF16269.7000200@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 6175 Cc: 6175@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: -2.7 (--) On 2010-05-17 11:36, Eric Blake wrote: > On 05/17/2010 09:17 AM, Filipus Klutiero wrote: > >>> Strip the last component and resulting trailing slashes; if the file >>> name contains only one component, print '.'. >>> >>> But I welcome your ideas for a coherent sentence. >>> >>> >> That sounds more correct and comprehensible. I don't know how many >> corner cases there are and if they can all be covered in the help, but >> there's also the no component case: >> $ dirname '' >> prints ".". >> > Yes, that's a corner case not covered by the above sentence, which we > could fix with "if the file name contains less than two components, > print '.'". > > >> $ dirname / >> prints "/". >> > I tend to classify the all-slash corner case as being one component, not > zero components. You can view it as the root directory being contained > in (well, reachable from) the root directory, as evidenced by '/../' > resolving to '/'. Hum, interesting, never thought about "/../". I believe all-slash can't be considered as being one component. According to POSIX, a component needs at least one character. > But that doesn't work as well with the '<2 > components' wording above, so I'm feeling more comfortable with leaving > the corner-cases undocumented in the terse --help output, by using your > view that '/' has no components rather than 1, and anyone worried about > the two corner cases of '' and '/' can read the info page. > Using If-s is a good idea. I would agree with leaving the no components case to the documentation proper. Here is a simple even though incomplete description based on yours. It is exact *AFAIK*. I'm using "pathname" instead of "file name", since file name doesn't fit the Base Specifications definition - but I don't know if coreutils/GNU is willingly using its own terminology. If the pathname contains several components, strip the last component and resulting trailing slashes; if the pathname contains only one component, print '/' if the pathname starts with a slash, '.' otherwise. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 07 20:09:18 2010 Received: (at 6175) by debbugs.gnu.org; 8 Jun 2010 00:09:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLmNa-0006BZ-0O for submit@debbugs.gnu.org; Mon, 07 Jun 2010 20:09:18 -0400 Received: from qmta14.emeryville.ca.mail.comcast.net ([76.96.27.212]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLmNX-0006BS-FG for 6175@debbugs.gnu.org; Mon, 07 Jun 2010 20:09:17 -0400 Received: from omta24.emeryville.ca.mail.comcast.net ([76.96.30.92]) by qmta14.emeryville.ca.mail.comcast.net with comcast id T0e91e0051zF43QAEC9B8W; Tue, 08 Jun 2010 00:09:11 +0000 Received: from localhost.localdomain ([12.230.186.195]) by omta24.emeryville.ca.mail.comcast.net with comcast id TC8w1e0014DNoF88kC92aL; Tue, 08 Jun 2010 00:09:08 +0000 From: Eric Blake To: chealer@gmail.com, 6175@debbugs.gnu.org Subject: [PATCH] dirname: tweak summary wording Date: Mon, 7 Jun 2010 18:08:30 -0600 Message-Id: <1275955710-12944-1-git-send-email-eblake@redhat.com> X-Mailer: git-send-email 1.7.0.1 In-Reply-To: <4BF16269.7000200@redhat.com> References: <4BF16269.7000200@redhat.com> X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 6175 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: 0.7 (/) * doc/coreutils.texi (dirname invocation): Reword to be more precise. * src/dirname.c (usage): Likewise. * THANKS: Update. Reported by Filipus Klutiero, bug 6175. --- On 05/17/2010 09:36 AM, Eric Blake wrote: > > On 05/17/2010 09:17 AM, Filipus Klutiero wrote: [revisiting an older thread] >>> Strip the last component and resulting trailing slashes; if the file >>> name contains only one component, print '.'. >>> >>> But I welcome your ideas for a coherent sentence. >>> >> That sounds more correct and comprehensible. I don't know how many >> corner cases there are and if they can all be covered in the help, but >> there's also the no component case: >> $ dirname '' >> prints ".". > > Yes, that's a corner case not covered by the above sentence, which we > could fix with "if the file name contains less than two components, > print '.'". I finally had the time to look more into this bug report. How does the following patch sound? The goal for the --help output is to keep things terse at two lines, while the info page can afford the extra text for precision. THANKS | 1 + doc/coreutils.texi | 10 +++++++--- src/dirname.c | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/THANKS b/THANKS index 0e1459b..dce3c94 100644 --- a/THANKS +++ b/THANKS diff --git a/doc/coreutils.texi b/doc/coreutils.texi index d1c3085..26b4eba 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -11991,14 +11991,17 @@ dirname invocation @cindex non-directory suffix, stripping @command{dirname} prints all but the final slash-delimited component of -a string (presumably a file name, but also works on directories). Synopsis: +@var{name}. Slashes on either side of the final component are also +removed. If the string contains no slash, @command{dirname} prints +@samp{.} (meaning the current directory). Synopsis: @example dirname @var{name} @end example -If @var{name} is a single component, @command{dirname} prints @samp{.} -(meaning the current directory). +@var{name} need not be a file name, but if it is, this operation +effectively lists the directory that contains the final component, +including the case when the final component is itself a directory. @basenameAndDirname @@ -12017,6 +12020,7 @@ dirname invocation @smallexample # Output "/usr/bin". dirname /usr/bin/sort +dirname /usr/bin//.// # Output ".". dirname stdio.h diff --git a/src/dirname.c b/src/dirname.c index 4f18fe9..f6997c3 100644 --- a/src/dirname.c +++ b/src/dirname.c @@ -48,8 +48,8 @@ Usage: %s NAME\n\ "), program_name, program_name); fputs (_("\ -Print NAME with its trailing /component removed; if NAME contains no /'s,\n\ -output `.' (meaning the current directory).\n\ +Print NAME with its last non-slash component and trailing slashes removed;\n\ +if NAME contains no /'s, output `.' (meaning the current directory).\n\ \n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -57,7 +57,7 @@ output `.' (meaning the current directory).\n\ printf (_("\ \n\ Examples:\n\ - %s /usr/bin/sort Output \"/usr/bin\".\n\ + %s /usr/bin/ Output \"/usr\".\n\ %s stdio.h Output \".\".\n\ "), program_name, program_name); -- 1.7.0.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 08 01:55:41 2010 Received: (at 6175) by debbugs.gnu.org; 8 Jun 2010 05:55:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLrmm-0000bm-R3 for submit@debbugs.gnu.org; Tue, 08 Jun 2010 01:55:41 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLrmk-0000bh-R0 for 6175@debbugs.gnu.org; Tue, 08 Jun 2010 01:55:40 -0400 Received: from mx.meyering.net (mx.meyering.net [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id CB7B8940048 for <6175@debbugs.gnu.org>; Tue, 8 Jun 2010 07:55:30 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 3CA08B2C; Tue, 8 Jun 2010 07:55:29 +0200 (CEST) From: Jim Meyering To: Eric Blake Subject: Re: bug#6175: [PATCH] dirname: tweak summary wording In-Reply-To: <1275955710-12944-1-git-send-email-eblake@redhat.com> (Eric Blake's message of "Mon, 7 Jun 2010 18:08:30 -0600") References: <4BF16269.7000200@redhat.com> <1275955710-12944-1-git-send-email-eblake@redhat.com> Date: Tue, 08 Jun 2010 07:55:29 +0200 Message-ID: <87d3w2ukz2.fsf@meyering.net> Lines: 22 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 6175 Cc: 6175@debbugs.gnu.org, chealer@gmail.com 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.3 (---) Eric Blake wrote: > * doc/coreutils.texi (dirname invocation): Reword to be more > precise. > * src/dirname.c (usage): Likewise. > * THANKS: Update. > Reported by Filipus Klutiero, bug 6175. ... > diff --git a/src/dirname.c b/src/dirname.c > index 4f18fe9..f6997c3 100644 > --- a/src/dirname.c > +++ b/src/dirname.c > @@ -48,8 +48,8 @@ Usage: %s NAME\n\ > "), > program_name, program_name); > fputs (_("\ > -Print NAME with its trailing /component removed; if NAME contains no /'s,\n\ > -output `.' (meaning the current directory).\n\ > +Print NAME with its last non-slash component and trailing slashes removed;\n\ > +if NAME contains no /'s, output `.' (meaning the current directory).\n\ Looks fine. I know it was there in the original too, but s/output/print/ sounds a little better. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 08 06:32:42 2010 Received: (at 6175) by debbugs.gnu.org; 8 Jun 2010 10:32: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 1OLw6r-0002ST-SN for submit@debbugs.gnu.org; Tue, 08 Jun 2010 06:32:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLw6p-0002SO-0d for 6175@debbugs.gnu.org; Tue, 08 Jun 2010 06:32:40 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o58AWXhH016240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Jun 2010 06:32:33 -0400 Received: from [10.11.11.57] (vpn-11-57.rdu.redhat.com [10.11.11.57]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o58AWWjj026528; Tue, 8 Jun 2010 06:32:32 -0400 Message-ID: <4C0E1C26.9050907@redhat.com> Date: Tue, 08 Jun 2010 04:32:06 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.4 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#6175: [PATCH] dirname: tweak summary wording References: <4BF16269.7000200@redhat.com> <1275955710-12944-1-git-send-email-eblake@redhat.com> <87d3w2ukz2.fsf@meyering.net> In-Reply-To: <87d3w2ukz2.fsf@meyering.net> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDA0A82BA1890AE3E0620D808" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-Spam-Score: -10.1 (----------) X-Debbugs-Envelope-To: 6175 Cc: 6175@debbugs.gnu.org, chealer@gmail.com 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.1 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDA0A82BA1890AE3E0620D808 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 06/07/2010 11:55 PM, Jim Meyering wrote: >> -Print NAME with its trailing /component removed; if NAME contains no = /'s,\n\ >> -output `.' (meaning the current directory).\n\ >> +Print NAME with its last non-slash component and trailing slashes rem= oved;\n\ >> +if NAME contains no /'s, output `.' (meaning the current directory).\= n\ >=20 > Looks fine. I know it was there in the original too, > but s/output/print/ sounds a little better. Pushed with that tweak. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigDA0A82BA1890AE3E0620D808 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMDhwmAAoJEKeha0olJ0NqcMQH/AvLtijxO67Lal4JzoiOwLr7 yelTRwfKfv7JmV6hycISURYipEp0NUKiuNO6XW7Ohau5WjukUJFT4PWcClockphk bvJQgIWGSRZD6mNMe0toRspZ6vN8OJLbnWXbm88NiYOz1WSLFcgH+MT9/HqfRIBj HNmfeWHbbTM5on8myJKX5LRQR4suZTIkfhNUaFjSs6xkh1/oB2WtNehMay2wL+7h rn+xCI4FcJapJy1/Zk4Jn9SPfRtPeYrZ1plSfTorjz5grMZceNM90zU9vpTNWZtp 5VWRBAT1SRqO8zViLB3sgIWTDUN+m9rLBK+wHvnr3G0Axk7McEYM80niOucDq40= =KDa6 -----END PGP SIGNATURE----- --------------enigDA0A82BA1890AE3E0620D808-- From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 17 04:44:40 2011 Received: (at control) by debbugs.gnu.org; 17 Apr 2011 08:44:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QBNay-0007gc-1F for submit@debbugs.gnu.org; Sun, 17 Apr 2011 04:44:40 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QBNax-0007gS-1p for control@debbugs.gnu.org; Sun, 17 Apr 2011 04:44:39 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 9BBCB6012A; Sun, 17 Apr 2011 10:44:33 +0200 (CEST) From: Jim Meyering To: control@debbugs.gnu.org Subject: Re: dirname manpage and info page partially wrong/misleading Date: Sun, 17 Apr 2011 10:44:33 +0200 Message-ID: <87liz9e07i.fsf@rho.meyering.net> Lines: 4 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: control 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: -5.9 (-----) close 6175 thanks A patch fixing this was applied a year ago. From unknown Sun Jun 22 11:39:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 15 May 2011 11:24:05 +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