This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug libc/866] New: glob should match dangling symlinks
- From: "splite-glibc at sigint dot cs dot purdue dot edu" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 22 Apr 2005 19:50:22 -0000
- Subject: [Bug libc/866] New: glob should match dangling symlinks
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
The 1.53 revision to sysdeps/generic/glob.c added a check for dangling symlinks.
While necessary for directory globs, it still seems desirable to match dangling
symlinks in filename globs, as bash and tcsh's built-in globbers do. This
program demonstrates the problem:
% cat globtest.c
#include <stdio.h>
#include <glob.h>
main()
{
int i;
glob_t pglob;
chdir("/tmp");
symlink("/nope", "foo1");
symlink("/usr", "foo2");
glob("foo[12]", 0, 0, &pglob);
for (i = 0; i < pglob.gl_pathc; i++)
printf("pglob.gl_pathv[%d] = \"%s\"\n", i, pglob.gl_pathv[i]);
unlink("foo1");
unlink("foo2");
}
% gcc -o globtest globtest.c
% ./globtest
pglob.gl_pathv[0] = "foo2"
Same thing in bash (tcsh behaves identically):
bash-2.05b$ cd /tmp
bash-2.05b$ ln -s /nope foo1
bash-2.05b$ ln -s /usr foo2
bash-2.05b$ echo foo[12]
foo1 foo2
bash-2.05b$ rm foo1 foo2
I'm attaching a patch to glob.c that makes glob()'s behavior mimic bash and
tcsh's. The resulting glob() still passes globtest.sh, so it seems correct.
--
Summary: glob should match dangling symlinks
Product: glibc
Version: 2.3.5
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: gotom at debian dot or dot jp
ReportedBy: splite-glibc at sigint dot cs dot purdue dot edu
CC: glibc-bugs at sources dot redhat dot com,splite-glibc at
sigint dot cs dot purdue dot edu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://sources.redhat.com/bugzilla/show_bug.cgi?id=866
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.