Debian Bug report logs - #231267
bash: manpage is misleading for "test -f": symlink vs. regular file

version graph

Package: bash; Maintainer for bash is Matthias Klose <doko@debian.org>; Source for bash is src:bash.

Reported by: frank@debian.org (Frank Küster)

Date: Thu, 5 Feb 2004 14:03:01 UTC

Severity: normal

Tags: patch, upstream

Found in version 2.05b-13

Fixed in version bash/3.0-8

Done: Matthias Klose <doko@debian.org>

Bug is archived. No further changes may be made.

Forwarded to chet@po.cwru.edu

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#231267; Package bash. Full text and rfc822 format available.

Acknowledgement sent to "Frank K�ster" <frank@kuesterei.ch>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: "Frank Küster" <frank@kuesterei.ch>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash: manpage is misleading for "test -f": symlink vs. regular file
Date: Thu, 05 Feb 2004 14:44:22 +0100
Package: bash
Version: 2.05b-13
Severity: normal
Tags: patch

The manpage is misleading about the meaning of 

test -f $filename

From wording and context (i.e. the existence of the -h and -L options)
it seems as if this were only true if $filename was an ordinary file
in the sense that it has a "-" in the first column of ls -l. 

But in fact the construct is also true if $filename is a symbolic link
to such a regular file, as opposed to a (symlink to a) directory,
devicefile etc. This might be obvious if one knows that -h and -L
don't exist in POSIX, but in the context of the manpage it is not (and
who knows POSIX/SUSVx exactly?).

Therefore I suggest the following patch to the manpage.

--- bash/doc/bash.1.orig	Tue Feb  3 16:27:52 2004
+++ bash/doc/bash.1	Tue Feb  3 16:29:34 2004
@@ -3274,7 +3274,7 @@
 True if \fIfile\fP exists.
 .TP
 .B \-f \fIfile\fP
-True if \fIfile\fP exists and is a regular file.
+True if \fIfile\fP exists and is a regular file (or a symbolic link to a regular file).
 .TP
 .B \-g \fIfile\fP
 True if \fIfile\fP exists and is set-group-id.

Note that I have submitted an analogous patch for the manpage for
/usr/bin/test from coreutils, see #230957

Regards, Frank

P.S. 

-- System Information
deleted, because I downloaded the source from unstable and the patch
is against this.



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#231267; Package bash. Full text and rfc822 format available.

Acknowledgement sent to chet@po.CWRU.Edu:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #10 received at 231267@bugs.debian.org (full text, mbox):

From: Chet Ramey <chet@caleb.ins.cwru.edu>
To: doko@debian.org, 231267@bugs.debian.org, frank@kuesterei.ch
Cc: chet@po.cwru.edu
Subject: Debian Bash bug #231267 (manpage misleading for "test -f")
Date: Tue, 17 Feb 2004 15:27:07 -0500
This is not a problem with the manual page.

There has to be some base set of understanding that doesn't require
inclusion in the man page.  Ever since symbolic links  were introduced,
all system calls dealing with pathnames resolve them transparently
unless the system call is explicitly defined to deal with the symlink
itself (lstat, readlink).

The same holds true for test (and every other utility, frankly).  Functions
that are defined to operate on files use system calls that transparently
resolve symbolic links unless those functions are explicitly described
as operating on the symlink.

This is part of the definition of symbolic link behavior and pathname
resolution.  It's not a POSIX issue per se -- it's how every Unix system
with symbolic links has ever behaved.  The one thing POSIX did in this
area is tighten up the rules a bit.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
						Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#231267; Package bash. Full text and rfc822 format available.

Acknowledgement sent to frank@debian.org (Frank Küster):
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #15 received at 231267@bugs.debian.org (full text, mbox):

From: frank@debian.org (Frank Küster)
To: chet@po.cwru.edu
Cc: doko@debian.org, 231267@bugs.debian.org, 230957@bugs.debian.org
Subject: Re: Debian Bash bug #231267 (manpage misleading for "test -f")
Date: Tue, 24 Feb 2004 13:16:14 +0100
Chet Ramey <chet@caleb.ins.cwru.edu> wrote:

> This is not a problem with the manual page.
>
> There has to be some base set of understanding that doesn't require
> inclusion in the man page.  Ever since symbolic links  were introduced,
> all system calls dealing with pathnames resolve them transparently
> unless the system call is explicitly defined to deal with the symlink
> itself (lstat, readlink).

I agree.

> The same holds true for test (and every other utility, frankly). 

Here I don't agree. On the one hand, test and bash's test builtin do
deal explicitly with symlinks: They have the -L and -h
options. Therefore it is really not 100% clear that all the other
options treat symlinks transparently.

And, regarding the part in brackets:

$ ls -l bar
lrwxrwxrwx    1 frank    frank           3 2004-02-18 09:31 bar -> foo
$ find . -type f | grep bar
$ 

From the point of view of a user or developer of shell scripts, there is
no fundamental difference between test and find. 

> Functions
> that are defined to operate on files use system calls that transparently
> resolve symbolic links unless those functions are explicitly described
> as operating on the symlink.

I would call it a good idea to explain in find's manpage that there
"regular file" really means "regular file, but not a symlink to a
regular file". Still I think that in the manpage of test and bash's test
builtin should clarify the point, too.

Regards, Frank
-- 
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie




Reply sent to Alastair McKinstry <mckinstry@computer.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to "Frank K�ster" <frank@kuesterei.ch>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #20 received at 231267-done@bugs.debian.org (full text, mbox):

From: Alastair McKinstry <mckinstry@computer.org>
To: 231267-done@bugs.debian.org
Subject: closing
Date: Wed, 25 Feb 2004 21:26:36 +0000
This bug was fixed in an earlier release (0.24).

-- 
Slán agus Beannacht,
Alastair

Alastair McKinstry <mckinstry@debian.org>
GPG Key fingerprint (New) = CD45 260A 4546 C3C0 F595  F0F6 4132 BF90 2A38 5C57
He that would make his own liberty secure must guard even his enemy from
oppression; for if he violates this duty he establishes a precedent that
will reach to himself.

- --Thomas Paine



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#231267; Package bash. Full text and rfc822 format available.

Acknowledgement sent to frank@kuesterei.ch (Frank Küster):
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #25 received at 231267@bugs.debian.org (full text, mbox):

From: frank@kuesterei.ch (Frank Küster)
To: 231267@bugs.debian.org
Subject: Re: Bug#231267 acknowledged by developer (closing)
Date: Thu, 26 Feb 2004 13:22:50 +0100
owner@bugs.debian.org (Debian Bug Tracking System) wrote:

> This is an automatic notification regarding your Bug report
> #231267: bash: manpage is misleading for "test -f": symlink vs. regular file,
> which was filed against the bash package.
>
> It has been closed by one of the developers, namely
> Alastair McKinstry <mckinstry@computer.org>.
>
[...]
> This bug was fixed in an earlier release (0.24).

Excuse me, I do not understand this. What is release 0.24 of bash - I
couldn't find anything like this. And does that mean you have
reconsidered the issue and are willing to have a changed manpage?

Regards, Frank
-- 
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#231267; Package bash. Full text and rfc822 format available.

Acknowledgement sent to frank@debian.org (Frank Küster):
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #30 received at 231267@bugs.debian.org (full text, mbox):

From: frank@debian.org (Frank Küster)
To: Debian Bug Control Server <control@bugs.debian.org>
Cc: 231267@bugs.debian.org
Subject: Reopening this, needs to be clarified
Date: Wed, 03 Mar 2004 14:33:39 +0100
reopen 231267 !
thanks

Hi bash maintainers,

it seems this bug has been closed by mistake, since there is no "earlier
release (0.24)" of bash, and there has been no change in the manpage AFAIS.

I still don't think that the bug report shows lack of "base
understanding" of symlinks, but we can discuss that.

Regards, Frank

P.S. changing originator address simply for mail filtering purposes.
-- 
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie




Bug reopened, originator set to frank@debian.org (Frank Küster). Request was from frank@debian.org (Frank Küster) to control@bugs.debian.org. Full text and rfc822 format available.

Information stored:
Bug#231267; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and filed, but not forwarded. Full text and rfc822 format available.

Message #37 received at 231267-quiet@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: 231267-quiet@bugs.debian.org
Subject: bash(1)
Date: Thu, 15 Jul 2004 19:40:22 -0400
[Message part 1 (text/plain, inline)]
I second this; the manpage (for bash) should be clarified.  I too
submitted a bad bug report.

A more extensive treatment of the issue in bash(1) will be useful to
users and will also cut down on bad bugs.

Thanks,
Justin
[signature.asc (application/pgp-signature, inline)]

Noted your statement that Bug has been forwarded to chet@po.cwru.edu. Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. Full text and rfc822 format available.

Tags added: upstream Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. Full text and rfc822 format available.

Reply sent to Matthias Klose <doko@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to frank@debian.org (Frank Küster):
Bug acknowledged by developer. Full text and rfc822 format available.

Message #46 received at 231267-close@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: 231267-close@bugs.debian.org
Subject: Bug#231267: fixed in bash 3.0-8
Date: Sun, 17 Oct 2004 08:17:06 -0400
Source: bash
Source-Version: 3.0-8

We believe that the bug you reported is fixed in the latest version of
bash, which is due to be installed in the Debian FTP archive:

bash-builtins_3.0-8_i386.deb
  to pool/main/b/bash/bash-builtins_3.0-8_i386.deb
bash-doc_3.0-8_all.deb
  to pool/main/b/bash/bash-doc_3.0-8_all.deb
bash-minimal_3.0-8_i386.deb
  to pool/main/b/bash/bash-minimal_3.0-8_i386.deb
bash-static_3.0-8_i386.deb
  to pool/main/b/bash/bash-static_3.0-8_i386.deb
bash_3.0-8.diff.gz
  to pool/main/b/bash/bash_3.0-8.diff.gz
bash_3.0-8.dsc
  to pool/main/b/bash/bash_3.0-8.dsc
bash_3.0-8_i386.deb
  to pool/main/b/bash/bash_3.0-8_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 231267@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated bash package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sun, 17 Oct 2004 09:31:03 +0200
Source: bash
Binary: bashdb bash-builtins bash bash-minimal bash-static bash-doc
Architecture: source i386 all
Version: 3.0-8
Distribution: unstable
Urgency: low
Maintainer: Matthias Klose <doko@debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Description: 
 bash       - The GNU Bourne Again SHell
 bash-builtins - Bash loadable builtins - headers & examples
 bash-doc   - Documentation and examples for the The GNU Bourne Again SHell
 bash-minimal - The GNU Bourne Again SHell (minimal version)
 bash-static - The GNU Bourne Again SHell (static version)
Closes: 231267 259767 262354 271413 273809
Changes: 
 bash (3.0-8) unstable; urgency=low
 .
   * Add a comment to /etc/bash.bashrc that the file is not read by
     login shells (closes: #271413).
   * Sync builtin CDPATH documentation with man page (closes: #259767).
   * Document conditional file expressions acting on the target of
     symbolic links as well (except -h, -L). Closes: #231267.
   * Update to bash_completion 20041017 (v1.758).
     - Unset `have' variable at end of sourcing (closes: #273809).
     - Fix scp completion breakage when filenames contained an ampersand.
       Closes: #262354.
Files: 
 33d28fb5f02f5ff1f1f91b5280fa7757 723 base required bash_3.0-8.dsc
 417cd99f43fb09d53bbdbf3484bd18ab 175266 base required bash_3.0-8.diff.gz
 c358240c8440ad7b37741d841516f232 714362 doc optional bash-doc_3.0-8_all.deb
 7c45132a7e572a25418fc23e049fc23b 786412 base required bash_3.0-8_i386.deb
 ee5d773eab7407af1f6759cd587f74d7 97926 utils optional bash-builtins_3.0-8_i386.deb
 9aae27e95aff9d3718f2b90a64554c7e 626212 shells optional bash-static_3.0-8_i386.deb
 f2c9c3f51fc61d0c5959ea411c02ef75 181436 shells optional bash-minimal_3.0-8_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBcl4bStlRaw+TLJwRAnhBAJ0TD5eM0OPOW/mdnNxtw5Nlxiav8wCgse4y
MQHdVvudqMnKMhKLlgWqFTI=
=eal9
-----END PGP SIGNATURE-----




Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 10:14:09 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.