From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KDKzATiUFmDKHAAA0tVLHw (envelope-from ) for ; Sun, 31 Jan 2021 11:27:52 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 3JztODeUFmBVDAAAbx9fmQ (envelope-from ) for ; Sun, 31 Jan 2021 11:27:51 +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 3CBA99403C8 for ; Sun, 31 Jan 2021 11:27:51 +0000 (UTC) Received: from localhost ([::1]:37748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6AtR-0000FQ-Mh for larch@yhetil.org; Sun, 31 Jan 2021 06:27:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6Ai2-0005iC-68; Sun, 31 Jan 2021 06:16:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:44942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l6Ai1-0007eT-Sv; Sun, 31 Jan 2021 06:16:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l6Ai1-00044I-Me; Sun, 31 Jan 2021 06:16:01 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#44824: 27.1; Org export as pdf and open file does not open it Resent-From: Maxim Nikulin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Sun, 31 Jan 2021 11:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44824 X-GNU-PR-Package: emacs,org-mode X-GNU-PR-Keywords: moreinfo To: 44824@debbugs.gnu.org Received: via spool by 44824-submit@debbugs.gnu.org id=B44824.161209174115604 (code B ref 44824); Sun, 31 Jan 2021 11:16:01 +0000 Received: (at 44824) by debbugs.gnu.org; 31 Jan 2021 11:15:41 +0000 Received: from localhost ([127.0.0.1]:56488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6Ahf-00043b-5M for submit@debbugs.gnu.org; Sun, 31 Jan 2021 06:15:40 -0500 Received: from mail-lj1-f182.google.com ([209.85.208.182]:44475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6Ahb-00043K-RV for 44824@debbugs.gnu.org; Sun, 31 Jan 2021 06:15:37 -0500 Received: by mail-lj1-f182.google.com with SMTP id f2so15892440ljp.11 for <44824@debbugs.gnu.org>; Sun, 31 Jan 2021 03:15:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3edpCpqKI7hnoT89KMr9wfnUnm4cDfXXBtQyhYtCaGg=; b=Vfq85Bzek9lOquYqpQNoQHY/fuQ6bLetp/bk51Giucv0Ee1ls53lcWHJ44OaoYMHT7 ghEcX8TGkrQRO0Pt52qFYWTukZWLAPym1zDZEXYcv9alkyji3CK7aXsPfmWd5M04yVId xA9ikpUnk9gmkJ4yv7p35LxVPaKkI3d/zDuGzytMiK8e5t7ukA22S3f8dyGXi2ztByTS j3PN4CM9jzcdIls9f27fUoPCgmPwidBf5KfOlyb98wD90H+xW6h3yQD8Y/7wmREQ0JE2 IqUdrg+nSMljmbBsUET3YExK86Dsb243UVY68LZNRYiWd4C9NfBSEDy7yVIXmi1BcL5A /QtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3edpCpqKI7hnoT89KMr9wfnUnm4cDfXXBtQyhYtCaGg=; b=czcZ48fKEnN4AJu27HOJKYpbfHsQIO9+fbf2giTcYdE9j/Z+q+JpMDw1g3n2pEEQTo rJhKyUowVa1EKkXRfVFr5VvNbJRfAb+bLGK8FVWTNZXxs3mh6I2QpTP7PkQbtF1vPEZ2 IxWHjUOqbNfLfD2Uvnvs4KjoDxp11ipUcaWcEOdtO2MXms/Jg46MOayd403AnOYvR6Vn X74bjNmdicujYm0wOP57QLy81cWFRcKOuR41HLMbBVZy5eH4lmFJ0BKlju7MBDjb65xF YhZe/nFdLcqCuDX9j9xnV7HGClrmoeW/EI+/6DDdq9h86Z/3evHn9NSZp87sTBc7qTxa jvfw== X-Gm-Message-State: AOAM5302X9nI5aep5OyXFudzCn8ES8Cb+0N8Uj3cz9QrjXx1Jh/MF1zf 45blIT4wCfHfFkKLsXFd4sE= X-Google-Smtp-Source: ABdhPJwhbIy6BD7hys+l8TYgbazPRN1KIgVb1hAbd2XIyE4QqKgJ2ITMJfgHvLpr6J6IIzlRXew9DQ== X-Received: by 2002:a2e:3307:: with SMTP id d7mr7312923ljc.155.1612091729644; Sun, 31 Jan 2021 03:15:29 -0800 (PST) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.181]) by smtp.googlemail.com with ESMTPSA id r2sm2646336lff.143.2021.01.31.03.15.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 Jan 2021 03:15:29 -0800 (PST) From: Maxim Nikulin X-Google-Original-From: Maxim Nikulin 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> Message-ID: Date: Sun, 31 Jan 2021 18:15:27 +0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <83lfca8k4e.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: emacs-orgmode@gnu.org List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eli Zaretskii , gbiotti@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.25 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Vfq85Bze; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 3CBA99403C8 X-Spam-Score: -1.25 X-Migadu-Scanner: scn1.migadu.com X-TUID: 7YBL9LlQxXM3 Bhavin, thank you very much for your clear report. I have tried once more with eshell session and this time I was lucky enough to reproduce the problem in both gnome and kde sessions on Ubuntu-20.04 focal On 30/01/2021 23:28, Eli Zaretskii wrote: >> From: Maxim Nikulin >> Date: Sat, 30 Jan 2021 22:58:06 +0700 >> >> The problem is that emacs does not expect that kde-open5 and thus >> xdg-open exits instantly. > > Why is that a problem, and how does it cause the invocation to fail, > i.e. not show the file in question? > >> The question could be addressed to KDE developers, but unlike the >> issue with temporary files, in my opinion, pty+SIGHUP problem should >> be fixed in org mode. > > What do you mean by "pty+SIGHUP problem" in this case? What exactly > is the problem? In the https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44824#22 message I have posted a link to another thread in emacs-orgmode mail list thread with my earlier strace results: https://lists.gnu.org/archive/html/emacs-orgmode/2021-01/msg00327.html Now I see that the problem with eshell is the same. I am not familiar with eshell, but it creates new shell process for every executed command. Actual handler is killed when underlying handler (kde-open5, "gio open") and thus xdg-open and the main shell process exit. Excerpts from strace obtained for a eshell buffer 2221 16:59:43.513366 execve("/bin/sh", ["/bin/sh", "/usr/bin/xdg-open", "/tmp/test.pdf"], 0x7fff74be7f10 /* 58 vars */ 2224 16:59:43.566865 execve("/usr/bin/gio", ["gio", "open", "/tmp/test.pdf"], 0x55ee8454ec18 /* 58 vars */) = 0 2229 16:59:43.711846 execve("/bin/sh", ["/bin/sh", "-e", "-u", "-c", "export GIO_LAUNCHED_DESKTOP_FILE_PID=$$; exec \"$@\"", "sh", "evince", "/tmp/test.pdf"], 0x55bb59e67bb0 /* 59 vars */ 2221 16:59:43.717489 +++ exited with 0 +++ 2229 16:59:43.719228 +++ killed by SIGHUP +++ Functions dealing with asynchronous processes in emacs, namely (start-process ...) and its siblings for shell commands calls (make-process :connection-type 'pty ...) that creates a pseudoterminal. It is redundant for applications that do not require an interactive terminal. When process (xdg-open this case) exits, pty is closed, all processes from the same terminal group receives SIGHUP. So actual handler is killed unless it has set signal handler or has detached from terminal session. To fix the problem it is better to use (make-process :connection-type 'pipe ...) that unfortunately has no higher level wrappers. "Pipe" process does not creates a pseudoterminal thus its children do not get SIGHUP on the exit of the main process. I am unsure concerning best values for other arguments however. The complication is that some mailcap entries have needsterminal flag, on the other hand they are likely irrelevant for GUI. There is no problem if okular or evince are called directly (without kde-open5 or "gio open" wrapper) since main process does not exit while window is open. Maybe the following command executed in eshell (namely eshell, not just shell) buffer is the best to demonstrate the problem (for those whose desktop environment is affected) sh -c "xdg-open /tmp/test.pdf; sleep 5" The window with file content appears for 5 seconds then the viewer is killed. On 31/01/2021 16:09, tomas@tuxteam.de wrote: > This chaotic behaviour gives me the impression that it's an > environment thing: desktop environments have the tendency to prime > the environment variables in "creative" ways, often different from > what a login shell would do. Certainly the behavior depends on the desktop environment. You could check which DE-specific handler is called (and factor-out xdg-open) with sh -x /usr/bin/xdg-open /tmp/test.pdf As to other options, M-! executes the process synchronously and is not affected. M-& has the same pty+SIGHUP problem. I am almost sure that I have tried eshell before, but I have no idea why I have not noticed the problem that time.