From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AI26JgAM3mAauQAAgWs5BA (envelope-from ) for ; Thu, 01 Jul 2021 20:40:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wLNzIgAM3mCCQQAAB5/wlQ (envelope-from ) for ; Thu, 01 Jul 2021 18:40:00 +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 E6F5718982 for ; Thu, 1 Jul 2021 20:39:59 +0200 (CEST) Received: from localhost ([::1]:57746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lz1bR-00024X-7U for larch@yhetil.org; Thu, 01 Jul 2021 14:39:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lz1aY-0001iK-M3; Thu, 01 Jul 2021 14:39:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50380) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lz1aY-0007KK-EO; Thu, 01 Jul 2021 14:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lz1aY-0002Ga-5M; Thu, 01 Jul 2021 14:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#12972: [PATCH] Avoid regression in mailcap-view-file similar to Bug#44824 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Thu, 01 Jul 2021 18:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12972 X-GNU-PR-Package: emacs,org-mode X-GNU-PR-Keywords: To: Maxim Nikulin Received: via spool by 12972-submit@debbugs.gnu.org id=B12972.16251647058665 (code B ref 12972); Thu, 01 Jul 2021 18:39:02 +0000 Received: (at 12972) by debbugs.gnu.org; 1 Jul 2021 18:38:25 +0000 Received: from localhost ([127.0.0.1]:33693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lz1Zx-0002Fh-E6 for submit@debbugs.gnu.org; Thu, 01 Jul 2021 14:38:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lz1Zv-0002FU-IL for 12972@debbugs.gnu.org; Thu, 01 Jul 2021 14:38:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58114) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lz1Zq-0006uS-B9; Thu, 01 Jul 2021 14:38:18 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4078 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lz1Zq-0002Dg-01; Thu, 01 Jul 2021 14:38:18 -0400 Date: Thu, 01 Jul 2021 21:38:15 +0300 Message-Id: <835yxtlw14.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Maxim Nikulin on Fri, 2 Jul 2021 00:01:59 +0700) References: <87r1hmdqek.fsf__16088.3597027109$1622530682$gmane$org@gnus.org> 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: 12972@debbugs.gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625164800; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=jyCu4ivcEq9b0ULjBCXFWQCl1Lk9P5pqsDTClc7ibV0=; b=IaEaWgjLlZE17m/u07NnF+WeVFrl5DGU1avVVgA7rJ8ANDS9AiJUqxii8GC1xy12BeKD5L KjV7zrDniS4Nf6tJDaZrNfGlxGlJ74bKoLkQi45UuzoThVy/g5nWBd+aWGj3dXHIUuLjQP /cTJXy2dkAq3fX8hUo/A/tD81eWwt7Gi17yzd3aCehX5UWYVTl56LHqnJ0ZKxNvRfBWsJe MWb7ZY7h6fJL+8f8mVTdfGH4ra99VrEhmZgdZiltB4BTXKumxQqIJ0RjHdaFwEX26a6exB E7+JR1Ptb/s1bqHnNFLtQ2Wxt8OWE10um0E12FUi82aYPZEmbQGqWTmkiSfVsw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625164800; a=rsa-sha256; cv=none; b=Gxf+929PX7T9SMyvdCOv3z7Am3pk2JWt0qqLgnU5xpe/EHYiKfW1Pndd5pfasbS6rA+Obb v/sELPd505iV4FxPyv7dMG8TS0WwYtRPbiXtMaZgbKJdgV/1IecnJXRQuPgigMEZ/tqGQ4 gW8W8BWB623ubktLYWhFIb5lAATKB4eZvNKwTc4ULs4gXUXC092cCpAJaA/FLNCoI1Gd98 pZEbSjPbdxMxJBXpvzV8LUjaFgnZQ/DNw0AcfXYXoQ5ImFK9s4sJM7lfGq57D7VnJq/Sft zRZZui6+UD4mKx/0tfW71C1+/gcaU2RF3sGK6nr2T5O1t1KcUzZX0apjrsDs7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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: E6F5718982 X-Spam-Score: -2.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: sbtlMFKocmr0 > From: Maxim Nikulin > Date: Fri, 2 Jul 2021 00:01:59 +0700 > > --- a/lisp/net/mailcap.el > +++ b/lisp/net/mailcap.el > @@ -1177,7 +1177,23 @@ See \"~/.mailcap\", `mailcap-mime-data' and related files and variables." > (shell-quote-argument (convert-standard-filename file)) > command > nil t)) > - (start-process-shell-command command nil command))) > + ;; Handlers such as "gio open" and kde-open5 start viewer in background > + ;; and exit immediately. Avoid `start-process' since it assumes > + ;; :connection-type 'pty and kills children processes with SIGHUP > + ;; when temporary terminal session is finished (Bug#44824). > + ;; An alternative is `process-connection-type' let-bound to nil for > + ;; `start-process-shell-command' call (with no chance to report failure). > + (make-process > + :name "mailcap-view-file" :connection-type 'pipe :noquery t > + :buffer nil ; "*Messages*" may be suitable for debugging > + :sentinel (lambda (proc event) > + (when (and (memq (process-status proc) '(exit signal)) > + (/= (process-exit-status proc) 0)) > + (message > + "Command %s: %s." > + (mapconcat #'identity (process-command proc) " ") > + (substring event 0 -1)))) > + :command (list shell-file-name shell-command-switch command)))) I have two issues with this change: First, you replace start-process-shell-command with make-process, and I'm not sure I understand why. If all you want is to use pipes, why not simply bind process-connection-type around the call to start-process-shell-command? Does it not work for some reason? And second, I'm not sure we should make this change unconditionally. It isn't guaranteed that the handler will be one of those which have the problem, is it? And with other handlers, this could be an incompatible behavior change if the handler behaves differently when its standard handles are connected to a pipe rather than a terminal device. So I'd rather make this a conditional change, ideally only when one of the affected handlers is used (assuming we can detect that somehow). Thanks.