unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
@ 2022-06-16  3:18 Jeff Kowalski
  2022-06-16 11:58 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Kowalski @ 2022-06-16  3:18 UTC (permalink / raw)
  To: 56013

[-- Attachment #1: Type: text/plain, Size: 15900 bytes --]

Setup:
$ echo "Hello, world!" > /tmp/hello.txt

Normal behavior:
$ gnome-terminal
;; now within terminal
$ gio open /tmp/hello.txt
;; GOOD RESULT - file is opened in app, as described by mime type. On my
system, app is 'Xed'

Emacs behavior:
$ emacs -Q
;; now in emacs
M-x eshell
;; now in eshell buffer
$ gio open /tmp/hello.txt
;; BAD RESULT - nothing happens, app not opened, silent failure, nothing
in message buffer
$ xdg-open /tmp/hello.txt
;; BAD RESULT - nothing happens, app not opened, silent failure, nothing
in message buffer

I've tried making my $ENV identical between normal terminal and eshell,
but I get the same results.

Thanks for your help,
Jeff Kowalski
---------

In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
cairo version 1.16.0)
 of 2022-05-30 built on lcy02-amd64-022
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Linux Mint 20.3

Configured using:
 'configure --build=x86_64-linux-gnu --prefix=/usr
 '--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
 '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
 --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu'
 '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
 --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.1/site-lisp:/usr/share/emacs/site-lisp
 --program-suffix=28 --with-modules --with-file-notification=inotify
 --with-mailutils --with-harfbuzz --with-json --with-zlib --with-x=yes
 --with-x-toolkit=gtk3 --with-lcms2 --with-cairo --with-xpm=yes
 --with-gif=yes --with-gnutls=yes --with-jpeg=yes --with-png=yes
 --with-tiff=yes --with-xwidgets 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs28-jmphgn/emacs28-28.1~1.git5a223c7f2e=.
-fstack-protector-strong
 -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro
 -no-pie''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Info

Minor modes in effect:
  minions-mode: t
  doom-modeline-mode: t
  dimmer-mode: t
  auto-dim-other-buffers-mode: t
  global-atomic-chrome-edit-mode: t
  org-super-agenda-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  global-rbenv-mode: t
  counsel-mode: t
  eshell-vterm-mode: t
  eshell-syntax-highlighting-global-mode: t
  cua-mode: t
  display-time-mode: t
  which-key-mode: t
  override-global-mode: t
  global-flycheck-mode: t
  global-hl-todo-mode: t
  which-function-mode: t
  key-chord-mode: t
  global-company-mode: t
  company-mode: t
  ivy-mode: t
  erc-truncate-mode: t
  erc-track-mode: t
  erc-spelling-mode: t
  editorconfig-mode: t
  global-diff-hl-mode: t
  winner-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-anzu-mode: t
  anzu-mode: t
  projectile-mode: t
  volatile-highlights-mode: t
  global-hl-line-mode: t
  super-save-mode: t
  windmove-mode: t
  recentf-mode: t
  savehist-mode: t
  save-place-mode: t
  show-smartparens-global-mode: t
  global-auto-revert-mode: t
  delete-selection-mode: t
  prelude-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/jeff/.emacs.d/elpa/git-modes-20220422.1611/gitignore-mode hides
/home/jeff/.emacs.d/elpa/gitignore-mode-20210528.1856/gitignore-mode
/home/jeff/.emacs.d/elpa/el-get-20211224.959/el-get-install hides
/home/jeff/.emacs.d/elpa/load-relative-20201130.2202/el-get-install
/home/jeff/.emacs.d/el-get/emacs-web-server/web-server-status-codes hides
/home/jeff/.emacs.d/elpa/web-server-20210708.2242/web-server-status-codes
/home/jeff/.emacs.d/el-get/emacs-web-server/web-server hides
/home/jeff/.emacs.d/elpa/web-server-20210708.2242/web-server
/home/jeff/.emacs.d/elpa/cmake-mode-20220322.1258/cmake-mode hides
/usr/share/emacs/site-lisp/cmake-mode
/home/jeff/.emacs.d/elpa/clang-format-20191121.1708/clang-format hides
/usr/share/emacs/site-lisp/clang-format/clang-format
/home/jeff/.emacs.d/elpa/transient-20220527.2213/transient hides
/usr/share/emacs/28.1/lisp/transient
/home/jeff/.emacs.d/el-get/flymake/flymake hides
/usr/share/emacs/28.1/lisp/progmodes/flymake

Features:
(shadow sort mail-extr emacsbug sendmail goto-addr esh-autosuggest
em-unix em-script em-prompt em-ls em-hist em-pred em-glob em-cmpl
em-dirs esh-var em-basic em-banner diary-lib diary-loaddefs cal-iso
org-duration ffap ol-eww eww url-queue mm-url ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect gnus-search eieio-opt speedbar ezimage dframe
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku
svg gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range
gnus-win gnus nnheader ol-docview ol-bibtex ol-bbdb ol-w3m ol-doi
org-link-doi origami origami-parsers solarized-gruvbox-dark-theme
solarized-palettes rainbow-mode rainbow-delimiters elisp-slime-nav
personal mule-util company-ispell company-anaconda anaconda-mode
pythonic minions doom-modeline doom-modeline-segments doom-modeline-env
doom-modeline-core all-the-icons all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons
data-alltheicons solarized-theme solarized solarized-faces dimmer
auto-dim-other-buffers hydra atomic-chrome websocket bindat let-alist
shackle trace org-ehtml org-ehtml-server ox-ehtml org-ehtml-util ox-org
org-lint org-attach org-id org-protocol org-clock org-super-agenda ts
htmlize org-habit ox-odt ox-latex ox-icalendar org-agenda ox-html table
ox-ascii ox-publish ox org-indent ob-gnuplot ob-latex ob-dot ob-ruby
ob-python ob-shell ace-window magit-bookmark magit-submodule
magit-obsolete magit-popup magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
git-commit log-edit message rfc822 mml mml-sec epa gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mailabbrev mail-utils gmm-utils
mailheader add-log magit-core magit-autorevert magit-margin
magit-transient magit-process with-editor server magit-mode transient
magit-git magit-base magit-section crm compat-27 compat-26
platformio-mode async irony-eldoc irony-completion irony-snippet
flycheck-irony irony-diagnostics irony irony-iotask realgud-byebug
realgud:byebug-track-mode realgud:byebug-init realgud:byebug-core
realgud-pry realgud:pry-track-mode realgud:pry-init realgud:pry-core
realgud realgud-lang-java realgud-zshdb realgud:zshdb-track-mode
realgud:zshdb-core realgud:zshdb-init realgud-trepan3k
realgud:trepan3k-track-mode realgud:trepan3k-core realgud:trepan3k-init
realgud-trepan2 realgud:trepan2-track-mode realgud:trepan2-core
realgud:trepan2-init realgud-trepanpl realgud:trepanpl-track-mode
realgud:trepanpl-core realgud:trepanpl-init realgud-trepanjs
realgud:trepanjs-track-mode realgud:trepanjs-core realgud:trepanjs-init
realgud-lang-js realgud-trepan realgud:trepan-track-mode
realgud:trepan-core realgud:trepan-init realgud-remake
realgud:remake-track-mode realgud:remake-core realgud:remake-init
realgud-rdebug realgud-rdebug-track-mode realgud-rdebug-core
realgud-rdebug-init realgud-lang-ruby realgud-perldb
realgud:perldb-track-mode realgud:perldb-core realgud:perldb-init
realgud-lang-perl realgud-pdb realgud:pdb-track-mode realgud:pdb-core
realgud:pdb-init realgud-lang-python python-el-fgallina-expansions
smartparens-python python tramp-sh realgud-kshdb
realgud:kshdb-track-mode realgud:kshdb-core realgud:kshdb-init
realgud-gub realgud:gub-track-mode realgud:gub-core realgud:gub-init
realgud-gdb realgud:gdb-track-mode realgud:gdb-init realgud:gdb-core
realgud-bashdb realgud:bashdb-track-mode realgud:bashdb-core
realgud:bashdb-init realgud-lang-posix-shell realgud:run
realgud-locals-mode realgud-breakpoint-mode realgud-backtrack-mode
realgud-track-mode realgud-backtrace-mode realgud-track realgud-init
realgud-file realgud-attach realgud-shortkey realgud-menu realgud-eval
realgud-cmds realgud-core realgud-reset realgud-bp realgud-bp-image-data
realgud-lang realgud-send realgud-window realgud-buffer-helper
realgud-buffer-breakpoint realgud-buffer-backtrace realgud-locals
realgud-buffer-locals realgud-utils realgud-buffer-command
realgud-buffer-info realgud-regexp realgud-lochist realgud-loc
realgud-buffer-source realgud-key realgud-custom key realgud-follow
loc-changes realgud-fringe realgud-helper load-relative inf-ruby rbenv
ruby-tools ruby-mode-expansions smartparens-ruby ruby-mode counsel xdg
swiper smex ido cmake-mode smartparens-rst rst eshell-vterm em-term
vterm face-remap term ehelp vterm-module term/xterm xterm em-smart
eshell-syntax-highlighting em-alias esh-mode shrink-path fish-mode
flycheck-plantuml plantuml-mode xml ob-plantuml graphviz-dot-mode
doc-view jka-compr image-mode exif cperl-mode-expansions cperl-mode
cua-base package-utils time ccls ccls-member-hierarchy
ccls-inheritance-hierarchy ccls-call-hierarchy ccls-tree ccls-code-lens
ccls-semantic-highlight ccls-common lsp-mode lsp-protocol spinner
network-stream puny nsm rmc smartparens-markdown markdown-mode lv f
f-shortdoc shortdoc epg rfc6068 epg-config which-key lpr
use-package-chords bind-chord equake buffer-focus-hook
org-capture-pop-frame org-capture org-refile web-server mm-encode
web-server-content-types web-server-status-codes eshell-git-prompt s
org-cua-dwim org-expiry el-get el-get-autoloading el-get-list-packages
el-get-dependencies el-get-build el-get-status el-get-methods
el-get-fossil el-get-svn el-get-pacman el-get-github-zip
el-get-github-tar el-get-http-zip el-get-http-tar el-get-hg el-get-go
el-get-git-svn el-get-fink el-get-emacswiki el-get-http el-get-notify
el-get-emacsmirror el-get-github el-get-git el-get-elpa el-get-darcs
el-get-cvs el-get-bzr el-get-brew el-get-builtin el-get-apt-get
el-get-recipes el-get-byte-compile el-get-custom el-get-core autoload
radix-tree validate req-package view req-package-cycles req-package-args
req-package-hooks ht inline log4e use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
use-package-core prelude-yaml prelude-xml nxml-mode-expansions rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap html-mode-expansions
sgml-mode facemenu dom nxml-util nxml-enc xmltok prelude-web
web-mode-expansions smartparens-html web-mode disp-table prelude-shell
sh-script smie executable prelude-ruby prelude-python prelude-perl
prelude-org the-org-mode-expansions org-element avl-tree smartparens-org
org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote
org-src ob-comint org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic
bibtex ol org-keys oc org-compat org-macs org-loaddefs cal-menu calendar
cal-loaddefs prelude-js js2-mode-expansions js2-mode js-mode-expansions
smartparens-javascript js cc-mode-expansions smartparens-c cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs prelude-emacs-lisp prelude-lisp prelude-c prelude-programming
flycheck find-func hl-todo compat compat-macs which-func
prelude-key-chord key-chord prelude-company company-oddmuse
company-keywords make-mode company-etags company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company prelude-ivy two-column ivy ivy-faces ivy-overlay
colir color prelude-erc erc-truncate erc-track erc-match erc-autoaway
erc-spelling erc-notify erc-networks erc-log erc-goodies erc erc-backend
erc-loaddefs prelude-linux exec-path-from-shell
prelude-global-keybindings warnings prelude-editor editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch
operate-on-number calc-bin calc-ext calc calc-loaddefs calc-macs diff-hl
smartrep log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode
winner undo-tree diff queue eshell esh-cmd esh-ext esh-opt esh-proc
esh-io esh-arg esh-module esh-groups esh-util re-builder whitespace
tabify browse-kill-ring derived midnight ediff ediff-merg ediff-mult
ediff-wind ediff-diff ediff-help ediff-init ediff-util dired-x dired
dired-loaddefs anzu avy projectile lisp-mnt mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr grep compile ibuf-ext ibuffer
ibuffer-loaddefs bookmark text-property-search expand-region
text-mode-expansions er-basic-expansions expand-region-core
expand-region-custom flyspell ispell rect etags fileloop generator xref
project volatile-highlights hl-line super-save windmove recentf
tree-widget savehist saveplace diminish smartparens-config
smartparens-text smartparens advice dash autorevert filenotify delsel
prelude-mode edmacro kmacro crux easy-mmode pcase tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete comint
ansi-color ring parse-time iso8601 time-date ls-lisp format-spec
thingatpt imenu-anywhere imenu prelude-core epl prelude-ui zenburn-theme
prelude-custom prelude-packages cl-extra help-mode finder-inf preload
cus-edit pp cus-load wid-edit ede/auto eieio-base tex-site rx
realgud-recursive-autoloads cl info package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 2427653 696067)
 (symbols 48 85570 62)
 (strings 32 379359 114192)
 (string-bytes 1 10987724)
 (vectors 16 131074)
 (vector-slots 8 2422995 586466)
 (floats 8 1318 2569)
 (intervals 56 140887 10141)
 (buffers 992 28))

[-- Attachment #2: Type: text/html, Size: 17078 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-06-16  3:18 bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell Jeff Kowalski
@ 2022-06-16 11:58 ` Lars Ingebrigtsen
  2022-06-16 14:22   ` Andreas Schwab
  2022-06-16 14:32   ` Andreas Schwab
  0 siblings, 2 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-16 11:58 UTC (permalink / raw)
  To: Jeff Kowalski; +Cc: 56013

Jeff Kowalski <jeff.kowalski@gmail.com> writes:

> Emacs behavior:
> $ emacs -Q
> ;; now in emacs
> M-x eshell
> ;; now in eshell buffer
> $ gio open /tmp/hello.txt
> ;; BAD RESULT - nothing happens, app not opened, silent failure, nothing
> in message buffer
> $ xdg-open /tmp/hello.txt
> ;; BAD RESULT - nothing happens, app not opened, silent failure, nothing
> in message buffer

[...]

> In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo
> version 1.16.0)
>  of 2022-05-30 built on lcy02-amd64-022
> Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
> System Description: Linux Mint 20.3

I'm unable to reproduce this problem (Debian/bookworm, Gnome Shell), but
I vaguely remember other reports about xdg-open not working in some
circumstances -- I don't remember the details.  Anybody else remember?

Hm...  was it something to do with timing and the weird way that
xdg-open works?  Hm, no, don't remember.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-06-16 11:58 ` Lars Ingebrigtsen
@ 2022-06-16 14:22   ` Andreas Schwab
  2022-06-16 14:32   ` Andreas Schwab
  1 sibling, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2022-06-16 14:22 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56013, Jeff Kowalski

On Jun 16 2022, Lars Ingebrigtsen wrote:

> Hm...  was it something to do with timing and the weird way that
> xdg-open works?

It's how it backgrounds itself, and how eshell spawns a new session for
each command.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-06-16 11:58 ` Lars Ingebrigtsen
  2022-06-16 14:22   ` Andreas Schwab
@ 2022-06-16 14:32   ` Andreas Schwab
  2022-06-17 11:59     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2022-06-16 14:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56013, Jeff Kowalski

See bug#44824.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-06-16 14:32   ` Andreas Schwab
@ 2022-06-17 11:59     ` Lars Ingebrigtsen
  2022-06-17 17:17       ` Jim Porter
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-17 11:59 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Jim Porter, 56013, Jeff Kowalski

Andreas Schwab <schwab@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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-06-17 11:59     ` Lars Ingebrigtsen
@ 2022-06-17 17:17       ` Jim Porter
  2022-06-17 18:25         ` Jim Porter
  0 siblings, 1 reply; 12+ messages in thread
From: Jim Porter @ 2022-06-17 17:17 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Andreas Schwab; +Cc: 56013, Jeff Kowalski

On 6/17/2022 4:59 AM, Lars Ingebrigtsen wrote:
> Andreas Schwab <schwab@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.

There's *almost* an existing Eshell function that would solve this: 
`eshell-needs-pipe-p'. Currently, it only returns t if certain programs 
are being piped *to*, but we could enhance that to allow specifying that 
some programs need a "pipe" (i.e. for `process-connection-type' to be 
nil) all the time. Then we'd just need to add gio and xdg-open to 
`eshell-needs-pipe' (which should probably be a defcustom while we're 
there).





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-06-17 17:17       ` Jim Porter
@ 2022-06-17 18:25         ` Jim Porter
  2022-11-21  5:14           ` Jeff Kowalski
  0 siblings, 1 reply; 12+ messages in thread
From: Jim Porter @ 2022-06-17 18:25 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Andreas Schwab; +Cc: 56013, Jeff Kowalski

On 6/17/2022 10:17 AM, Jim Porter wrote:
> On 6/17/2022 4:59 AM, Lars Ingebrigtsen wrote:
>> Andreas Schwab <schwab@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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-06-17 18:25         ` Jim Porter
@ 2022-11-21  5:14           ` Jeff Kowalski
  2022-11-22 20:19             ` Jim Porter
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Kowalski @ 2022-11-21  5:14 UTC (permalink / raw)
  To: Jim Porter; +Cc: 56013, Lars Ingebrigtsen, Andreas Schwab

[-- Attachment #1: Type: text/plain, Size: 2830 bytes --]

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 <jporterbugs@gmail.com> wrote:

> On 6/17/2022 10:17 AM, Jim Porter wrote:
> > On 6/17/2022 4:59 AM, Lars Ingebrigtsen wrote:
> >> Andreas Schwab <schwab@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.
>

[-- Attachment #2: Type: text/html, Size: 3659 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-11-21  5:14           ` Jeff Kowalski
@ 2022-11-22 20:19             ` Jim Porter
  2022-11-22 21:00               ` Jeff Kowalski
  0 siblings, 1 reply; 12+ messages in thread
From: Jim Porter @ 2022-11-22 20:19 UTC (permalink / raw)
  To: Jeff Kowalski; +Cc: Andreas Schwab, Lars Ingebrigtsen, 56013

On 11/20/2022 9:14 PM, Jeff Kowalski wrote:
> 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.

This is a hacky workaround, but if it works for you, it would help prove 
a strategy to fix this:

   ~ $ cat | xdg-open file.txt | cat

The above forces 'xdg-open' to be run with pipes for its stdin and 
stdout. I believe the issue is that when 'xdg-open' sees a PTY for 
stdin/stdout, it seems to assume that the PTY will live for a long time; 
however, in Eshell, it will close the PTY as soon as 'xdg-open' returns, 
which breaks things.

A real fix would be to tell Eshell that certain programs, like xdg-open, 
should never use PTYs. (There used to be a variable called 
'eshell-needs-pipe' that did something similar to this, but after 
changing how Eshell connects processes, it was no longer needed.)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-11-22 20:19             ` Jim Porter
@ 2022-11-22 21:00               ` Jeff Kowalski
  2022-11-23 22:59                 ` Jim Porter
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Kowalski @ 2022-11-22 21:00 UTC (permalink / raw)
  To: Jim Porter; +Cc: Andreas Schwab, Lars Ingebrigtsen, 56013

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

Thanks for the response and suggestion.
From eshell,
     λ xdg-open file.txt
exits immediately, without opening file.txt, and
     λ cat | xdg-open file.txt | cat
shows the same behavior, but
     λ setsid -w xdg-open file.txt
opens the file as expected.
Hope this helps,
Jeff



On Tue, Nov 22, 2022 at 12:20 PM Jim Porter <jporterbugs@gmail.com> wrote:

> On 11/20/2022 9:14 PM, Jeff Kowalski wrote:
> > 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.
>
> This is a hacky workaround, but if it works for you, it would help prove
> a strategy to fix this:
>
>    ~ $ cat | xdg-open file.txt | cat
>
> The above forces 'xdg-open' to be run with pipes for its stdin and
> stdout. I believe the issue is that when 'xdg-open' sees a PTY for
> stdin/stdout, it seems to assume that the PTY will live for a long time;
> however, in Eshell, it will close the PTY as soon as 'xdg-open' returns,
> which breaks things.
>
> A real fix would be to tell Eshell that certain programs, like xdg-open,
> should never use PTYs. (There used to be a variable called
> 'eshell-needs-pipe' that did something similar to this, but after
> changing how Eshell connects processes, it was no longer needed.)
>

[-- Attachment #2: Type: text/html, Size: 1900 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-11-22 21:00               ` Jeff Kowalski
@ 2022-11-23 22:59                 ` Jim Porter
  2022-11-24  3:09                   ` Jeff Kowalski
  0 siblings, 1 reply; 12+ messages in thread
From: Jim Porter @ 2022-11-23 22:59 UTC (permalink / raw)
  To: Jeff Kowalski; +Cc: 56013, Lars Ingebrigtsen, Andreas Schwab

On 11/22/2022 1:00 PM, Jeff Kowalski wrote:
> Thanks for the response and suggestion.
>  From eshell,
>       λ xdg-open file.txt
> exits immediately, without opening file.txt, and
>       λ cat | xdg-open file.txt | cat
> shows the same behavior, but
>       λ setsid -w xdg-open file.txt
> opens the file as expected.

Is this with Emacs 28 or 29? In 29, `cat | xdg-open file.txt | cat` 
should work as expected (I hope).

If it doesn't, then the solution I had in mind (make `xdg-open` use a 
pipe for its IO) probably wouldn't work, leaving us back at square one 
for this bug...






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell
  2022-11-23 22:59                 ` Jim Porter
@ 2022-11-24  3:09                   ` Jeff Kowalski
  0 siblings, 0 replies; 12+ messages in thread
From: Jeff Kowalski @ 2022-11-24  3:09 UTC (permalink / raw)
  To: Jim Porter; +Cc: 56013, Lars Ingebrigtsen, Andreas Schwab

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

I'm sorry, thanks for checking.  I didn't realize you meant v29.
I'm using GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2022-05-30
Is there something more I can help you with?

On Wed, Nov 23, 2022 at 2:59 PM Jim Porter <jporterbugs@gmail.com> wrote:

> On 11/22/2022 1:00 PM, Jeff Kowalski wrote:
> > Thanks for the response and suggestion.
> >  From eshell,
> >       λ xdg-open file.txt
> > exits immediately, without opening file.txt, and
> >       λ cat | xdg-open file.txt | cat
> > shows the same behavior, but
> >       λ setsid -w xdg-open file.txt
> > opens the file as expected.
>
> Is this with Emacs 28 or 29? In 29, `cat | xdg-open file.txt | cat`
> should work as expected (I hope).
>
> If it doesn't, then the solution I had in mind (make `xdg-open` use a
> pipe for its IO) probably wouldn't work, leaving us back at square one
> for this bug...
>
>

[-- Attachment #2: Type: text/html, Size: 1412 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-24  3:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16  3:18 bug#56013: 28.1; "gio open" and "xdg-open" fail silently under eshell Jeff Kowalski
2022-06-16 11:58 ` Lars Ingebrigtsen
2022-06-16 14:22   ` Andreas Schwab
2022-06-16 14:32   ` Andreas Schwab
2022-06-17 11:59     ` Lars Ingebrigtsen
2022-06-17 17:17       ` Jim Porter
2022-06-17 18:25         ` Jim Porter
2022-11-21  5:14           ` Jeff Kowalski
2022-11-22 20:19             ` Jim Porter
2022-11-22 21:00               ` Jeff Kowalski
2022-11-23 22:59                 ` Jim Porter
2022-11-24  3:09                   ` Jeff Kowalski

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).