GNU bug report logs - #29231
26.0.90; invald file name for symbolic files

Previous Next

Package: emacs;

Reported by: Vincent Zhang <vincent_chueng <at> hotmail.com>

Date: Thu, 9 Nov 2017 17:43:02 UTC

Severity: normal

Merged with 28865

Found in version 26.0.90

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Vincent Zhang <vincent_chueng <at> hotmail.com>, Alan Third <alan <at> idiocy.org>
Cc: 29231 <at> debbugs.gnu.org
Subject: bug#29231: 26.0.90; invald file name for symbolic files
Date: Sat, 11 Nov 2017 10:54:57 +0200
> From: Vincent Zhang <vincent_chueng <at> hotmail.com>
> CC: "29231 <at> debbugs.gnu.org" <29231 <at> debbugs.gnu.org>
> 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)
  {
    USE_SAFE_ALLOCA;
    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?




This bug report was last modified 7 years and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.