This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10246] New: glob() with GLOB_NOCHECK is returning a modified pattern sometimes
- From: "psmith at gnu dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 6 Jun 2009 05:55:46 -0000
- Subject: [Bug libc/10246] New: glob() with GLOB_NOCHECK is returning a modified pattern sometimes
- Reply-to: sourceware-bugzilla at sourceware dot org
Actually I see this with glibc 2.7-13 but there's no 2.7 in the version list?
According to POSIX, glob() with GLOB_NOCHECK should:
> If pattern does not match any pathname, then glob() shall return a list
> consisting of only pattern, and the number of matched pathnames is 1.
However, if I invoke glob() with a pattern of "//<word>" where <word> is any
non-slash-containing string that I've tried, then the resulting string is
"/<word>" with the initial slash removed.
If there are more than two initial slashes, it works fine. Likewise if there
are extra directory levels in the pattern.
I will attach a test program I wrote:
$ gcc -o /tmp/gtest /tmp/gtest.c
$ /tmp/gtest /%
0: /bin
$ /tmp/gtest //%
0: /bin <--incorrect!
$ /tmp/gtest ///%
0: ///% <--OK
$/tmp/gtest //a/b
0: //a/b <--OK
--
Summary: glob() with GLOB_NOCHECK is returning a modified pattern
sometimes
Product: glibc
Version: 2.8
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: psmith at gnu dot org
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=10246
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.