* bug#29231: 26.0.90; invald file name for symbolic files @ 2017-11-09 17:41 Vincent Zhang 2017-11-09 20:17 ` Eli Zaretskii 0 siblings, 1 reply; 12+ messages in thread From: Vincent Zhang @ 2017-11-09 17:41 UTC (permalink / raw) To: 29231 [-- Attachment #1: Type: text/plain, Size: 8631 bytes --] In Emacs 24 an 25, the symbolic file names are same as other files (e.g. '~/xxx), but in Emacs 26, the file name is '~/xxx/', thus 'ido' or 'ivy' handles files incorrectly. In fact, it will recognize it as a folder and create a new file. In GNU Emacs 26.0.90 (build 1, x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2017-10-12 built on builder10-9.local Windowing system distributor 'Apple', version 10.3.1561 Recent messages: Auto-saving...done Mark set Send this bug report to the Emacs maintainers? (y or n) y Sending... Mark set [2 times] Sending via mail... Quit mwheel-scroll: Beginning of buffer [3 times] C-c RET C-g is undefined Buffer *unsent mail to bug-gnu-emacs* modified; kill anyway? (y or n) y Configured using: 'configure --with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES Important settings: value of $LANG: en_CN.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: counsel-mode: t ivy-mode: t server-mode: t save-place-mode: t spaceline-info-mode: t smooth-scrolling-mode: t delete-selection-mode: t global-hl-line-mode: t show-paren-mode: t winner-mode: t window-numbering-mode: t popwin-mode: t eyebrowse-mode: t browse-url-dwim-mode: t global-emojify-mode: t emojify-mode: t dumb-jump-mode: t savehist-mode: t shell-dirtrack-mode: t global-aggressive-indent-mode: t aggressive-indent-mode: t drag-stuff-global-mode: t drag-stuff-mode: t global-hungry-delete-mode: t hungry-delete-mode: t ace-pinyin-global-mode: t ace-pinyin-mode: t global-anzu-mode: t anzu-mode: t global-undo-tree-mode: t undo-tree-mode: t company-quickhelp-mode: t company-quickhelp-local-mode: t global-company-mode: t company-mode: t yas-global-mode: t yas-minor-mode: t indent-guide-global-mode: t indent-guide-mode: t volatile-highlights-mode: t global-auto-revert-mode: t diff-hl-flydiff-mode: t global-diff-hl-mode: t which-key-mode: t projectile-rails-global-mode: t projectile-mode: t flycheck-pos-tip-mode: t global-flycheck-mode: t flycheck-mode: t diff-auto-refine-mode: t recentf-mode: t rainbow-mode: t elisp-slime-nav-mode: t display-line-numbers-mode: t goto-address-prog-mode: t subword-mode: t symbol-overlay-mode: t highlight-parentheses-mode: t rainbow-delimiters-mode: t fic-mode: t whitespace-mode: t editorconfig-mode: t electric-pair-mode: t persistent-scratch-autosave-mode: t desktop-save-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t global-prettify-symbols-mode: t prettify-symbols-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (network-stream starttls mailalias smtpmail shadow sort mail-extr emacsbug message rfc822 mml mml-sec epa epg mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail smex ivy-hydra bookmark pp company-c-headers counsel-projectile counsel esh-util swiper colir ivy flx ivy-overlay tide tide-lv typescript-mode ido cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs mwim time server saveplace spaceline-config spaceline-segments spaceline powerline powerline-separators powerline-themes cnfonts cnfonts-ui cus-edit cus-start cus-load smooth-scrolling delsel ace-link company-emoji company-emoji-list hl-line paren browse-kill-ring derived windmove winner window-numbering popwin eyebrowse browse-url-dwim string-utils list-utils rg emojify apropos tar-mode ht dumb-jump popup dockerfile-mode org-indent org-bullets org-rmail org-mhe org-irc org-info org-gnus gnus-util rmail rmail-loaddefs mail-utils org-docview doc-view jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m org-element avl-tree generator ob-ruby ob-python org org-macro org-footnote org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-china-x cal-china lunar solar cal-dst holidays hol-loaddefs cal-menu calendar cal-loaddefs view noutline outline conf-mode vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs diff-hl-dired dired-rainbow dired-hacks-utils dired-quick-sort savehist ls-lisp dired-x dired dired-loaddefs rspec-mode robe url-http tls gnutls url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm rmc puny ruby-refactor rubocop tramp tramp-compat tramp-loaddefs trampver shell pcomplete parse-time format-spec yard-mode company-go go-projectile go-rename go-guru go-eldoc imenu go-mode url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap find-file ffap sh-script executable aggressive-indent drag-stuff hungry-delete ace-pinyin pinyinlib anzu undo-tree company-oddmuse company-keywords company-etags company-gtags company-dabbrev-code company-dabbrev company-files company-capf company-cmake company-xcode company-clang company-semantic company-eclim company-template company-css company-nxml company-bbdb company-shell company-yasnippet company-robe company-quickhelp company pcase yasnippet indent-guide volatile-highlights autorevert filenotify diff-hl-flydiff diff diff-hl vc-dir ewoc vc vc-dispatcher which-key projectile-rails rake f s inflections inf-ruby ruby-mode smie projectile grep compile comint ibuf-ext ibuffer ibuffer-loaddefs avy-flycheck avy flycheck-pos-tip pos-tip flycheck json map find-func subr-x dash vc-git diff-mode open-junk-file recentf tree-widget wid-edit editorconfig-core editorconfig-core-handle editorconfig-fnmatch rainbow-mode ansi-color color elisp-slime-nav etags xref project display-line-numbers goto-addr cap-words superword subword symbol-overlay thingatpt highlight-parentheses rainbow-delimiters fic-mode whitespace editorconfig elec-pair persistent-scratch init-restore desktop frameset init-prog init-web init-ruby init-python init-go init-c init-emacs-lisp init-projectile init-flycheck init-vcs init-utils init-funcs init-org hydra ring lv init-eshell init-shell init-window init-kill-ring init-ibuffer init-highlight init-dired init-calendar init-yasnippet init-company init-ivy init-edit init-ui cl-extra help-mode spacemacs-dark-theme spacemacs-common init-basic exec-path-from-shell init-package use-package diminish bind-key easy-mmode finder-inf edmacro kmacro rx cl info advice package easymenu epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib init-custom init-const time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 758796 113848) (symbols 48 55898 7) (miscs 40 1913 3182) (strings 32 221355 16229) (string-bytes 1 5553603) (vectors 16 111170) (vector-slots 8 3520629 41305) (floats 8 1112 793) (intervals 56 18719 421) (buffers 992 72)) -- Best Regards, Vincent Zhang Best Regards, Vincent Zhang [-- Attachment #2: Type: text/html, Size: 17431 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 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 0 siblings, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2017-11-09 20:17 UTC (permalink / raw) To: Vincent Zhang; +Cc: 29231 > From: Vincent Zhang <vincent_chueng@hotmail.com> > Date: Thu, 9 Nov 2017 17:41:42 +0000 > > In Emacs 24 an 25, the symbolic file names are same as other files (e.g. > '~/xxx), but in Emacs 26, the file name is '~/xxx/', thus 'ido' or 'ivy' > handles files incorrectly. In fact, it will recognize it as a folder and > create a new file. Thanks, but please provide a minimal recipe to reproduce this, starting from "emacs -Q". This will allow us to investigate the issue. ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-09 20:17 ` Eli Zaretskii @ 2017-11-10 2:49 ` Vincent Zhang 2017-11-10 8:13 ` Eli Zaretskii 0 siblings, 1 reply; 12+ messages in thread From: Vincent Zhang @ 2017-11-10 2:49 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 29231@debbugs.gnu.org [-- Attachment #1: Type: text/plain, Size: 791 bytes --] I reproduced with "emacs -Q" with emacs 26.0.90 on macOS10.13.1. No issue on emacs 25.3.1. Thanks! Best Regards, Vincent Zhang -------- 原始邮件 -------- 主题:Re: bug#29231: 26.0.90; invald file name for symbolic files 发件人:Eli Zaretskii 收件人:Vincent Zhang 抄送:29231@debbugs.gnu.org > From: Vincent Zhang <vincent_chueng@hotmail.com> > Date: Thu, 9 Nov 2017 17:41:42 +0000 > > In Emacs 24 an 25, the symbolic file names are same as other files (e.g. > '~/xxx), but in Emacs 26, the file name is '~/xxx/', thus 'ido' or 'ivy' > handles files incorrectly. In fact, it will recognize it as a folder and > create a new file. Thanks, but please provide a minimal recipe to reproduce this, starting from "emacs -Q". This will allow us to investigate the issue. [-- Attachment #2: Type: text/html, Size: 1365 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-10 2:49 ` Vincent Zhang @ 2017-11-10 8:13 ` Eli Zaretskii 2017-11-10 10:10 ` Vincent Zhang 0 siblings, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2017-11-10 8:13 UTC (permalink / raw) To: Vincent Zhang; +Cc: 29231 > From: Vincent Zhang <vincent_chueng@hotmail.com> > CC: "29231@debbugs.gnu.org" <29231@debbugs.gnu.org> > Date: Fri, 10 Nov 2017 02:49:34 +0000 > > I reproduced with "emacs -Q" with emacs 26.0.90 on macOS10.13.1. No issue on emacs 25.3.1. Thanks! Great, so please tell how you reproduced this. That is, please describe step by step what you did, both inside Emacs and outside it, to reproduce the problem. Thanks. ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-10 8:13 ` Eli Zaretskii @ 2017-11-10 10:10 ` Vincent Zhang 2017-11-11 8:54 ` Eli Zaretskii 0 siblings, 1 reply; 12+ messages in thread From: Vincent Zhang @ 2017-11-10 10:10 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 29231@debbugs.gnu.org [-- Attachment #1: Type: text/plain, Size: 1155 bytes --] 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? Thanks! ________________________________ From: Eli Zaretskii <eliz@gnu.org> Sent: Friday, November 10, 2017 8:13 AM To: Vincent Zhang Cc: 29231@debbugs.gnu.org Subject: Re: bug#29231: 26.0.90; invald file name for symbolic files > From: Vincent Zhang <vincent_chueng@hotmail.com> > CC: "29231@debbugs.gnu.org" <29231@debbugs.gnu.org> > Date: Fri, 10 Nov 2017 02:49:34 +0000 > > I reproduced with "emacs -Q" with emacs 26.0.90 on macOS10.13.1. No issue on emacs 25.3.1. Thanks! Great, so please tell how you reproduced this. That is, please describe step by step what you did, both inside Emacs and outside it, to reproduce the problem. Thanks. [-- Attachment #2: Type: text/html, Size: 4918 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-10 10:10 ` Vincent Zhang @ 2017-11-11 8:54 ` Eli Zaretskii 2017-11-11 18:25 ` Alan Third 0 siblings, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2017-11-11 8:54 UTC (permalink / raw) To: Vincent Zhang, Alan Third; +Cc: 29231 > 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? ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-11 8:54 ` Eli Zaretskii @ 2017-11-11 18:25 ` Alan Third 2017-11-11 19:00 ` Eli Zaretskii 2017-11-11 23:21 ` Paul Eggert 0 siblings, 2 replies; 12+ messages in thread From: Alan Third @ 2017-11-11 18:25 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Vincent Zhang, Paul Eggert, 29231 On Sat, Nov 11, 2017 at 10:54:57AM +0200, Eli Zaretskii wrote: > 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. Only with symlinks faccessat returns success if it’s pointing to a file and you put ‘/’ on the end. It looks like perhaps adding / to the end ‘resolves’ symlinks: breton:/Users/alan>ls -l cows -rw-r--r-- 1 alan staff 0 11 Nov 17:33 cows breton:/Users/alan>ls cows/ ls: cows/: Not a directory breton:/Users/alan>ln -s cows moo breton:/Users/alan>ls -l moo lrwxr-xr-x 1 alan staff 4 11 Nov 18:14 moo -> cows breton:/Users/alan>ls -l moo/ -rw-r--r-- 1 alan staff 0 11 Nov 17:33 moo/ > Btw, does macOS have faccessat, or does it use the Gnulib replacement? macOS does have faccessat. I’m not sure what the fix should be here. The commit introducing this bug is: commit 3a8d0cc825635e07da2a90c4ac987b476fc9b05d (HEAD -> emacs-26) Author: Paul Eggert <eggert@cs.ucla.edu> Date: Mon Jul 31 12:31:02 2017 -0700 Avoid most stat calls when completing file names * admin/merge-gnulib (GNULIB_MODULES): Add d-type. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * m4/d-type.m4: New file, copied from gnulib. * src/dired.c (DT_UNKNOWN, DT_DIR, DT_LINK) [!HAVE_STRUCT_DIRENT_D_TYPE]: New constants. (dirent_type): New function. (file_name_completion): Use it, to avoid unnecessary calls to stat-like functions on GNU/Linux and other platforms with d_type. (file_name_completion_stat): Just follow the link; there is no need to try first with AT_SYMLINK_NOFOLLOW since the directory entry was already checked to exist. Perhaps revert to the old behaviour for Darwin OS? -- Alan Third ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-11 18:25 ` Alan Third @ 2017-11-11 19:00 ` Eli Zaretskii 2017-11-11 23:21 ` Paul Eggert 1 sibling, 0 replies; 12+ messages in thread From: Eli Zaretskii @ 2017-11-11 19:00 UTC (permalink / raw) To: Alan Third; +Cc: vincent_chueng, eggert, 29231 > Date: Sat, 11 Nov 2017 18:25:20 +0000 > From: Alan Third <alan@idiocy.org> > Cc: Vincent Zhang <vincent_chueng@hotmail.com>, 29231@debbugs.gnu.org, > Paul Eggert <eggert@cs.ucla.edu> > > Only with symlinks faccessat returns success if it’s pointing to a > file and you put ‘/’ on the end. It looks like perhaps adding / to the > end ‘resolves’ symlinks: > [...] > Perhaps revert to the old behaviour for Darwin OS? Yes, if no better ideas come up, we should revert to calling 'stat' on Darwin, IMO. ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 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 1 sibling, 1 reply; 12+ messages in thread From: Paul Eggert @ 2017-11-11 23:21 UTC (permalink / raw) To: Alan Third, Eli Zaretskii; +Cc: Vincent Zhang, 29231 Alan Third wrote: > Only with symlinks faccessat returns success if it’s pointing to a > file and you put ‘/’ on the end. This is a well-known problem on macOS, and Emacs is supposed to compile a replacement fstatat function by building lib/fstatat.o and linking to that, and this replacement is supposed to implement the POSIX-required behavior where a trailing / works only on directories (or symlinks to directories, if following symlinks). Evidently this replacement procedure is not working somehow. Please tell us whether the executable contains an fstatat workaround. You can do that via something like this: $ gdb src/temacs (gdb) disas rpl_fstatat and I'd like to see the output of the 'disas' command. Also, what are the values of the following macros in src/config.h? (The values on GNU/Linux are as shown.) #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 #define HAVE_FSTATAT 1 /* #undef HAVE_WORKING_FSTATAT_ZERO_FLAG */ ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-11 23:21 ` Paul Eggert @ 2017-11-12 7:19 ` Paul Eggert 2017-11-12 12:09 ` Alan Third 0 siblings, 1 reply; 12+ messages in thread From: Paul Eggert @ 2017-11-12 7:19 UTC (permalink / raw) To: Alan Third, Eli Zaretskii; +Cc: Vincent Zhang, 29231 [-- Attachment #1: Type: text/plain, Size: 670 bytes --] Paul Eggert wrote: > Alan Third wrote: >> Only with symlinks faccessat returns success if it’s pointing to a >> file and you put ‘/’ on the end. > > This is a well-known problem on macOS, and Emacs is supposed to compile a > replacement fstatat function Whoops, you were writing about faccessat whereas I was thinking about fstatat. Please ignore my previous email, and sorry about the confusion. Apparently macOS faccessat has a problem similar to fstatat. Gnulib did not work around the faccessat problem, so I wrote and installed a fix for this into Gnulib and installed the attached patch into the emacs-26 branch. Please give it a try. [-- Attachment #2: 0001-Merge-from-Gnulib.txt --] [-- Type: text/plain, Size: 11625 bytes --] From 7775c4729814431608c943643a490ad5f1f68a99 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Sat, 11 Nov 2017 23:11:03 -0800 Subject: [PATCH] Merge from Gnulib This incorporates: 2017-11-11 faccessat: port to macOS (Bug#29231) 2017-11-05 fstatat: pacify GCC on unusual platform * build-aux/config.guess, build-aux/config.sub: * doc/misc/texinfo.tex, lib/faccessat.c, lib/fstatat.c: * lib/unistd.in.h, m4/faccessat.m4, m4/unistd_h.m4: Copy from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. --- build-aux/config.guess | 9 +++++--- build-aux/config.sub | 5 ++--- doc/misc/texinfo.tex | 4 +++- lib/faccessat.c | 60 ++++++++++++++++++++++++++++++++++++++++++++------ lib/fstatat.c | 2 +- lib/gnulib.mk.in | 2 ++ lib/unistd.in.h | 16 ++++++++++++-- m4/faccessat.m4 | 6 +++-- m4/gnulib-comp.m4 | 10 ++++----- m4/unistd_h.m4 | 3 ++- 10 files changed, 92 insertions(+), 25 deletions(-) diff --git a/build-aux/config.guess b/build-aux/config.guess index 2773ac4..31e01ef 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-11-01' +timestamp='2017-11-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ usage= Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -244,6 +244,9 @@ UNAME_VERSION= UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} exit ;; + *:MidnightBSD:*:*) + echo ${UNAME_MACHINE}-unknown-midnightbsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -479,7 +482,7 @@ UNAME_VERSION= #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-risco0s%ssysv\\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); diff --git a/build-aux/config.sub b/build-aux/config.sub index bbad4c4..fb57947 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-11-01' +timestamp='2017-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ usage= Canonicalize a configuration name. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -313,7 +313,6 @@ maybe_os= | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ - | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 9bd75b9..022c3f5 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2017-09-16.10} +\def\texinfoversion{2017-09-11.18} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -11425,9 +11425,11 @@ % \dimen0 = #1\relax \advance\dimen0 by \voffset + \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page % \dimen2 = \hsize \advance\dimen2 by \normaloffset + \advance\dimen2 by 1in % reference point is 1 inch from left edge of page % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% diff --git a/lib/faccessat.c b/lib/faccessat.c index 6cf9c99..fa92358 100644 --- a/lib/faccessat.c +++ b/lib/faccessat.c @@ -16,10 +16,31 @@ /* written by Eric Blake */ +/* If the user's config.h happens to include <unistd.h>, let it include only + the system's <unistd.h> here, so that orig_faccessat doesn't recurse to + rpl_faccessat. */ +#define _GL_INCLUDING_UNISTD_H #include <config.h> #include <unistd.h> +#include <errno.h> #include <fcntl.h> +#include <string.h> +#include <sys/stat.h> +#undef _GL_INCLUDING_UNISTD_H + +#if HAVE_FACCESSAT +static int +orig_faccessat (int fd, char const *name, int mode, int flag) +{ + return faccessat (fd, name, mode, flag); +} +#endif + +/* Write "unistd.h" here, not <unistd.h>, otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include <unistd.h> + above. */ +#include "unistd.h" #ifndef HAVE_ACCESS /* Mingw lacks access, but it also lacks real vs. effective ids, so @@ -28,6 +49,29 @@ # define access euidaccess #endif +#if HAVE_FACCESSAT + +int +rpl_faccessat (int fd, char const *file, int mode, int flag) +{ + int result = orig_faccessat (fd, file, mode, flag); + + if (result == 0 && file[strlen (file) - 1] == '/') + { + struct stat st; + result = fstatat (fd, file, &st, 0); + if (result == 0 && !S_ISDIR (st.st_mode)) + { + errno = ENOTDIR; + return -1; + } + } + + return result; +} + +#else /* !HAVE_FACCESSAT */ + /* Invoke access or euidaccess on file, FILE, using mode MODE, in the directory open on descriptor FD. If possible, do it without changing the working directory. Otherwise, resort to using save_cwd/fchdir, then @@ -36,10 +80,12 @@ Note that this implementation only supports AT_EACCESS, although some native versions also support AT_SYMLINK_NOFOLLOW. */ -#define AT_FUNC_NAME faccessat -#define AT_FUNC_F1 euidaccess -#define AT_FUNC_F2 access -#define AT_FUNC_USE_F1_COND AT_EACCESS -#define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag -#define AT_FUNC_POST_FILE_ARGS , mode -#include "at-func.c" +# define AT_FUNC_NAME faccessat +# define AT_FUNC_F1 euidaccess +# define AT_FUNC_F2 access +# define AT_FUNC_USE_F1_COND AT_EACCESS +# define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag +# define AT_FUNC_POST_FILE_ARGS , mode +# include "at-func.c" + +#endif diff --git a/lib/fstatat.c b/lib/fstatat.c index 67e48d9..294861f 100644 --- a/lib/fstatat.c +++ b/lib/fstatat.c @@ -28,7 +28,7 @@ #include <sys/stat.h> #undef __need_system_sys_stat_h -#if HAVE_FSTATAT +#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG static int orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) { diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 0f795b3..c510a0e 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -689,6 +689,7 @@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ +REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ @@ -2986,6 +2987,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index ca8090a..9144783 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -461,13 +461,25 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " #if @GNULIB_FACCESSAT@ -# if !@HAVE_FACCESSAT@ +# if @REPLACE_FACCESSAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef faccessat +# define faccessat rpl_faccessat +# endif +_GL_FUNCDECL_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag)); +# else +# if !@HAVE_FACCESSAT@ _GL_FUNCDECL_SYS (faccessat, int, (int fd, char const *file, int mode, int flag) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (faccessat, int, (int fd, char const *file, int mode, int flag)); +# endif _GL_CXXALIASWARN (faccessat); #elif defined GNULIB_POSIXCHECK # undef faccessat diff --git a/m4/faccessat.m4 b/m4/faccessat.m4 index 837ae54..f4cb49d 100644 --- a/m4/faccessat.m4 +++ b/m4/faccessat.m4 @@ -1,4 +1,4 @@ -# serial 6 +# serial 7 # See if we need to provide faccessat replacement. dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. @@ -18,10 +18,12 @@ AC_DEFUN AC_CHECK_FUNCS_ONCE([faccessat]) if test $ac_cv_func_faccessat = no; then HAVE_FACCESSAT=0 + elif test "$gl_cv_func_lstat_dereferences_slashed_symlink" != yes; then + REPLACE_FACCESSAT=1 fi ]) -# Prerequisites of lib/faccessat.m4. +# Prerequisites of lib/faccessat.c. AC_DEFUN([gl_PREREQ_FACCESSAT], [ AC_CHECK_FUNCS([access]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index c551752..13459f9 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -222,7 +222,7 @@ AC_DEFUN gl_STRING_MODULE_INDICATOR([explicit_bzero]) AC_REQUIRE([gl_EXTERN_INLINE]) gl_FUNC_FACCESSAT - if test $HAVE_FACCESSAT = 0; then + if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then AC_LIBOBJ([faccessat]) gl_PREREQ_FACCESSAT fi @@ -593,16 +593,16 @@ AC_DEFUN gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true fi } - if test $HAVE_FACCESSAT = 0; then + if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b fi - if test $HAVE_FACCESSAT = 0; then + if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then func_gl_gnulib_m4code_dosname fi - if test $HAVE_FACCESSAT = 0; then + if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then func_gl_gnulib_m4code_euidaccess fi - if test $HAVE_FACCESSAT = 0; then + if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7 fi if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index cc44677..60e7ea4 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 70 +# unistd_h.m4 serial 71 dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -159,6 +159,7 @@ AC_DEFUN REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) + REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) -- 2.7.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-12 7:19 ` Paul Eggert @ 2017-11-12 12:09 ` Alan Third 2017-11-13 2:53 ` Vincent Zhang 0 siblings, 1 reply; 12+ messages in thread From: Alan Third @ 2017-11-12 12:09 UTC (permalink / raw) To: Paul Eggert; +Cc: Vincent Zhang, 29231-done On Sat, Nov 11, 2017 at 11:19:05PM -0800, Paul Eggert wrote: > Apparently macOS faccessat has a problem similar to fstatat. Gnulib did not > work around the faccessat problem, so I wrote and installed a fix for this > into Gnulib and installed the attached patch into the emacs-26 branch. > Please give it a try. This fixes the problem for me. Thanks, Paul! -- Alan Third ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#29231: 26.0.90; invald file name for symbolic files 2017-11-12 12:09 ` Alan Third @ 2017-11-13 2:53 ` Vincent Zhang 0 siblings, 0 replies; 12+ messages in thread From: Vincent Zhang @ 2017-11-13 2:53 UTC (permalink / raw) To: Alan Third, Paul Eggert; +Cc: 29231-done@debbugs.gnu.org [-- Attachment #1: Type: text/plain, Size: 725 bytes --] Thanks for fixing it, guys! ________________________________ From: Alan Third <athird@googlemail.com> on behalf of Alan Third <alan@idiocy.org> Sent: Sunday, November 12, 2017 12:09 PM To: Paul Eggert Cc: Eli Zaretskii; Vincent Zhang; 29231-done@debbugs.gnu.org Subject: Re: bug#29231: 26.0.90; invald file name for symbolic files On Sat, Nov 11, 2017 at 11:19:05PM -0800, Paul Eggert wrote: > Apparently macOS faccessat has a problem similar to fstatat. Gnulib did not > work around the faccessat problem, so I wrote and installed a fix for this > into Gnulib and installed the attached patch into the emacs-26 branch. > Please give it a try. This fixes the problem for me. Thanks, Paul! -- Alan Third [-- Attachment #2: Type: text/html, Size: 1461 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-11-13 2:53 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.