GNU bug report logs - #56013
28.1; "gio open" and "xdg-open" fail silently under eshell

Previous Next

Package: emacs;

Reported by: Jeff Kowalski <jeff.kowalski <at> gmail.com>

Date: Thu, 16 Jun 2022 06:27:02 UTC

Severity: normal

Merged with 75304

Found in versions 28.1, 29.4

Full log


Message #23 received at 56013 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 56013 <at> debbugs.gnu.org, Jeff Kowalski <jeff.kowalski <at> gmail.com>
Subject: Re: bug#56013: 28.1; "gio open" and "xdg-open" fail silently under
 eshell
Date: Fri, 17 Jun 2022 11:25:58 -0700
On 6/17/2022 10:17 AM, Jim Porter wrote:
> On 6/17/2022 4:59 AM, Lars Ingebrigtsen wrote:
>> Andreas Schwab <schwab <at> linux-m68k.org> 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.




This bug report was last modified 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.