From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28349 invoked by alias); 22 Apr 2005 19:50:25 -0000 Mailing-List: contact glibc-bugs-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sources.redhat.com Received: (qmail 28330 invoked by uid 48); 22 Apr 2005 19:50:22 -0000 Date: Fri, 22 Apr 2005 19:50:00 -0000 From: "splite-glibc at sigint dot cs dot purdue dot edu" To: glibc-bugs@sources.redhat.com Message-ID: <20050422195020.866.splite-glibc@sigint.cs.purdue.edu> Reply-To: sourceware-bugzilla@sources.redhat.com Subject: [Bug libc/866] New: glob should match dangling symlinks X-Bugzilla-Reason: CC X-SW-Source: 2005-04/txt/msg00150.txt.bz2 List-Id: 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 #include 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.