* bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error
@ 2024-05-30 6:24 Yuwei Tian
2024-05-30 6:46 ` Juri Linkov
2024-05-30 6:52 ` Eli Zaretskii
0 siblings, 2 replies; 3+ messages in thread
From: Yuwei Tian @ 2024-05-30 6:24 UTC (permalink / raw)
To: 71270
After commit 74f15ad72d937b309dafecba872bccd1a880181e, it will
encounter 'wrong-type-argument string nil' error when executing
dired-do-shell-command.
Here is the backtrace:
string-match("/" nil 0)
split-string(nil "/")
xdg-mime-apps(nil)
shell-command-guess-xdg(nil ("xxxxxxx"))
The shell-command-guess-xdg is being called in the chain of
shell-command-guess-functions. Here is the definition of
shell-command-guess-xdg function:
(defun shell-command-guess-xdg (commands files)
"Populate COMMANDS by XDG configuration for FILES."
(require 'xdg)
(let* ((xdg-mime (when (executable-find "xdg-mime")
(string-trim-right
(shell-command-to-string
(concat "xdg-mime query filetype "
(shell-quote-argument (car files)))))))
(xdg-mime-apps (unless (string-empty-p xdg-mime)
(xdg-mime-apps xdg-mime)))
(xdg-commands
(mapcar (lambda (desktop)
(setq desktop (xdg-desktop-read-file desktop))
(propertize
(replace-regexp-in-string
" .*" "" (gethash "Exec" desktop))
'name (gethash "Name" desktop)))
xdg-mime-apps)))
(append xdg-commands commands)))
xdg-mime will be nil if xdg-mime not found, string-empty-p returns
nil and xdg-mime-apps will be called with nil.
In GNU Emacs 30.0.50 (build 1, x86_64-apple-darwin23.5.0, NS
appkit-2487.60 Version 14.5 (Build 23F79)) of 2024-05-30 built on
fishtai0-mac.local
Windowing system distributor 'Apple', version 10.3.2487
System Description: macOS 14.5
Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-plus@30/30.0.50/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus@30/30.0.50 --with-xml2
--with-gnutls --without-compress-install --without-dbus
--without-imagemagick --with-modules --with-rsvg --with-webp --with-ns
--disable-ns-self-contained 'CFLAGS=-Os -w -pipe -march=westmere
-mmacosx-version-min=14
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
-DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT'
'CPPFLAGS=-I/usr/local/opt/icu4c/include
-I/usr/local/opt/sqlite/include -I/usr/local/opt/readline/include
-F/usr/local/Frameworks
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk'
'LDFLAGS=-L/usr/local/opt/icu4c/lib -L/usr/local/opt/sqlite/lib
-L/usr/local/opt/readline/lib -L/usr/local/lib -F/usr/local/Frameworks
-Wl,-headerpad_max_install_names
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk''
Configured features:
ACL GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS
PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP XIM ZLIB
Important settings:
value of $LC_CTYPE: UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8
Major mode: Debugger
Minor modes in effect:
winner-mode: t
recentf-mode: t
delete-selection-mode: t
auto-image-file-mode: t
server-mode: t
savehist-mode: t
global-so-long-mode: t
desktop-save-mode: t
which-key-mode: t
eldoc-in-minibuffer-mode: t
global-subword-mode: t
subword-mode: t
lisp-extra-font-lock-global-mode: t
auto-compile-on-load-mode: t
auto-compile-on-save-mode: t
yas-global-mode: t
yas-minor-mode: t
global-auto-revert-mode: t
save-place-mode: t
global-hl-line-mode: t
global-hl-todo-mode: t
electric-pair-mode: t
windmove-mode: t
override-global-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
minibuffer-regexp-mode: t
buffer-read-only: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
auto-save-visited-mode: t
Load-path shadows:
...
Features:
(... emacs)
Memory information:
((conses 16 705553 1556771) (symbols 48 73143 53) (strings 32 201452 108982)
(string-bytes 1 5941470) (vectors 16 82573) (vector-slots 8 880792 726985)
(floats 8 835 1609) (intervals 56 5527 1489) (buffers 992 20))
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error
2024-05-30 6:24 bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error Yuwei Tian
@ 2024-05-30 6:46 ` Juri Linkov
2024-05-30 6:52 ` Eli Zaretskii
1 sibling, 0 replies; 3+ messages in thread
From: Juri Linkov @ 2024-05-30 6:46 UTC (permalink / raw)
To: Yuwei Tian; +Cc: 71270
close 71270 30.0.50
thanks
> After commit 74f15ad72d937b309dafecba872bccd1a880181e, it will
> encounter 'wrong-type-argument string nil' error when executing
> dired-do-shell-command.
>
> Here is the backtrace:
>
> string-match("/" nil 0)
> split-string(nil "/")
> xdg-mime-apps(nil)
> shell-command-guess-xdg(nil ("xxxxxxx"))
>
> The shell-command-guess-xdg is being called in the chain of
> shell-command-guess-functions. Here is the definition of
> shell-command-guess-xdg function:
Thanks for the detailed analysis.
> xdg-mime will be nil if xdg-mime not found, string-empty-p returns
> nil and xdg-mime-apps will be called with nil.
I didn't expect that string-empty-p returns nil for nil
(maybe because I'm accustomed to programming languages
where "" and nil both are empty):
(string-empty-p "") => t
(string-empty-p nil) => nil
So now I added the explicit check for the nil value, and pushed the fix.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error
2024-05-30 6:24 bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error Yuwei Tian
2024-05-30 6:46 ` Juri Linkov
@ 2024-05-30 6:52 ` Eli Zaretskii
1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-05-30 6:52 UTC (permalink / raw)
To: Yuwei Tian, Juri Linkov; +Cc: 71270
> From: Yuwei Tian <fishtai0@gmail.com>
> Date: Thu, 30 May 2024 14:24:35 +0800
>
> After commit 74f15ad72d937b309dafecba872bccd1a880181e, it will
> encounter 'wrong-type-argument string nil' error when executing
> dired-do-shell-command.
>
> Here is the backtrace:
>
> string-match("/" nil 0)
> split-string(nil "/")
> xdg-mime-apps(nil)
> shell-command-guess-xdg(nil ("xxxxxxx"))
>
> The shell-command-guess-xdg is being called in the chain of
> shell-command-guess-functions. Here is the definition of
> shell-command-guess-xdg function:
>
> (defun shell-command-guess-xdg (commands files)
> "Populate COMMANDS by XDG configuration for FILES."
> (require 'xdg)
> (let* ((xdg-mime (when (executable-find "xdg-mime")
> (string-trim-right
> (shell-command-to-string
> (concat "xdg-mime query filetype "
> (shell-quote-argument (car files)))))))
> (xdg-mime-apps (unless (string-empty-p xdg-mime)
> (xdg-mime-apps xdg-mime)))
> (xdg-commands
> (mapcar (lambda (desktop)
> (setq desktop (xdg-desktop-read-file desktop))
> (propertize
> (replace-regexp-in-string
> " .*" "" (gethash "Exec" desktop))
> 'name (gethash "Name" desktop)))
> xdg-mime-apps)))
> (append xdg-commands commands)))
>
> xdg-mime will be nil if xdg-mime not found, string-empty-p returns
> nil and xdg-mime-apps will be called with nil.
Thanks, I'm adding Juri to this discussion.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-30 6:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-30 6:24 bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error Yuwei Tian
2024-05-30 6:46 ` Juri Linkov
2024-05-30 6:52 ` Eli Zaretskii
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).