Your message dated Sat, 18 Jun 2005 00:15:46 -0500
with message-id <[EMAIL PROTECTED]>
and subject line Why is this a bug?
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 18 Jan 2005 09:49:57 +0000
>From [EMAIL PROTECTED] Tue Jan 18 01:49:57 2005
Return-path: <[EMAIL PROTECTED]>
Received: from mailservice.tudelft.nl [130.161.131.5] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1Cqpzo-0000t9-00; Tue, 18 Jan 2005 01:49:56 -0800
Received: from localhost (localhost [127.0.0.1])
        by rav.antivirus (Postfix) with ESMTP id 2F9C122EEEA;
        Tue, 18 Jan 2005 10:49:25 +0100 (CET)
Received: from localhost (x117.decis.nl [130.161.177.117])
        by mx1.tudelft.nl (Postfix) with ESMTP id 822D722EF87;
        Tue, 18 Jan 2005 10:49:24 +0100 (CET)
Received: by localhost (Postfix, from userid 1001)
        id 3E6B610D5CD; Tue, 18 Jan 2005 10:48:58 +0100 (CET)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Thomas Hood <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: 9.3.3.2 "command -v" example needs tweaking
X-Mailer: reportbug 3.2
Date: Tue, 18 Jan 2005 10:48:57 +0100
Message-Id: <[EMAIL PROTECTED]>
X-Virus-Scanned: by amavisd-new at tudelft.nl
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

Package: debian-policy
Version: 3.6.1.1
Severity: minor

Section 9.3.3.2 gives this as an example of how to check for the
availability of invoke-rc.d:

>    if command -v invoke-rc.d >/dev/null 2>&1; then

1. It would be helpful to mention that "command -v" is not POSIX and
   that therefore, to be consistent with section 10.4, this example
   should only be followed in scripts headed with "#!/bin/bash".

   If #218530 is ever implemented then this restriction can be
   dropped.

2. "command -v" in bash 3.0-5 sometimes prints pathnames of files
   on the PATH that aren't executable.  To work around this, the
   example could be changed to something like this:

    if CMD="$(command -v invoke-rc.d 2>/dev/null)" && [ -x "$CMD" ] ; then

Discussion
----------
I actually think that issue #2 is a bug in bash. Consider the following
sequence of commands which illustrate that "command -v foo" prints
the name of the first executable file "foo" it finds on the PATH,
failing which it prints the first non-executable file "foo" it finds
on the PATH.  What sense does that make?  If people agree then I'll
file a bug report against bash.

[EMAIL PROTECTED]:~$ echo $PATH
/home/jdthood/bin:/usr/local/bin:/bin:/usr/bin:/usr/bin/X11:/usr/games
[EMAIL PROTECTED]:~$ which foo
[EMAIL PROTECTED]:~$ command -v foo
bash: command: foo: not found
[EMAIL PROTECTED]:~$ touch /home/jdthood/bin/foo
[EMAIL PROTECTED]:~$ ls -l /home/jdthood/bin/foo
-rw-r--r--  1 jdthood jdthood 0 2005-01-18 10:40 /home/jdthood/bin/foo
[EMAIL PROTECTED]:~$ which foo
[EMAIL PROTECTED]:~$ command -v foo
/home/jdthood/bin/foo
[EMAIL PROTECTED]:~$ sudo touch /usr/local/bin/foo
[EMAIL PROTECTED]:~$ which foo
[EMAIL PROTECTED]:~$ command -v foo
/home/jdthood/bin/foo
[EMAIL PROTECTED]:~$ ls -l /usr/local/bin/foo
-rw-r--r--  1 root staff 0 2005-01-18 10:41 /usr/local/bin/foo
[EMAIL PROTECTED]:~$ sudo chmod ugo+x /usr/local/bin/foo
[EMAIL PROTECTED]:~$ ls -l /usr/local/bin/foo
-rwxr-xr-x  1 root staff 0 2005-01-18 10:41 /usr/local/bin/foo
[EMAIL PROTECTED]:~$ which foo
/usr/local/bin/foo
[EMAIL PROTECTED]:~$ command -v foo
/usr/local/bin/foo


-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.9
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

-- no debconf information

---------------------------------------
Received: (at 291026-done) by bugs.debian.org; 18 Jun 2005 05:25:37 +0000
>From [EMAIL PROTECTED] Fri Jun 17 22:25:37 2005
Return-path: <[EMAIL PROTECTED]>
Received: from host-12-107-230-171.dtccom.net 
(glaurung.internal.golden-gryphon.com) [12.107.230.171] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1DjVpp-0004zu-00; Fri, 17 Jun 2005 22:25:37 -0700
Received: from glaurung.internal.golden-gryphon.com ([EMAIL PROTECTED] 
[127.0.0.1])
        by glaurung.internal.golden-gryphon.com (8.13.4/8.13.4/Debian-3) with 
ESMTP id j5I5FkkW013934
        (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
        for <[EMAIL PROTECTED]>; Sat, 18 Jun 2005 00:15:46 -0500
Received: (from [EMAIL PROTECTED])
        by glaurung.internal.golden-gryphon.com (8.13.4/8.13.4/Submit) id 
j5I5Fkkp013933;
        Sat, 18 Jun 2005 00:15:46 -0500
X-Authentication-Warning: glaurung.internal.golden-gryphon.com: srivasta set 
sender to srivasta(va, manoj)@debian.org using -f
From: Manoj Srivastava <[EMAIL PROTECTED] (va, manoj)>
To: [EMAIL PROTECTED]
Subject: Why is this a bug?
Organization: The Debian Project
User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) 
(i686-pc-linux-gnu)
Face: iVBORw0KGgoAAAANSUhEUgAAACYAAAAwCAMAAABKbPgaAAAAM1BMVEUAAADIjH/0rp1KPz79
        
0b+ic2nlpJc2Ly2AY17VlYb4uqi2gHQXFBN2WVXgno5iT02Xa2Nx+jaIAAACVElEQVQ4jeWU23bj
        
IAxFLUAggQX6/6+dI9LGTpo+9mlYiXNhc3TnOP50naZE0tqvgEk+soutnNfQ8yPTWMTENhNrjI+Y
        
+N7POVt8tAzpn2vJlsmttbyfrdkP7hx5iezteGzsbOts7xT+tC1mcG+LtRP2X/16bEQExuyx1uZW
        
vscrAWUT8aE0aDBeBuw8nS5u4WgWyDCllOZUBeyWgbWbGrBsTDpTx0qpphlcYPcgJLvBXFClPMg5
        
6WH2JidLIAaDF5aAed7uPTH4bjw0bZvfajp2tHc1F+cBm+Vr9YomGSwNhbmcczYEWUu5MBpYvCLV
        
F+ZIKwQfYB+CBXnIRQFvIRhK6l96PemsFLEPFxi+MPxiTYH0Ave1InPsIYes3NJb42ytBSmmysyj
        
lIQYHJm6Im1WbQ0kWMesKFRFPKTDzJ3GhWUn2KWKEkWlKthoACLm2eWJQQh2qKbAUgQxa+8TVjn1
        
aySm8656ookCfCc5TRzvnZ6YOu3NpHg+uR5YuRkNF/b5IHq5Y7Ve6c2+sR4hqIZ3+5DCt3ukh8Eo
        
vFIXVJxqfMdbkd/BF3YaQkB/2RIUHPMS7RLVAHefrYzWZVQ/ei4peBsROFLi90ltQyvF5I05t4Zs
        
L4C9DODJ2AZCUf8UitGjCIdfx15QQkfZibTOGT3edxns5fY6F2rstKcTwiiaJnQwvYkdzTlaTqNH
        
IkSmGdLrON45tGsMNDoSYr4bxH5emHEFaoFjKBahHXFXfLx9cR9p6ejJXihuxPz57gWHZkWovbPl
        9gsU8eImtBi++3D+f+sfT/Mg79fyEz8AAAAASUVORK5CYII=
X-URL: http://www.debian.org/%7Esrivasta/
Mail-Copies-To: nobody
X-Face: [EMAIL PROTECTED]/;Y^gTjR\T^"B'fbeuVGiyKrvbfKJl!^e|e:iu(kJ6c|QYB57LP*|t
 &YlP~HF/=h:[EMAIL PROTECTED]:6Cj0kd#4]>*D,|0djf'CVlXkI,>aV4\}?d_KEqsN{Nnt7
 78"OsbQ["56/!nisvyB/uA5Q.{)gm6?q.j71ww.>b9b]-sG8zNt%KkIa>xWg&1VcjZk[hBQ>]j~`Wq
 Xl,y1a!(>6`UM{~'X[Y_,Bv+}=L\SS*mA8=s;!=O`ja|@PEzb&i0}Qp,`Z\:6:OmRi*
X-Hashcash: 1:25:050618:[EMAIL 
PROTECTED]::+LNy0C4CMfnLgD7J:0000000000000000000000000000000002P+dm
Date: Sat, 18 Jun 2005 00:15:46 -0500
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-CRM114-Score: -13.1141
X-CRM114-Status: Good  ( pR: -13.1141 )
X-SA-Orig: -9.899, -13.1141
X-Spam-Value: -15.0720055555556
X-Grey: White
X-SA-Rep: -15.0720055555556 ALL_TRUSTED,BAYES_00,HASHCASH_25
X-Scanned-By: MIMEDefang version 2.51 (www . roaringpenguin . com / mimedefang) 
on 192.168.1.10
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no 
        version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

Hi,

        Why should policy example follow some other code out there,
 especially if the examples shown in policy are correct?  And it has
 not been shown that which messes up, command -v would work
 differently, but not which.

        Seems to me debhelper is doing an extra, unneeded stat, which
 is fine. I  see no reason to emulate that, though, in an example.

        manoj
-- 
There is nothing wrong with writing ... as long as it is done in
private and you wash your hands afterward.
Manoj Srivastava   <[EMAIL PROTECTED]>  <http://www.debian.org/%7Esrivasta/>
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to