diff options
author | Po Lu <luangruo@yahoo.com> | 2024-07-08 15:43:55 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2024-07-08 15:43:55 +0800 |
commit | ce56f939affe8147f4172aa030058029a3c7922b (patch) | |
tree | 46c4b4ed882ed35187d1de60b2634e91eab16aad /lisp/eshell | |
parent | 8e1a43890da53a387c31950f11c3d2dbb7a70614 (diff) | |
parent | 67f291ddae31cc4623fd93280b141ee8611f3f5a (diff) |
Merge from savannah/emacs-30
67f291ddae3 Correct conditions for iconification on Android
130c3efa108 Fix execution of MS-Windows app execution aliases in Eshell
fffab032b05 Improve 'tab-line-tabs-fixed-window-buffers' sorting perf...
Diffstat (limited to 'lisp/eshell')
-rw-r--r-- | lisp/eshell/esh-ext.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 3c4deb32601..cf93d2904da 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el @@ -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]+\\(.+\\)\\)?") |