On Tue, 19 Aug 2008, Carlos O'Donell wrote:
On Fri, Aug 15, 2008 at 9:03 AM, Mirsad Todorovac <[EMAIL PROTECTED]> wrote:
I have came across a bug in dirname() function of GNU libc.
It is triggered by the following minimal source:
#include <stdio.h>
#include <string.h>
int main (int argc, char *argv[]) {
char *buf = "usr/";
char *word = strdup (buf);
printf ("dirname ('%s')='%s'\n", buf, dirname (word));
free (word);
}
The trick is to use trailing slash ('/') on path that doesn't start with
one.
Please file a bug against glibc if you think this is a bug present in
the debian libc6 package.
On libc6 2.7-10 for x86, your testcase works just fine:
[EMAIL PROTECTED]:~$ ./test3
dirname ('usr/')='.'
Cheers,
Carlos.
Carlos,
I have verified your claim. On x86 system
ii libc6 2.3.6.ds1-13etch5 GNU C Library
the result is truly so.
I have, however, verified the bug both on Debian x86_64 system and on
CentOS 4 x64. It seems that the bug is tied to x86_64 platforms.
[EMAIL PROTECTED]:~/grc/grc-0.02.00$ dpkg -l | grep libc6
ii libc6 2.3.2.ds1-22sa GNU C Library: Shared libraries and
Timezone
ii libc6-dev 2.3.2.ds1-22sa GNU C Library: Development Libraries and
Hea
Since iz appears both on Debian and CentOS (libc ver 2.3.4), it seems that
the bug is glibc-related.
I should maybe also try to download latest version and compile it against
x86_64 platform and see how it behaves.
Alas, I have terrible misfortune: I have failed to register to bugzilla
with three different mail addresses.
I will retry this, and if it fails would you be so kind to file the bug
and send me a Cc:?
Regards,
Mirsad
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]