From unknown Sun Sep 07 23:15:55 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#9450 <9450@debbugs.gnu.org> To: bug#9450 <9450@debbugs.gnu.org> Subject: Status: Bug report on 'dirname' : when jokers match several files Reply-To: bug#9450 <9450@debbugs.gnu.org> Date: Mon, 08 Sep 2025 06:15:55 +0000 retitle 9450 Bug report on 'dirname' : when jokers match several files reassign 9450 coreutils submitter 9450 "Laurent TARRISSE" severity 9450 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 06 10:02:58 2011 Received: (at submit) by debbugs.gnu.org; 6 Sep 2011 14:02:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0wEr-0007rm-9t for submit@debbugs.gnu.org; Tue, 06 Sep 2011 10:02:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0w9c-00073H-VF for submit@debbugs.gnu.org; Tue, 06 Sep 2011 09:57:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0w5q-0000nE-N0 for submit@debbugs.gnu.org; Tue, 06 Sep 2011 09:53:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,HTML_MESSAGE, RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:36970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0w5q-0000nA-LO for submit@debbugs.gnu.org; Tue, 06 Sep 2011 09:53:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0w5m-00017V-Nd for bug-coreutils@gnu.org; Tue, 06 Sep 2011 09:53:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0w5g-0000mC-Rv for bug-coreutils@gnu.org; Tue, 06 Sep 2011 09:53:34 -0400 Received: from mail.midilibre.com ([193.104.54.20]:36772 helo=smtp.midilibre.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0w5g-0000m7-HB for bug-coreutils@gnu.org; Tue, 06 Sep 2011 09:53:28 -0400 Received: from unknown (HELO smtp-av2.site) ([192.168.60.12]) by ironport1priv.midilibre.com with ESMTP; 06 Sep 2011 15:53:26 +0200 Received: from mdl-msg-smtp.midilibre.com (unknown [192.34.11.5]) by smtp-av2.site (Postfix) with ESMTP id 151591F9F9 for ; Tue, 6 Sep 2011 15:53:26 +0200 (CEST) Received: from mdl-msg-mdg2.midilibre.com ([192.34.11.6]) by mdl-msg-smtp.midilibre.com (Lotus Domino Release 8.0.1) with ESMTP id 2011090615532341-443045 ; Tue, 6 Sep 2011 15:53:23 +0200 Received: from GES1356 ([192.34.11.72]) by mdl-msg-mdg2.midilibre.com (Lotus Domino Release 8.0.1) with SMTP id 2011090615532159-13996 ; Tue, 6 Sep 2011 15:53:21 +0200 Message-ID: <00b801cc6c9c$56a28050$480b22c0@GES1356> From: "Laurent TARRISSE" To: Subject: Bug report on 'dirname' : when jokers match several files Date: Tue, 6 Sep 2011 15:53:10 +0200 MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-MIMETrack: Itemize by SMTP Server on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/06/2011 03:53:21 PM, Serialize by Router on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/06/2011 03:53:23 PM, Serialize complete at 09/06/2011 03:53:23 PM, Itemize by SMTP Server on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 06/09/2011 15:53:23, Serialize by Router on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 06/09/2011 15:53:25, Serialize complete at 06/09/2011 15:53:25 X-TNEFEvaluated: 1 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00B5_01CC6CAD.13B25CA0" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 06 Sep 2011 10:02:55 -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_00B5_01CC6CAD.13B25CA0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Hi Here this a strange behaviour using 'dirname' with joker filename: >ll /tmp/*.out ls: /tmp/*.out: No such file or directory >dirname /tmp/*.out /tmp That's OK. But if several files match the argument given : >ll /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/*.HL -rw-r--r-- 1 qualiac qualiac 20715696 Sep 6 02:15 = /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/M399111H.HL -rw-r--r-- 1 qualiac qualiac 1181326 Sep 6 02:16 = /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/T399111H.HL -rw-r--r-- 1 qualiac qualiac 225012 Sep 6 02:15 = /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/T399211H.HL >dirname /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/*.HL dirname: too many arguments Try `dirname --help' for more information. That's bad. If I try: >dirname '/home/qualiac/mdl/scriptsJDM/QuaToCov/emission/*.HL' /home/qualiac/mdl/scriptsJDM/QuaToCov/emission That's OK. Could 'dirname' process only its first parameter ? Thanks. ---------------------------------------------- UNIX VERSION: ---------------------------------------------- >uname -a Linux jdm-qualiac-srv-trv.midilibre.com 2.6.9-100.ELsmp #1 SMP Tue Feb 1 = 12:04:42 EST 2011 x86_64 x86_64 x86_64 GNU/Linux >uname -r 2.6.9-100.ELsmp >cat /etc/issue Red Hat Enterprise Linux ES release 4 (Nahant Update 9) Kernel \r on an \m ------=_NextPart_000_00B5_01CC6CAD.13B25CA0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="iso-8859-1"
Hi
 
Here this a strange behaviour using = 'dirname' with=20 joker filename:
 
>ll  /tmp/*.out
ls: = /tmp/*.out: No such=20 file or directory
>dirname /tmp/*.out
/tmp
 
That's OK. But if several files match=20 the argument given :
 
>ll =20 /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/*.HL
-rw-r--r--  = 1=20 qualiac qualiac 20715696 Sep  6 02:15=20 /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/M399111H.HL
-rw-r--r--&= nbsp; 1=20 qualiac qualiac  1181326 Sep  6 02:16=20 /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/T399111H.HL
-rw-r--r--&= nbsp; 1=20 qualiac qualiac   225012 Sep  6 02:15=20 /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/T399211H.HL
>dirname=  =20 /home/qualiac/mdl/scriptsJDM/QuaToCov/emission/*.HL
dirname: too many = arguments
Try `dirname --help' for more information.
 
That's bad. If I try:
 
>dirname=20 '/home/qualiac/mdl/scriptsJDM/QuaToCov/emission/*.HL'
/home/qualiac/md= l/scriptsJDM/QuaToCov/emission
That's OK.
 
Could 'dirname' process only its first = parameter=20 ?
 
Thanks.
 
 
----------------------------------------------
UNIX = VERSION:
----------------------------------------------
>u= name=20 -a
Linux jdm-qualiac-srv-trv.midilibre.com 2.6.9-100.ELsmp #1 SMP Tue = Feb 1=20 12:04:42 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
>uname=20 -r
2.6.9-100.ELsmp
>cat /etc/issue
Red Hat Enterprise Linux = ES=20 release 4 (Nahant Update 9)
Kernel \r on an=20 \m
------=_NextPart_000_00B5_01CC6CAD.13B25CA0-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 06 10:28:10 2011 Received: (at 9450) by debbugs.gnu.org; 6 Sep 2011 14:28:10 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0wdG-0000ge-8o for submit@debbugs.gnu.org; Tue, 06 Sep 2011 10:28:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0wdC-0000gV-Km for 9450@debbugs.gnu.org; Tue, 06 Sep 2011 10:28:08 -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 p86EOICc030000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 6 Sep 2011 10:24:18 -0400 Received: from [10.3.113.103] (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p86EOHiu012638; Tue, 6 Sep 2011 10:24:17 -0400 Message-ID: <4E662D11.8020100@redhat.com> Date: Tue, 06 Sep 2011 08:24:17 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110817 Fedora/3.1.12-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.12 MIME-Version: 1.0 To: Laurent TARRISSE Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files References: <00b801cc6c9c$56a28050$480b22c0@GES1356> In-Reply-To: <00b801cc6c9c$56a28050$480b22c0@GES1356> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.3 (----------) X-Debbugs-Envelope-To: 9450 Cc: 9450@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.3 (----------) 9450 tag wishlist thanks On 09/06/2011 07:53 AM, Laurent TARRISSE wrote: > Hi > > Here this a strange behaviour using 'dirname' with joker filename: The term is 'wildcard', not 'joker' > dirname: too many arguments > Try `dirname --help' for more information. Thanks for the report. To some degree, this is expected behavior: POSIX requires that portable shell scripts pass exactly one argument to dirname, so passing 0 or more than 1 arguments is necessarily in the realm of non-portable code, and we would rather error out if we don't have any better defined semantics for an extension. > Could 'dirname' process only its first parameter ? No. But there _has_ been requests in the past to add an extension to GNU coreutils to match BSD dirname/basename semantics of optionally taking more than one parameter: https://lists.gnu.org/archive/html/bug-coreutils/2010-05/msg00015.html But so far, no one has submitted patches. Therefore, I'll keep this bug report open, but tag it as a wishlist. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 06 11:33:08 2011 Received: (at 9450) by debbugs.gnu.org; 6 Sep 2011 15:33:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0xe7-0005ZF-HO for submit@debbugs.gnu.org; Tue, 06 Sep 2011 11:33:08 -0400 Received: from mail.midilibre.com ([193.104.54.20] helo=smtp.midilibre.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0wqw-0001id-1y for 9450@debbugs.gnu.org; Tue, 06 Sep 2011 10:42:19 -0400 Received: from unknown (HELO smtp-av1.site) ([192.168.60.11]) by ironport1priv.midilibre.com with ESMTP; 06 Sep 2011 16:38:29 +0200 Received: from mdl-msg-smtp.midilibre.com (unknown [192.34.11.5]) by smtp-av1.site (Postfix) with ESMTP id 213D81B3FE; Tue, 6 Sep 2011 16:38:29 +0200 (CEST) Received: from mdl-msg-mdg2.midilibre.com ([192.34.11.6]) by mdl-msg-smtp.midilibre.com (Lotus Domino Release 8.0.1) with ESMTP id 2011090616382702-444546 ; Tue, 6 Sep 2011 16:38:27 +0200 Received: from GES1356 ([192.34.11.72]) by mdl-msg-mdg2.midilibre.com (Lotus Domino Release 8.0.1) with SMTP id 2011090616382670-14147 ; Tue, 6 Sep 2011 16:38:26 +0200 Message-ID: <00c801cc6ca2$a2f7eac0$480b22c0@GES1356> From: "Laurent TARRISSE" To: "Eric Blake" References: <00b801cc6c9c$56a28050$480b22c0@GES1356> <4E662D11.8020100@redhat.com> Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files Date: Tue, 6 Sep 2011 16:37:29 +0200 MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-MIMETrack: Itemize by SMTP Server on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/06/2011 04:38:26 PM, Serialize by Router on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/06/2011 04:38:27 PM, Serialize complete at 09/06/2011 04:38:27 PM, Itemize by SMTP Server on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 06/09/2011 16:38:27, Serialize by Router on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 06/09/2011 16:38:28, Serialize complete at 06/09/2011 16:38:28 X-TNEFEvaluated: 1 Content-Transfer-Encoding: 7bit Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response X-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: 9450 X-Mailman-Approved-At: Tue, 06 Sep 2011 11:33:06 -0400 Cc: 9450@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: -4.2 (----) ----- Original Message ----- From: "Eric Blake" To: "Laurent TARRISSE" Cc: <9450@debbugs.gnu.org> Sent: Tuesday, September 06, 2011 4:24 PM Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files > 9450 tag wishlist > thanks > > On 09/06/2011 07:53 AM, Laurent TARRISSE wrote: >> Hi >> >> Here this a strange behaviour using 'dirname' with joker filename: > > The term is 'wildcard', not 'joker' Please accept my apologizes. I'm french :) > >> dirname: too many arguments >> Try `dirname --help' for more information. > > Thanks for the report. To some degree, this is expected behavior: POSIX > requires that portable shell scripts pass exactly one argument to dirname, > so passing 0 or more than 1 arguments is necessarily in the realm of > non-portable code, and we would rather error out if we don't have any > better defined semantics for an extension. > OK for the answer. >> Could 'dirname' process only its first parameter ? > > No. But there _has_ been requests in the past to add an extension to GNU > coreutils to match BSD dirname/basename semantics of optionally taking > more than one parameter: > > https://lists.gnu.org/archive/html/bug-coreutils/2010-05/msg00015.html > > But so far, no one has submitted patches. Therefore, I'll keep this bug > report open, but tag it as a wishlist. > Just let me explain... we had to reuse unix scripts, primarily written for HP UX >uname -a HP-UX ppbmo B.11.23 U ia64 3204054692 unlimited-user license Some of our scripts, who did function perfectly on HP-UX for several years, encountered problems once moved on Linux platform. One reason is due to dirname : on HP UX I can give several arguments to dirname, and as you say, on Linux I cannot. That's all. ;) > -- > Eric Blake eblake@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 06 13:39:58 2011 Received: (at 9450) by debbugs.gnu.org; 6 Sep 2011 17:39:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0zcs-0005PP-IT for submit@debbugs.gnu.org; Tue, 06 Sep 2011 13:39:58 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0zco-0005PF-UM for 9450@debbugs.gnu.org; Tue, 06 Sep 2011 13:39:56 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id DCF1E211D8; Tue, 6 Sep 2011 11:36:05 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id AD9B42DC7E; Tue, 6 Sep 2011 11:36:05 -0600 (MDT) Date: Tue, 6 Sep 2011 11:36:05 -0600 From: Bob Proulx To: Laurent TARRISSE Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files Message-ID: <20110906173605.GA10620@hysteria.proulx.com> References: <00b801cc6c9c$56a28050$480b22c0@GES1356> <4E662D11.8020100@redhat.com> <00c801cc6ca2$a2f7eac0$480b22c0@GES1356> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00c801cc6ca2$a2f7eac0$480b22c0@GES1356> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 9450 Cc: 9450@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.5 (--) Laurent TARRISSE wrote: > Just let me explain... we had to reuse unix scripts, primarily > written for HP UX > > >uname -a > HP-UX ppbmo B.11.23 U ia64 3204054692 unlimited-user license > > Some of our scripts, who did function perfectly on HP-UX for several > years, encountered problems once moved on Linux platform. > One reason is due to dirname : on HP UX I can give several arguments > to dirname, and as you say, on Linux I cannot. That's all. ;) On HP-UX if you give several option arguments to dirname then the HP-UX dirname would handle the first argument and then return an error due to the extra arguments. See this example: $ /usr/bin/dirname /one/two/three /four/five /six/seven /one/two $ echo $? 1 $ /usr/bin/dirname /one/two/three /one/two $ echo $? 0 It is an error on HP-UX dirname to supply extra arguments too. But your scripts must be ignoring the error. GNU dirname is simply reporting the error more loudly. :-) What is your script expecting to happen with the extra arguments? Surely that would also be a bug in your script since those extra arguments are not getting processed. Bob From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 07 03:26:41 2011 Received: (at 9450) by debbugs.gnu.org; 7 Sep 2011 07:26: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 1R1CWu-0002U8-KZ for submit@debbugs.gnu.org; Wed, 07 Sep 2011 03:26:40 -0400 Received: from mail.midilibre.com ([193.104.54.20] helo=smtp.midilibre.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R1CWr-0002Tz-IM for 9450@debbugs.gnu.org; Wed, 07 Sep 2011 03:26:38 -0400 Received: from unknown (HELO smtp-av2.site) ([192.168.60.12]) by ironport2priv.midilibre.com with ESMTP; 07 Sep 2011 09:22:44 +0200 Received: from mdl-msg-smtp.midilibre.com (unknown [192.34.11.5]) by smtp-av2.site (Postfix) with ESMTP id 6973A17CF3; Wed, 7 Sep 2011 09:22:44 +0200 (CEST) Received: from mdl-msg-mdg2.midilibre.com ([192.34.11.6]) by mdl-msg-smtp.midilibre.com (Lotus Domino Release 8.0.1) with ESMTP id 2011090709224192-452815 ; Wed, 7 Sep 2011 09:22:41 +0200 Received: from GES1356 ([192.34.11.72]) by mdl-msg-mdg2.midilibre.com (Lotus Domino Release 8.0.1) with SMTP id 2011090709224123-15992 ; Wed, 7 Sep 2011 09:22:41 +0200 Message-ID: <001c01cc6d2e$ede2f8e0$480b22c0@GES1356> From: "Laurent TARRISSE" To: "Bob Proulx" References: <00b801cc6c9c$56a28050$480b22c0@GES1356> <4E662D11.8020100@redhat.com> <00c801cc6ca2$a2f7eac0$480b22c0@GES1356> <20110906173605.GA10620@hysteria.proulx.com> Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files Date: Wed, 7 Sep 2011 09:21:45 +0200 MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-MIMETrack: Itemize by SMTP Server on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/07/2011 09:22:41 AM, Serialize by Router on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/07/2011 09:22:42 AM, Serialize complete at 09/07/2011 09:22:42 AM, Itemize by SMTP Server on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 07/09/2011 09:22:41, Serialize by Router on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 07/09/2011 09:22:43, Serialize complete at 07/09/2011 09:22:43 X-TNEFEvaluated: 1 Content-Transfer-Encoding: 7bit Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original X-Spam-Score: -3.9 (---) X-Debbugs-Envelope-To: 9450 Cc: 9450@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.7 (---) ----- Original Message ----- From: "Bob Proulx" > Laurent TARRISSE wrote: >> Just let me explain... we had to reuse unix scripts, primarily >> written for HP UX >> >> >uname -a >> HP-UX ppbmo B.11.23 U ia64 3204054692 unlimited-user license >> >> Some of our scripts, who did function perfectly on HP-UX for several >> years, encountered problems once moved on Linux platform. >> One reason is due to dirname : on HP UX I can give several arguments >> to dirname, and as you say, on Linux I cannot. That's all. ;) > > On HP-UX if you give several option arguments to dirname then the > HP-UX dirname would handle the first argument and then return an > error due to the extra arguments. See this example: > > $ /usr/bin/dirname /one/two/three /four/five /six/seven > /one/two > > $ echo $? > 1 > > $ /usr/bin/dirname /one/two/three > /one/two > > $ echo $? > 0 > > It is an error on HP-UX dirname to supply extra arguments too. But > your scripts must be ignoring the error. GNU dirname is simply > reporting the error more loudly. :-) Yes, my script doesn't care about the return code. I use the dirname to extract the path from a given file, and then do a 'cd' command to that path : MY_PATH=`dirname $1` cd $MY_PATH As you say, HP-UX dirname returns 1, but neveetheless outputs the path of the first argument, and it's just what I expected him to do ! :)) > What is your script expecting to happen with the extra arguments? > Surely that would also be a bug in your script since those extra > arguments are not getting processed. No because my script is less or more something equal to the FTP 'put' or 'mput' commands : you give it a file name as an argument, this file name can contain a wildcard, so it can actually match several files of the filesystem. The 'bug' appeared on Linux, because dirname doesn't output the path when several arguments are passed to it. :)) > Bob From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 07 10:37:30 2011 Received: (at 9450-done) by debbugs.gnu.org; 7 Sep 2011 14:37:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R1JFo-0006xm-Tu for submit@debbugs.gnu.org; Wed, 07 Sep 2011 10:37:29 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R1JFm-0006xd-AA for 9450-done@debbugs.gnu.org; Wed, 07 Sep 2011 10:37:27 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 7679FA60003; Wed, 7 Sep 2011 07:33:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1ZBWrAjftTlI; Wed, 7 Sep 2011 07:33:31 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 1389A39E80DE; Wed, 7 Sep 2011 07:33:31 -0700 (PDT) Message-ID: <4E6780BA.70101@cs.ucla.edu> Date: Wed, 07 Sep 2011 07:33:30 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13 MIME-Version: 1.0 To: Laurent TARRISSE Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files References: <00b801cc6c9c$56a28050$480b22c0@GES1356> <4E662D11.8020100@redhat.com> <00c801cc6ca2$a2f7eac0$480b22c0@GES1356> <20110906173605.GA10620@hysteria.proulx.com> <001c01cc6d2e$ede2f8e0$480b22c0@GES1356> In-Reply-To: <001c01cc6d2e$ede2f8e0$480b22c0@GES1356> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 9450-done Cc: 9450-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: -3.0 (---) On 09/07/11 00:21, Laurent TARRISSE wrote: > The 'bug' appeared on Linux, because dirname doesn't output the path when > several arguments are passed to it. :) The same 'bug' will also appear on Solaris 10; its dirname does the same thing as GNU/Linux's dirname. I'm afraid you're fighting an uphill battle here. I'd fix the script rather than expecting other implementations to match HP-UX's quirks. I'm marking this as "done" since I don't expect the GNU/Linux version to change. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 07 10:52:41 2011 Received: (at submit) by debbugs.gnu.org; 7 Sep 2011 14:52: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 1R1JUW-000812-4g for submit@debbugs.gnu.org; Wed, 07 Sep 2011 10:52:41 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R1JUR-00080r-07 for submit@debbugs.gnu.org; Wed, 07 Sep 2011 10:52:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1JQZ-0002w8-Kf for submit@debbugs.gnu.org; Wed, 07 Sep 2011 10:48:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:53982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1JQZ-0002w4-JD for submit@debbugs.gnu.org; Wed, 07 Sep 2011 10:48:35 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1JQY-0003xT-Lq for bug-coreutils@gnu.org; Wed, 07 Sep 2011 10:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1JQX-0002vl-GB for bug-coreutils@gnu.org; Wed, 07 Sep 2011 10:48:34 -0400 Received: from c-24-10-95-210.hsd1.ca.comcast.net ([24.10.95.210]:55625 helo=fraenk.haell.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1JQX-0002vR-AO for bug-coreutils@gnu.org; Wed, 07 Sep 2011 10:48:33 -0400 Received: by fraenk.haell.com (Postfix, from userid 1000) id B5DDCBEE9C; Wed, 7 Sep 2011 07:10:23 -0700 (PDT) Date: Wed, 7 Sep 2011 07:10:23 -0700 From: wyrm@haell.com To: bug-coreutils@gnu.org Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files Message-ID: <20110907141023.GA28973@fraenk> Mail-Followup-To: bug-coreutils@gnu.org References: <00b801cc6c9c$56a28050$480b22c0@GES1356> <4E662D11.8020100@redhat.com> <00c801cc6ca2$a2f7eac0$480b22c0@GES1356> <20110906173605.GA10620@hysteria.proulx.com> <001c01cc6d2e$ede2f8e0$480b22c0@GES1356> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001c01cc6d2e$ede2f8e0$480b22c0@GES1356> X-Fortune: We'll cross that bridge when we come back to it later. User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit 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.2 (------) On 2011-09-07 at 09:21:45 +0200, ltarrisse@midilibre.com wrote: > Yes, my script doesn't care about the return code. I use the dirname > to extract the path from a given file, and then do a 'cd' command to > that path : > MY_PATH=`dirname $1` > cd $MY_PATH > As you say, HP-UX dirname returns 1, but neveetheless outputs the path > of the first argument, and it's just what I expected him to do ! :)) Place some quotes around the argument, so that the variable will expand but the glob won't. Something like: MY_PATH=`dirname "$1"` will probably do what you expect. -- Confucius is inscrutable. God is ineffable. Beer is inevitable. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 07 10:53:02 2011 Received: (at 9450-done) by debbugs.gnu.org; 7 Sep 2011 14: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 1R1JUr-00081e-Rk for submit@debbugs.gnu.org; Wed, 07 Sep 2011 10:53:02 -0400 Received: from mail.midilibre.com ([193.104.54.20] helo=smtp.midilibre.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R1JUo-00081P-Vc for 9450-done@debbugs.gnu.org; Wed, 07 Sep 2011 10:53:00 -0400 Received: from unknown (HELO smtp-av2.site) ([192.168.60.12]) by ironport2priv.midilibre.com with ESMTP; 07 Sep 2011 16:49:04 +0200 Received: from mdl-msg-smtp.midilibre.com (unknown [192.34.11.5]) by smtp-av2.site (Postfix) with ESMTP id 7735418362; Wed, 7 Sep 2011 16:49:04 +0200 (CEST) Received: from mdl-msg-mdg2.midilibre.com ([192.34.11.6]) by mdl-msg-smtp.midilibre.com (Lotus Domino Release 8.0.1) with ESMTP id 2011090716490152-461349 ; Wed, 7 Sep 2011 16:49:01 +0200 Received: from GES1356 ([192.34.11.72]) by mdl-msg-mdg2.midilibre.com (Lotus Domino Release 8.0.1) with SMTP id 2011090716485940-17681 ; Wed, 7 Sep 2011 16:48:59 +0200 Message-ID: <008801cc6d6d$4695ff80$480b22c0@GES1356> From: "Laurent TARRISSE" To: "Paul Eggert" References: <00b801cc6c9c$56a28050$480b22c0@GES1356> <4E662D11.8020100@redhat.com> <00c801cc6ca2$a2f7eac0$480b22c0@GES1356> <20110906173605.GA10620@hysteria.proulx.com> <001c01cc6d2e$ede2f8e0$480b22c0@GES1356> <4E6780BA.70101@cs.ucla.edu> Subject: Re: bug#9450: Bug report on 'dirname' : when jokers match several files Date: Wed, 7 Sep 2011 16:48:52 +0200 MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-MIMETrack: Itemize by SMTP Server on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/07/2011 04:48:59 PM, Serialize by Router on mdl_msg_mdg2/SRV/GML(Release 8.0.1|February 07, 2008) at 09/07/2011 04:49:01 PM, Serialize complete at 09/07/2011 04:49:01 PM, Itemize by SMTP Server on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 07/09/2011 16:49:01, Serialize by Router on mdl_msg_smtp/SRV/GML(Release 8.0.1|February 07, 2008) at 07/09/2011 16:49:03, Serialize complete at 07/09/2011 16:49:03 X-TNEFEvaluated: 1 Content-Transfer-Encoding: 7bit Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 9450-done Cc: 9450-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: -3.5 (---) ----- Original Message ----- From: "Paul Eggert" > On 09/07/11 00:21, Laurent TARRISSE wrote: >> The 'bug' appeared on Linux, because dirname doesn't output the path when >> several arguments are passed to it. :) > > The same 'bug' will also appear on Solaris 10; its > dirname does the same thing as GNU/Linux's dirname. > > I'm afraid you're fighting an uphill battle here. > I'd fix the script rather than expecting > other implementations to match HP-UX's quirks. > > I'm marking this as "done" since I don't expect > the GNU/Linux version to change. You are right. In fact, I do not expect any more that the Linux version change, and I already fixed my script to deal with this feature. However, the advice given by an anonymous person in the preceding email: >Place some quotes around the argument, so that the variable will expand >but the glob won't. Something like: >MY_PATH=`dirname "$1"` >will probably do what you expect. worked perfectly oo Thanks to him (I cannot respond to him thus the 'sender email' is unreachable) because From unknown Sun Sep 07 23:15:55 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 06 Oct 2011 11:24:03 +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