Subject: Re: bug#31305: 27.0.50; Symlinks recognized as dirs

From: Paul Eggert <[email-masked]>
Date: Wed, 16 May 2018 18:42:19 -0700

One more thing. This reminds me of Bug#30350, so if this new bug still 
occurs under OS X 10.10 please try the attached patch. If this works 
around the OS X 10.10 bug I can polish it up and install it properly 
into Emacs. Thanks.
diff --git a/src/dired.c b/src/dired.c
index c446223a0b..ed12fce5f8 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -814,9 +814,9 @@ static bool
 file_name_completion_dirp (int fd, struct dirent *dp, ptrdiff_t len)
 {
   USE_SAFE_ALLOCA;
-  char *subdir_name = SAFE_ALLOCA (len + 2);
+  char *subdir_name = SAFE_ALLOCA (len + 4);
   memcpy (subdir_name, dp->d_name, len);
-  strcpy (subdir_name + len, "/");
+  strcpy (subdir_name + len, "/./");
   bool dirp = faccessat (fd, subdir_name, F_OK, AT_EACCESS) == 0;
   SAFE_FREE ();
   return dirp;