bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/18] posix: Allow glob to match dangling symlinks [BZ #866]


From: Paul Eggert
Subject: Re: [PATCH 04/18] posix: Allow glob to match dangling symlinks [BZ #866]
Date: Thu, 31 Aug 2017 15:11:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

Thanks for working to clear up this longstanding problem in glibc glob. Here are the issues I found with the proposed patch:

* glob_in_dir calls gl_stat, which is a typo; it should call gl_lstat.

* The GLOB_MARK checks should use stat not lstat, since symlinks to directories should be marked.

* For GLOB_TILDE and GLOB_TILDE_CHECK, the revised code still tests for existence of the home directory as a directory. Other glob implementations merely expand the ~ or ~foo and treat the result as a literal string, and glibc should be consistent here.  This is simpler and avoids a stat call.

* __lstat64 needs to be defined in the !_LIBC case too.

* While looking into this I noticed that glob ignores directory entries with d_ino == 0. Although currently GNU/Linux cannot return such entries, POSIX allows d_ino == 0 so this assumption is not portable, and this bug is in the neighborhood so we might as well fix it in a separated patch (which simplifies the code).

* commit message says "remove tst-glob3" but the patch actually removes bug-glob1-ARGS.

I fixed these problems (except for the last one) while merging the patch into Gnulib, and this resulted in the attached patches which I installed into Gnulib master. I'll CC: this to bug-gnulib accordingly. Please consider merging the glibc-relevant parts of these patches back into glibc, for your next iteration of this glibc proposal. As always, the goal is for glob.c and related files to be identical in glibc and Gnulib.

Attachment: 0001-glob-simplify-symlink-detection.patch
Description: Text Data

Attachment: 0002-glob-backupfile-inode-0-is-a-valid-inode-number.patch
Description: Text Data

Attachment: 0003-glob-match-dangling-symlinks.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]