Subject: Re: bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error

From: Juri Linkov <[email-masked]>
Date: Thu, 30 May 2024 09:46:17 +0300

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.