unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Vincent Zhang <vincent_chueng@hotmail.com>, Alan Third <alan@idiocy.org>
Cc: 29231@debbugs.gnu.org
Subject: bug#29231: 26.0.90; invald file name for symbolic files
Date: Sat, 11 Nov 2017 10:54:57 +0200	[thread overview]
Message-ID: <837euxp53y.fsf@gnu.org> (raw)
In-Reply-To: <MWHPR22MB0144E7426FDA54C11075FD0BEF540@MWHPR22MB0144.namprd22.prod.outlook.com> (message from Vincent Zhang on Fri, 10 Nov 2017 10:10:38 +0000)

> From: Vincent Zhang <vincent_chueng@hotmail.com>
> CC: "29231@debbugs.gnu.org" <29231@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?





  reply	other threads:[~2017-11-11  8:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 17:41 bug#29231: 26.0.90; invald file name for symbolic files Vincent Zhang
2017-11-09 20:17 ` Eli Zaretskii
2017-11-10  2:49   ` Vincent Zhang
2017-11-10  8:13     ` Eli Zaretskii
2017-11-10 10:10       ` Vincent Zhang
2017-11-11  8:54         ` Eli Zaretskii [this message]
2017-11-11 18:25           ` Alan Third
2017-11-11 19:00             ` Eli Zaretskii
2017-11-11 23:21             ` Paul Eggert
2017-11-12  7:19               ` Paul Eggert
2017-11-12 12:09                 ` Alan Third
2017-11-13  2:53                   ` Vincent Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=837euxp53y.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=29231@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=vincent_chueng@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).