From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SCLHI5ZCBmDQAQAA0tVLHw (envelope-from ) for ; Tue, 19 Jan 2021 02:23:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QKSSH5ZCBmBGXgAA1q6Kng (envelope-from ) for ; Tue, 19 Jan 2021 02:23:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D5F5194021E for ; Tue, 19 Jan 2021 02:23:17 +0000 (UTC) Received: from localhost ([::1]:39900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1gfq-0004uc-Sy for larch@yhetil.org; Mon, 18 Jan 2021 21:23:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1gf2-0004uR-9m for emacs-orgmode@gnu.org; Mon, 18 Jan 2021 21:22:24 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:43893) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1gf0-0001RV-GX for emacs-orgmode@gnu.org; Mon, 18 Jan 2021 21:22:23 -0500 Received: by mail-ed1-x536.google.com with SMTP id n6so4638808edt.10 for ; Mon, 18 Jan 2021 18:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:reply-to:accept-language:content-language :mime-version; bh=BN8S5g7njueErIpKmJo6iZDa7R5MhgZb/PCeU5rutao=; b=lQuaQKL9pgQyv+PXKUEY3XamE574YnptbY2H/YrubrQCe5dteoFH6NJKWb0CI7KgmJ rocgiMwzYIQIyAMNH9vYvqUvcYdYdwElNJenzEghDJ59iyfLky9FyDaCTYCz4qNa+xos IG+ErjU5de1HvGNDO1s8+CxSzyiQyaq6vgttQjY9pr3NfjJGrUyU9EcwYX4uRubiuMQ8 4P/Soy1fOklskP7ybHZ3FzPKex5uAlQ8fCEFvQaA4CiiaKGkNKTgonuhnZiGDl4IOX5x 8byLfspYeenu3cEkhi2C069hruaEmkjSf7KGjChx+LQbn6lETtQhGvekK2JCSGk/WQEv Fs/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:thread-topic:thread-index :date:message-id:references:in-reply-to:reply-to:accept-language :content-language:mime-version; bh=BN8S5g7njueErIpKmJo6iZDa7R5MhgZb/PCeU5rutao=; b=FwDfBobVSimEc+qER2mbYsFs4LU43vhSL5s3QZShNNgaeruLJ2aG5cIWiaR8SvRP/x iMGs4zr9xqWmWtYBljCcjXsu0knpylkE0sWVbI+rHAL0/xqLOReOYU81B0tRAPIWGNHY 31/ctUEsMcfqpE58B5Dd4eRsMkGXLClrsDhzAFx3ci5xv0KIpdG/NGRldwYtS5S16Ql0 gAm/rgENCzQhs6eTWM91n6pbU/tnuVbJtj+f3tAh96l+1/T0FmXkedmRONG2rU8YSEgB ezDI3Y81N5owsG9z1aegY6kfEQEvOrNKegPbzBEOvltdGLycyq0arK7pQyHEGtlzjtLQ X7pg== X-Gm-Message-State: AOAM530D7hMhj4uWIPm8eRqhOkLNDsElqbndRUyqTlhrEZABi2v3iaci CIKqiEIaX0zVgjDEtjnrsA== X-Google-Smtp-Source: ABdhPJwcrMz/zvgyworCAka2Gn/HH6h4/YpLXB8O2mkXRaz32/ogT4CiJ+CkT6SX8+Ygxt+uE75biw== X-Received: by 2002:a05:6402:34c3:: with SMTP id w3mr1707225edc.3.1611022940557; Mon, 18 Jan 2021 18:22:20 -0800 (PST) Received: from VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM ([2603:1026:300:5a::5]) by smtp.gmail.com with ESMTPSA id di28sm4581875edb.71.2021.01.18.18.22.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2021 18:22:19 -0800 (PST) Received: from dark (183.246.145.54) by HK2PR02CA0183.apcprd02.prod.outlook.com (2603:1096:201:21::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10 via Frontend Transport; Tue, 19 Jan 2021 01:53:46 +0000 From: Christopher Miles To: Maxim Nikulin Subject: Re: [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file Thread-Topic: [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file Thread-Index: AQHW1caRExHu/lvlJkaB4JwUrG5MzKouXvEA X-MS-Exchange-MessageSentRepresentingType: 1 Date: Tue, 19 Jan 2021 01:53:47 +0000 Message-ID: References: <87ftazz9q0.fsf@gmail.com> <87lfho7ja2.fsf@gnu.org> In-Reply-To: Accept-Language: zh-TW, en-US Content-Language: en-US X-MS-Exchange-Organization-AuthAs: Internal X-MS-Exchange-Organization-AuthMechanism: 06 X-MS-Exchange-Organization-AuthSource: VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM X-MS-Has-Attach: yes X-MS-Exchange-Organization-Network-Message-Id: a290997f-d1bf-4448-95f9-08d8bc1d0f7e X-MS-Exchange-Organization-SCL: -1 X-MS-TNEF-Correlator: X-MS-Exchange-Organization-RecordReviewCfmType: 0 x-clientproxiedby: HK2PR02CA0183.apcprd02.prod.outlook.com (2603:1096:201:21::19) To VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:69::18) Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=numbchild@gmail.com; helo=mail-ed1-x536.google.com X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, GAPPY_SUBJECT=0.1, PDS_BAD_THREAD_QP_64=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Christopher Miles Cc: "emacs-orgmode@gnu.org" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.65 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=lQuaQKL9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: D5F5194021E X-Spam-Score: -2.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4YDkn78tpTJI --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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/gnom= e/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 =3D/etc/mailcap=3D, don't have =3D~/.mailcap=3D. #+begin_src conf ###=20 ### 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 writes: > On 05/09/2020 14:52, Bastien wrote: >>=20 >> stardiviner writes: >>=20 >>> When I press =3D[C-u C-u C-c C-o]=3D to open an image file link with sy= stem external >>> program. It can't open the image file. >>=20 >> I cannot reproduce the problem here. >>=20 >> If you still have this issue, can you provide a minimal reproducible >> example? > > Christopher Miles recently posted a link to askubuntu that shed some=20 > light on the problem. > > I have compared the following commands: > > (start-process-shell-command "xdg-open" nil "xdg-open=20 > /usr/share/icons/gnome/256x256/actions/stock_print.png") > (start-process-shell-command "eog" nil "eog=20 > /usr/share/icons/gnome/256x256/actions/stock_print.png") > > The latter works in my (test) case (Ubuntu-20.04, ubuntu session -=20 > gnome), the former does not. If I do not mistake,=20 > 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=20 > /usr/share/icons/gnome/"...], 0x7ffcb1c1fdb0 /* 55 vars */ > 24116 21:39:51 execve("/usr/bin/eog", ["eog",=20 > "/usr/share/icons/gnome/256x256/a"...], 0x55d009672ec8 /* 57 vars */=20 > > 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"= =20 > process. As soon as main command exits, all children, that belong to the= =20 > same terminal session created by emacs for the process, got killed. > > Calling eog directly works because of it does not attempt to go to=20 > background or demonize. > > The solution could be (make-process :connection-type 'pipe ...).=20 > Personally I would prefer to avoid shell as well when it is not really=20 > necessary. > > I am surprised that in the discussion of problem related to desktop=20 > integration and perhaps even order in which applications able to handle=20 > particular file format were installed, nobody mentioned such details,=20 > neither for "positive" nor for "negative" results. Probably output of=20 > the following commands (for the proper mime type) could be relevant. The= =20 > 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=20 > but might fail as well, depending if child could send a message to its=20 > server quickly enough. In such case providing of ECM might be a challenge. =2D-=20 [ 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 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmAGO6MACgkQG13xyVro msOSlggAjDv1yq6LL68GoJVQpzGJOeOUi3gWvXRYWqM0ZI7h5u3+AT1nXAFPMIfA GOs+LXJOQNmkv329pSceuYm/bYc4VKmbvDKlke1LSEX3jV+PHOzSq+JTGtGVolrc FlHsonidjmzMhaj12eRVkkRab6uEE5yW9z7RZlcRscbiq3ztWy+OFa8kVPnmwmYs WCRfkB9VlxkFVO+UHc3H6w2pQEPu9Ifty40KJbzEBmUJs63QRDhfF/GvAY+horoO zhDvDqEm6HX/cHAs1pKk9BwqwD01BXEN2LgtFbuxmRlzjlRmh6n/s9mCvs7+qUuN gqTC0sV5xlvFTR74L/yqxTS0q8SD7Q== =Mup/ -----END PGP SIGNATURE----- --=-=-=--