[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in dirname(3)
From: |
Andreas Jaeger |
Subject: |
Re: Bug in dirname(3) |
Date: |
13 Dec 2000 09:00:47 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Capitol Reef) |
>>>>> Michael Kerrisk writes:
> Hello,
> This email is to report a bug in dirname(3) (misc/dirname.c).
> Scenario: dirname("/usr/") should return "/" (as per SUSv2), but instead
> returns "/usr/" (in glibc 2.2.5) or "" (empty string, in glibc 2.1.3).
> This error is not detected because misc/tst-dirname.c falsely tests the
> case "/usr" instead of "/usr/" (as per SUSv2).
> There also seem to be other errors in the 2.2.5 implementation of
> dirname(3). For example dirname("/.///aaaaa") should (in my reading of
> SUSv2) give "/.", which is what dirname(1) does indeed give. dirname(3)
> in glibc 2.2.52 gives "/.//".
> I have included a test program which includes and tests copies of the
> 2.1.3 and 2.2.5 versions of dirname(), as well as my own version which I
> belive is SUSv2 compliant: dirname_mtk() in the attached source.
> Finally, on my Linux distro (SuSE 6.4), there are no man pages for
> dirname(3) and basename(3). I seem to recall a while ago seeing a note on
> the GNU site asking for volunteers to write them. If this is still
> required, let me know and I will write them.
They seem to be missing - please contact address@hidden for
details. glibc doesn't come with man pages - but with info
documentation.
> Cheers,
> Michael
> -----------------------------
> /* t_dirname.c
> Copyright Michael Kerrisk, Sep 00
Sorry, we can't use that - you have to allow us to use it in glibc and
put it under the GPL.
For now I propose to check in the following patch. Uli, what do you
think?
Andreas
2000-12-13 Andreas Jaeger <address@hidden>
* misc/tst-dirname.c (main): Fix typo in test to really use
the examples from Unix98.
Reported by Michael Kerrisk <address@hidden>.
============================================================
Index: misc/tst-dirname.c
--- misc/tst-dirname.c 2000/05/23 08:43:03 1.4
+++ misc/tst-dirname.c 2000/12/13 07:55:20
@@ -45,7 +45,7 @@
/* These are the examples given in XPG4.2. */
result |= test ("/usr/lib", "/usr");
- result |= test ("/usr", "/");
+ result |= test ("/usr/", "/");
result |= test ("usr", ".");
result |= test ("/", "/");
result |= test (".", ".");
--
Andreas Jaeger
SuSE Labs address@hidden
private address@hidden
http://www.suse.de/~aj
- Bug in dirname(3), Michael Kerrisk, 2000/12/13
- Re: Bug in dirname(3),
Andreas Jaeger <=