public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/866] New: glob should match dangling symlinks
@ 2005-04-22 19:50 splite-glibc at sigint dot cs dot purdue dot edu
  2005-04-22 19:54 ` [Bug libc/866] " splite-glibc at sigint dot cs dot purdue dot edu
  2005-09-27  5:54 ` drepper at redhat dot com
  0 siblings, 2 replies; 8+ messages in thread
From: splite-glibc at sigint dot cs dot purdue dot edu @ 2005-04-22 19:50 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-27 22:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-866-131@http.sourceware.org/bugzilla/>
2012-05-08 11:25 ` [Bug libc/866] glob should match dangling symlinks pmatilai at laiskiainen dot org
2012-05-08 11:51 ` joseph at codesourcery dot com
2012-05-08 16:43 ` bugdal at aerifal dot cx
2012-05-15  9:06 ` mjw at redhat dot com
2012-09-27  4:43 ` glibc at tomlee dot co
2015-08-27 22:02 ` [Bug glob/866] " jsm28 at gcc dot gnu.org
2005-04-22 19:50 [Bug libc/866] New: " splite-glibc at sigint dot cs dot purdue dot edu
2005-04-22 19:54 ` [Bug libc/866] " splite-glibc at sigint dot cs dot purdue dot edu
2005-09-27  5:54 ` drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).