mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
Fix execution of MS-Windows app execution aliases in Eshell
* lisp/eshell/esh-ext.el (eshell-script-interpreter): Check for 0-size files (bug#71655).
This commit is contained in:
parent
fffab032b0
commit
130c3efa10
@ -301,7 +301,17 @@ Return nil, or a list of the form:
|
||||
(INTERPRETER [ARGS] FILE)"
|
||||
(let ((maxlen eshell-command-interpreter-max-length))
|
||||
(if (and (file-readable-p file)
|
||||
(file-regular-p file))
|
||||
(file-regular-p file)
|
||||
;; If the file is zero bytes, it can't possibly have a
|
||||
;; shebang. This check may seem redundant, but we can
|
||||
;; encounter files that Emacs considers both readable and
|
||||
;; regular, but which aren't *actually* readable. This can
|
||||
;; happen, for example, with certain kinds of reparse
|
||||
;; points like APPEXECLINK on NTFS filesystems (MS-Windows
|
||||
;; uses these for "app execution aliases"). In these
|
||||
;; cases, the file size is 0, so this check protects us
|
||||
;; from errors.
|
||||
(> (file-attribute-size (file-attributes file)) 0))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents-literally file nil 0 maxlen)
|
||||
(if (looking-at "#![ \t]*\\([^ \r\t\n]+\\)\\([ \t]+\\(.+\\)\\)?")
|
||||
|
Loading…
Reference in New Issue
Block a user