GNU bug report logs -
#71270
30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error
Previous Next
Reported by: Yuwei Tian <fishtai0 <at> gmail.com>
Date: Thu, 30 May 2024 06:26:01 UTC
Severity: normal
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71270 in the body.
You can then email your comments to 71270 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71270
; Package
emacs
.
(Thu, 30 May 2024 06:26:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yuwei Tian <fishtai0 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 30 May 2024 06:26:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <at> 30/30.0.50/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus <at> 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))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71270
; Package
emacs
.
(Thu, 30 May 2024 06:51:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 71270 <at> debbugs.gnu.org (full text, mbox):
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.
bug marked as fixed in version 30.0.50, send any further explanations to
71270 <at> debbugs.gnu.org and Yuwei Tian <fishtai0 <at> gmail.com>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Thu, 30 May 2024 06:51:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71270
; Package
emacs
.
(Thu, 30 May 2024 06:53:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 71270 <at> debbugs.gnu.org (full text, mbox):
> From: Yuwei Tian <fishtai0 <at> 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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 27 Jun 2024 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 356 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.