On 2015-02-20 Friday at 20:02 -0500 James McCoy wrote:
> On Fri, Feb 20, 2015 at 10:52:51PM +0100, Bram Moolenaar wrote:
> >
> > James McCoy wrote:
> >
> > > On Thu, Feb 19, 2015 at 08:38:02PM -0500, Charles E Campbell wrote:
> > > > If after the ln -s file1 file2, one then types
> > > > touch file1
> > > > ls
> > > > then both file1 and file2 appear. Glob("*") should in that case show
> > > > file1
> > > > and file2. There must be some information gathering that fails on the
> > > > missing file1 that stops f_glob() from showing file2.
> > >
> > > Right. It's a difference in using stat(2) vs. lstat(2). The attached
> > > patch uses lstat() instead of mch_getperm() to determine whether the
> > > file should be considered.
> diff --git a/src/misc1.c b/src/misc1.c
> index 707abf8..4cd759c 100644
> --- a/src/misc1.c
> +++ b/src/misc1.c
> @@ -10168,11 +10168,12 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
> }
> else
> {
> + struct stat sb;
> /* no more wildcards, check if there is a match */
> /* remove backslashes for the remaining components only */
> if (*path_end != NUL)
> backslash_halve(buf + len + 1);
> - if (mch_getperm(buf) >= 0) /* add existing file */
> + if (mch_lstat(buf, &sb) >= 0) /* add existing file */
> {
> #ifdef MACOS_CONVERT
> size_t precomp_len = STRLEN(buf)+1;
> @@ -10928,9 +10929,10 @@ addfile(gap, f, flags)
> {
> char_u *p;
> int isdir;
> + struct stat sb;
>
> /* if the file/dir doesn't exist, may not add it */
> - if (!(flags & EW_NOTFOUND) && mch_getperm(f) < 0)
> + if (!(flags & EW_NOTFOUND) && mch_lstat(f, &sb) < 0)
> return;
>
> #ifdef FNAME_ILLEGAL
:help glob()
> A name for a non-existing file is not included. A symbolic
> link is only included if it points to an existing file.
If implementation will change, documentation should change accordingly.
--- runtime/doc/eval.txt~
+++ runtime/doc/eval.txt
@@ -3649,7 +3649,7 @@ glob({expr} [, {nosuf} [, {list}]])
*
If the expansion fails, the result is an empty String or List.
A name for a non-existing file is not included. A symbolic
- link is only included if it points to an existing file.
+ link is always included, even if it points to a not existing
file.
For most systems backticks can be used to get files names from
any external command. Example: >
--
Roland Eggner
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
pgpOj04uo3IGs.pgp
Description: PGP signature
