[Top][All Lists]

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

bug#29231: 26.0.90; invald file name for symbolic files

From: Eli Zaretskii
Subject: bug#29231: 26.0.90; invald file name for symbolic files
Date: Sat, 11 Nov 2017 10:54:57 +0200

> From: Vincent Zhang <address@hidden>
> CC: "address@hidden" <address@hidden>
> Date: Fri, 10 Nov 2017 10:10:38 +0000
> Steps:
> 1. Start GNU Emacs 26.0.90 GUI via `Emacs -Q' on macOS 10.13.1.
> 2. Create some symbolic files (e.g. ~/.zshrc -> ~/.dotfiles/.zshrc) in the 
> home folders.
> 3. Enable `ido-mode`, and `find-file` to open the symbolic files (~/.zshrc). 
> Results:
> `~/.zshrc/` is showed in minibuffer after pressing `TAB`, and Emacs treats it 
> as a folder and create a new
> one.
> In Emacs 25, only `~/.zshrc` is showed, and Emacs gives a prompt of opening a 
> symbolic file.
> Am I missing anything?

It's a macOS specific bug.

Alan, I think the problem might be in the macOS implementation of
faccessat, called here:

  /* Return true if in the directory FD the directory entry DP, whose
     string length is LEN, is that of a subdirectory that can be searched.  */
  static bool
  file_name_completion_dirp (int fd, struct dirent *dp, ptrdiff_t len)
    char *subdir_name = SAFE_ALLOCA (len + 2);
    memcpy (subdir_name, dp->d_name, len);
    strcpy (subdir_name + len, "/");
    bool dirp = faccessat (fd, subdir_name, F_OK, AT_EACCESS) == 0;
    SAFE_FREE ();
    return dirp;

This assumes that calling faccessat with an argument "foo/" will
return zero (i.e. succeed) only if "foo" is a directory, but will fail
(return non-zero) if it's a file.  I'm guessing that on macOS, this
call succeeds even for files, or maybe just for symlinks to files.
Could you (or someone else) please look into that?  I don't have
access to a macOS system.

Btw, does macOS have faccessat, or does it use the Gnulib replacement?

reply via email to

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