From: Christopher Miles <email@example.com> To: Maxim Nikulin <firstname.lastname@example.org> Cc: "email@example.com" <firstname.lastname@example.org> Subject: Re: [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file Date: Tue, 19 Jan 2021 01:53:47 +0000 [thread overview] Message-ID: <VI1PR1001MB10703E467731AA1558000F89A3A30@VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM> (raw) In-Reply-To: <email@example.com> [-- Attachment #1: Type: text/plain, Size: 3779 bytes --] Maxim, thanks for your detailed explanation. I confirmed the problem: #+begin_src emacs-lisp ;;; does not work (start-process-shell-command "xdg-open" nil "xdg-open /usr/share/icons/gnome/256x256/actions/stock_print.png") ;;; works fine (start-process-shell-command "feh" nil "feh /usr/share/icons/gnome/256x256/actions/stock_print.png") #+end_src For this problem, do you have any workable solution patch? Here is my =/etc/mailcap=, don't have =~/.mailcap=. #+begin_src conf ### ### Begin Red Hat Mailcap ### audio/*; /usr/bin/xdg-open %s image/*; /usr/bin/xdg-open %s application/msword; /usr/bin/xdg-open %s application/pdf; /usr/bin/xdg-open %s application/postscript ; /usr/bin/xdg-open %s text/html; /usr/bin/xdg-open %s ; copiousoutput #+end_src Maxim Nikulin <firstname.lastname@example.org> writes: > On 05/09/2020 14:52, Bastien wrote: >> >> stardiviner <email@example.com> writes: >> >>> When I press =[C-u C-u C-c C-o]= to open an image file link with system external >>> program. It can't open the image file. >> >> I cannot reproduce the problem here. >> >> If you still have this issue, can you provide a minimal reproducible >> example? > > Christopher Miles recently posted a link to askubuntu that shed some > light on the problem. > > I have compared the following commands: > > (start-process-shell-command "xdg-open" nil "xdg-open > /usr/share/icons/gnome/256x256/actions/stock_print.png") > (start-process-shell-command "eog" nil "eog > /usr/share/icons/gnome/256x256/actions/stock_print.png") > > The latter works in my (test) case (Ubuntu-20.04, ubuntu session - > gnome), the former does not. If I do not mistake, > start-process-shell-command is what org mode uses to open file. > > Meaningful lines from strace of the emacs process > > 24108 21:39:51 execve("/bin/bash", ["/bin/bash", "-c", "xdg-open > /usr/share/icons/gnome/"...], 0x7ffcb1c1fdb0 /* 55 vars */ <unfinished...> > 24116 21:39:51 execve("/usr/bin/eog", ["eog", > "/usr/share/icons/gnome/256x256/a"...], 0x55d009672ec8 /* 57 vars */ > <unfinished ...> > 24108 21:39:51 +++ exited with 0 +++ > 24116 21:39:51 +++ killed by SIGHUP +++ > > I think, the problem is that start-process-shell-command creates a "pty" > process. As soon as main command exits, all children, that belong to the > same terminal session created by emacs for the process, got killed. > > Calling eog directly works because of it does not attempt to go to > background or demonize. > > The solution could be (make-process :connection-type 'pipe ...). > Personally I would prefer to avoid shell as well when it is not really > necessary. > > I am surprised that in the discussion of problem related to desktop > integration and perhaps even order in which applications able to handle > particular file format were installed, nobody mentioned such details, > neither for "positive" nor for "negative" results. Probably output of > the following commands (for the proper mime type) could be relevant. The > complication is that there are several mime handler "databases". > > grep image/png /etc/mailcap ~/.mailcap > xdg-mime query default image/png > > (mailcap-parse-mailcaps) > (mailcap-mime-info "image/png") > > For some handlers there might be even a race, sometimes it might work > but might fail as well, depending if child could send a message to its > server quickly enough. In such case providing of ECM might be a challenge. -- [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-01-19 2:23 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-13 7:49 stardiviner 2020-06-13 14:51 ` Nicolas Goaziou 2020-06-14 9:08 ` stardiviner 2020-06-14 21:06 ` Nicolas Goaziou 2021-01-10 11:26 ` [BUG] [C-u C-u C-c C-o] open link with external program auto exited before child process " Christopher Miles [not found] ` <87sg799gnx.fsf@numbchild> 2021-01-10 12:13 ` Christopher Miles 2020-09-05 7:52 ` [BUG] [C-u C-u C-c C-o] open link with external program invalid to " Bastien 2021-01-18 16:32 ` Maxim Nikulin 2021-01-19 1:53 ` Christopher Miles [this message] 2021-01-19 17:00 ` Maxim Nikulin 2021-01-20 3:21 ` Christopher Miles 2021-01-20 16:27 ` Maxim Nikulin 2021-01-21 0:58 ` [PATCH] " Christopher Miles 2021-01-21 17:12 ` Maxim Nikulin 2021-01-22 6:00 ` Christopher Miles 2021-03-10 14:55 ` Maxim Nikulin 2021-03-11 9:33 ` Christopher Miles
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=VI1PR1001MB10703E467731AA1558000F89A3A30@VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.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).