[PATCH 3/9] posix: Allow glob to match dangling symlinks [BZ #866]

Paul Eggert eggert@cs.ucla.edu
Mon Sep 11 17:38:00 GMT 2017


On 09/11/2017 10:25 AM, Zack Weinberg wrote:
>
> It should be enough to make a dummy call, e.g.
>
>   pglob->gl_lstat(".", &statbuf);
>

Unfortunately calling lstat is quite expensive on some (non-POSIX) 
platforms, even on the working directory. So we can't do the above in 
the Gnulib version. Besides, under the proposed patch glob is going to 
use gl_lstat instead of gl_stat in almost all cases, so the dummy call 
won't add much extra checking.

I suppose we could valid gl_stat instead, as gl_stat usage will become 
rare (used only if GLOB_MARK is also specified, just before returning 
results). But we don't have any code in the wild that is giving us 
invalid gl_stat pointers, so it wouldn't be that helpful to try to 
validate gl_stat either.



More information about the Libc-alpha mailing list