From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeff Kowalski Newsgroups: gmane.emacs.bugs Subject: bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell Date: Sun, 20 Nov 2022 21:14:02 -0800 Message-ID: References: <87h74kes5l.fsf@gnus.org> <87czf88yre.fsf@igel.home> <87ilozbivd.fsf@gnus.org> <292942b6-4a7f-0002-2af4-210b32612ba1@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000052d58b05edf4204d" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15885"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56013@debbugs.gnu.org, Lars Ingebrigtsen , Andreas Schwab To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 21 10:03:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ox2hy-0003vc-25 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Nov 2022 10:03:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2hn-0004IL-V3; Mon, 21 Nov 2022 04:03:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2hl-0004Hm-SR for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 04:03:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ox2hj-0004T3-DK for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 04:03:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ox2hj-0001WB-9F for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 04:03:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jeff Kowalski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Nov 2022 09:03:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56013 X-GNU-PR-Package: emacs Original-Received: via spool by 56013-submit@debbugs.gnu.org id=B56013.16690213355741 (code B ref 56013); Mon, 21 Nov 2022 09:03:03 +0000 Original-Received: (at 56013) by debbugs.gnu.org; 21 Nov 2022 09:02:15 +0000 Original-Received: from localhost ([127.0.0.1]:45376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ox2gv-0001UQ-V3 for submit@debbugs.gnu.org; Mon, 21 Nov 2022 04:02:15 -0500 Original-Received: from mail-ua1-f49.google.com ([209.85.222.49]:41550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owz8N-0007vN-7o for 56013@debbugs.gnu.org; Mon, 21 Nov 2022 00:14:19 -0500 Original-Received: by mail-ua1-f49.google.com with SMTP id y18so3683392uae.8 for <56013@debbugs.gnu.org>; Sun, 20 Nov 2022 21:14:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hYEIhypKwOof+JQwlt/5vTH0lFjpU+zoryRwv9VTgg0=; b=kILXOO+tqv6N7J+r2ZMjStj3EnYQCk6+x1+3/vzrl0KJgpqh8/0sXMXR2aiQCR7r/t zyvYAhyKps7cAS5dgRv1MaX0Cr2Z7zUSzBIYl3bB6g1wnSdyl/ZvJLLI1MbAonNdSjF+ HW49U0FxCPxd3jAXyhJzeQZa1ZnDnamuVg8n8UN2MVMbVgfT9XNxRHFDEGWRCLT5JLFf K19kwgKf35B59gEVZZyLgxpEYwm7glMoVjsQ2RqVES+EkRSDKeZfhBZuYgmXiUaphGhn hXydNiiOqH9Wtne9T6AMXQdzXn4qrTOzaLvxrQCS2SJvIX5oG4y8dlBU60T+2H4djBYH /tEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hYEIhypKwOof+JQwlt/5vTH0lFjpU+zoryRwv9VTgg0=; b=n6GyVlE3CSV6iTx8NS6PomCct1hQxXFJa00VHaEZ4JD6vaoS2lQpe/cfpJeK8xWG9S KZM1UiHJtalrKHFY0Rfp1dKHFOS5mmyHqmNo8HLruoi6sWMcg7Cq2uZbvlsDV18aJ9J6 3YhT4NHTjrye+d7nbIz776m1z5Q87UdzPiO11mAyf0duBckIPypIYh/JZl2GQeuaItFw KbWUnZjUPRGn2Mk8/qi9oecxL7oQRhAfySUvN25S7mlpGYpWvIh2qaj2aPL+u1pPZYOn oew2PWh+3JnzOjxk2y9KQgDrXtUfEGus62bz34WBj9anbQHK87kBgTUjfEwAXrDG5hLy JbLg== X-Gm-Message-State: ANoB5pkT0rLbgZ2bVMzmCHaWW2i5B3nzf4QSg90iAYGwduAFOmAzDps5 hEwMlEWkAKYv6/sEyaeL8mXKPZS4qMIkeOYEAtI= X-Google-Smtp-Source: AA0mqf4II8Zb9uiEFAljRygwDjneeStOJgYF9tnu4ui6+9dX0cibAAe9t6BFst3sIb5Vy0Zm1oQXIw2iMiXbGJtI/48= X-Received: by 2002:ab0:4a05:0:b0:3df:5b51:4886 with SMTP id q5-20020ab04a05000000b003df5b514886mr8070769uae.115.1669007653654; Sun, 20 Nov 2022 21:14:13 -0800 (PST) In-Reply-To: <292942b6-4a7f-0002-2af4-210b32612ba1@gmail.com> X-Mailman-Approved-At: Mon, 21 Nov 2022 04:02:11 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248508 Archived-At: --00000000000052d58b05edf4204d Content-Type: text/plain; charset="UTF-8" While I cannot help to craft the solution (I'm limited by my knowledge of internals here), I'm very happy to help test proposals. It seemed there was a hint of a solution developed in this thread. On Fri, Jun 17, 2022 at 11:25 AM Jim Porter wrote: > On 6/17/2022 10:17 AM, Jim Porter wrote: > > On 6/17/2022 4:59 AM, Lars Ingebrigtsen wrote: > >> Andreas Schwab writes: > >> > >>> See bug#44824. > >> > >> Ah, right. The fix proposed there was: > >> > >> org.el: Avoid xdg-open silent failure > >> * lisp/org.el (org-open-file): Use 'pipe :connection-type instead > of > >> 'pty to prevent killing of background process on handler exit. > >> > >> Perhaps Jim has some comments here; added to the CCs. > > > > Yeah, this is an issue with how `start-file-process' is being called in > > Eshell (see `eshell-gather-process-output'). If I call `(setq > > process-connection-type nil)' before running gio in Eshell, it works > fine. > > Oh right... I remember looking at a related issue before. Note: I don't > think this will directly fix the issue in this bug, but it might affect > how we do fix this, so I'm mentioning it here. > > `eshell-needs-pipe-p' has a link to bug#1388, which discusses why that > function exists in the first place. Basically, if `eshell-needs-pipe-p' > didn't exist, then the following Eshell command wouldn't work right[1]: > > ~ $ *echo "1+1" | bc > > However, the solution isn't quite right if you think about it: while > it's true that bc's stdin should be a pipe, couldn't its stdout still be > a pty? The all-or-nothing nature of "pipe vs pty" seems a bit > over-restrictive. For example, this is (part of) why piping to `less' is > so broken in Eshell. If you remove "less" from `eshell-visual-commands', > you can see some of the issues. The following works ok, though you get > the "dumb terminal" interface for less: > > ~ $ less file.txt > > But this fails: > > ~ $ cat file.txt | less > Missing filename ("less --help" for help) > > I believe that's because `less' sees that stdin is a pty in that case > and so it expects a filename. However, adding `less' to > `eshell-needs-pipe' fails though because then `less' thinks stdout is a > pipe too, so you don't even get the dumb terminal UI; it just forwards > stdin to stdout unchanged. > > Fixing this would get rid of the current uses for `eshell-needs-pipe-p', > but then we'd probably want to keep it around in a slightly different > form in order to handle gio/xdg-open properly. What we do about the > issue described above would probably determine how the contents of > `eshell-needs-pipe' should be specified. > > [1] The "*" in that command is to use the real /bin/echo, since bc > expects a trailing newline and Eshell's built-in echo doesn't do that. > --00000000000052d58b05edf4204d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
While I cannot help to craft the solution (I'm limited= by my knowledge of internals here), I'm very happy to help test propos= als.=C2=A0 It seemed there was a hint of a solution developed in this threa= d.

On Fri, Jun 17, 2022 at 11:25 AM Jim Porter <jporterbugs@gmail.com> wrote:
On 6/17/2022 10:17 AM, Jim Porter wrot= e:
> On 6/17/2022 4:59 AM, Lars Ingebrigtsen wrote:
>> Andreas Schwab <schwab@linux-m68k.org> writes:
>>
>>> See bug#44824.
>>
>> Ah, right.=C2=A0 The fix proposed there was:
>>
>> =C2=A0=C2=A0=C2=A0=C2=A0 org.el: Avoid xdg-open silent failure
>> =C2=A0=C2=A0=C2=A0=C2=A0 * lisp/org.el (org-open-file): Use 'p= ipe :connection-type instead of
>> =C2=A0=C2=A0=C2=A0=C2=A0 'pty to prevent killing of background= process on handler exit.
>>
>> Perhaps Jim has some comments here; added to the CCs.
>
> Yeah, this is an issue with how `start-file-process' is being call= ed in
> Eshell (see `eshell-gather-process-output'). If I call `(setq
> process-connection-type nil)' before running gio in Eshell, it wor= ks fine.

Oh right... I remember looking at a related issue before. Note: I don't=
think this will directly fix the issue in this bug, but it might affect how we do fix this, so I'm mentioning it here.

`eshell-needs-pipe-p' has a link to bug#1388, which discusses why that =
function exists in the first place. Basically, if `eshell-needs-pipe-p'=
didn't exist, then the following Eshell command wouldn't work right= [1]:

=C2=A0 =C2=A0~ $ *echo "1+1" | bc

However, the solution isn't quite right if you think about it: while it's true that bc's stdin should be a pipe, couldn't its stdout= still be
a pty? The all-or-nothing nature of "pipe vs pty" seems a bit over-restrictive. For example, this is (part of) why piping to `less' i= s
so broken in Eshell. If you remove "less" from `eshell-visual-com= mands',
you can see some of the issues. The following works ok, though you get
the "dumb terminal" interface for less:

=C2=A0 =C2=A0~ $ less file.txt

But this fails:

=C2=A0 =C2=A0~ $ cat file.txt | less
=C2=A0 =C2=A0Missing filename ("less --help" for help)

I believe that's because `less' sees that stdin is a pty in that ca= se
and so it expects a filename. However, adding `less' to
`eshell-needs-pipe' fails though because then `less' thinks stdout = is a
pipe too, so you don't even get the dumb terminal UI; it just forwards =
stdin to stdout unchanged.

Fixing this would get rid of the current uses for `eshell-needs-pipe-p'= ,
but then we'd probably want to keep it around in a slightly different <= br> form in order to handle gio/xdg-open properly. What we do about the
issue described above would probably determine how the contents of
`eshell-needs-pipe' should be specified.

[1] The "*" in that command is to use the real /bin/echo, since b= c
expects a trailing newline and Eshell's built-in echo doesn't do th= at.
--00000000000052d58b05edf4204d--