From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UBx2LI7rL2DhSgAA0tVLHw (envelope-from ) for ; Fri, 19 Feb 2021 16:47:10 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id KK5bKI7rL2AmUQAA1q6Kng (envelope-from ) for ; Fri, 19 Feb 2021 16:47:10 +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 aspmx2.migadu.com (Postfix) with ESMTPS id 10A01BB96 for ; Fri, 19 Feb 2021 17:47:10 +0100 (CET) Received: from localhost ([::1]:50790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD8vr-0006f0-RN for larch@yhetil.org; Fri, 19 Feb 2021 11:47:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD8ut-0006eX-QD for emacs-orgmode@gnu.org; Fri, 19 Feb 2021 11:46:07 -0500 Received: from ciao.gmane.io ([116.202.254.214]:32960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD8uq-00046a-5t for emacs-orgmode@gnu.org; Fri, 19 Feb 2021 11:46:07 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lD8uo-00013B-CJ for emacs-orgmode@gnu.org; Fri, 19 Feb 2021 17:46:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Re: bug#44824: [PATCH] org.el: Avoid xdg-open silent failure Date: Fri, 19 Feb 2021 23:45:55 +0700 Message-ID: References: <87y2gfcape.fsf_-_@gnus.org> <87a6st7oi1.fsf@gnus.org> <108399a5-66ad-eee6-572b-b3f2181e4e6c@gmail.com> <87lfccxs5a.fsf@gnus.org> <875z3f2bwx.fsf@gnus.org> <838s8aak8j.fsf@gnu.org> <83sg6i8rht.fsf@gnu.org> <5f1a0018-56a4-7f00-68bc-eeb93631f102@gmail.com> <83lfca8k4e.fsf@gnu.org> <83y2g96ta6.fsf@gnu.org> <7635bde2-8590-f555-0d3b-7fa818d812c6@gmail.com> <83o8h56p7o.fsf__8661.17158891342$1612110869$gmane$org@gnu.org> <83a6s15t51.fsf__31631.6350990505$1613659778$gmane$org@gnu.org> <1a7077ea-c3ad-be6b-6303-f3ed225ec6f8@gmail.com> <83blcg2jn0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <83blcg2jn0.fsf@gnu.org> Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, NML_ADSP_CUSTOM_MED=0.9, 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: , Cc: 44824@debbugs.gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.77 Authentication-Results: aspmx2.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx2.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: 10A01BB96 X-Spam-Score: -1.77 X-Migadu-Scanner: scn1.migadu.com X-TUID: KThhcRncVbZa On 19/02/2021 21:54, Eli Zaretskii wrote: >> From: Maxim Nikulin >> Date: Fri, 19 Feb 2021 19:29:49 +0700 >> >>> On Windows Emacs always uses pipes, because we don't have PTYs there. >>> And there's no xdg-open on MS-Windows anyway, so it's a moot point. >> >> Should I consider your response as a suggestion to remove the `if' >> related to `system-type'? > > Yes, that 'if' isn't necessary. Let's wait for comments comments from org developers. I do not mind to remove the `if' but they could ask for other changes. >> If I remember correctly, on windows it is possible to communicate with a >> process through stdin and stdout only if the application is compiled as >> a *console* one. > > That's true. But in this case we don't really want to communicate > with the sub-process, do we? We just want to invoke it and let it > run. So the fact that there's no way of communicating with the > sub-process is not important here, as the pipes will not be used. We > just need to specify pipes because that works around the problem with > xdg-open. The reason to switch to pipe process here is to avoid side effects of *terminal session*. PTY is redundant here. Pipe process is the only alternative available in emacs. Currently there is no data exchange with subprocess. Reading of stderr and stdout from the handler and its descendants could be useful to realize a cause of a problem when it happens. At least on linux it is enough to specify some buffer instead of `nil' or add a :filter function. The reason why I did not make such change is that Gtk applications tends to report significant number of failed asserts. I do not like to pollute the "*Messages*" buffer. I am in doubts if a dedicated buffer should be created for such purpose. Reading of stdout could be useful in mailcap handlers e.g. to display text from PDF file when only text terminal is available (no X11 or wayland). Currently emacs ignores "needsterminal" and "copiousoutput" flags in mailcap. Example of an entry for PDF: application/pdf; pdftotext -layout %s -; test=test -z "$DISPLAY"; copiousoutput Likely only a small part of users could benefit from such feature. >> "start file.pdf" executed in cmd.exe launches an application that does >> not block command prompt. In this sense it similar to background >> processes launched by kde-open5 or "gio open". However I am unaware if >> there is something similar to process groups on windows that leads to >> termination of all group members when leader process finishes. > > Things are fairly similar on Windows. But is this really relevant to > the issue at hand? There's no xdg-open on Windows, so whatever > problems you had with xdg-open will never happen on Windows. the > proposed patch fixes the problem only on systems where org.el invokes > the PDF viewer via xdg-open. Right? 1. It is not a problem of namely xdg-open. It is (mostly reasonable but with some caveats however) specific of DE-specific handlers as "gio open" and kde-open5. They exit just after spawning of a process with actual handler. (Just like "start file.pdf" on windows.) I am afraid that I could break something on windows, so I would prefer that somebody will test the changes on non-linux systems. 2. It is not specific to PDF files, the problem could happen with any format if wrapper handler such as "gio open" is invoked instead of e.g. direct execution of eog.