Subject: bug#41788: 28.0.50; emacsclient -t doesn't work with vipe from moreutils

From: Platon Pronko <[email-masked]>
Date: Wed, 10 Jun 2020 16:19:45 +0300

When trying to use "emacsclient -t" with vipe I get an error:

$ echo a | EDITOR='emacsclient -t' vipe
*ERROR*: Could not open file: /dev/tty
emacsclient -t exited nonzero, aborting

(vipe is a tool from moreutils, used to insert an editor in the middle of
the pipeline)

Looking inside vipe source I see that it reopens stdin before calling
the EDITOR:

close STDIN;
open(STDIN, "</dev/tty") || die "reopen stdin: $!";

If I use for example nano instead of emacsclient -t then everything works correctly.

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.17.3)
  of 2020-06-04 built on the-big-maker
Repository revision: cdadb7a97cbed523af9f52705d8b03e91d17313f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Arch Linux

Configured using:
  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
  --with-sound=alsa --with-modules --without-gconf --without-gsettings
  --with-x-toolkit=gtk3 --without-xaw3d --without-compress-install
  'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -flto'
  CPPFLAGS=-D_FORTIFY_SOURCE=2
  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

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

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

Major mode: SQL[ANSI]

Minor modes in effect:
   recentf-mode: t
   global-magit-file-mode: t
   magit-file-mode: t
   magit-auto-revert-mode: t
   rainbow-delimiters-mode: t
   counsel-mode: t
   ivy-mode: t
   global-git-gutter-mode: t
   git-gutter-mode: t
   global-git-commit-mode: t
   async-bytecomp-package-mode: t
   shell-dirtrack-mode: t
   global-auto-revert-mode: t
   global-whitespace-mode: t
   global-dvorak-mode: t
   dvorak-minor-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
/home/platon/.emacs.d/elpa/lispy-20200519.737/elpa hides /home/platon/.emacs.d/elpa/ivy-20200605.1134/elpa
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-ns hides /usr/share/emacs/site-lisp/cider-ns
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-classpath hides /usr/share/emacs/site-lisp/cider-classpath
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-stacktrace hides /usr/share/emacs/site-lisp/cider-stacktrace
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-clojuredocs hides /usr/share/emacs/site-lisp/cider-clojuredocs
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-doc hides /usr/share/emacs/site-lisp/cider-doc
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider hides /usr/share/emacs/site-lisp/cider
/home/platon/.emacs.d/elpa/parseclj-20190531.711/parseclj-ast hides /usr/share/emacs/site-lisp/parseclj-ast
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-connection hides /usr/share/emacs/site-lisp/cider-connection
/home/platon/.emacs.d/elpa/cider-20200604.1627/nrepl-client hides /usr/share/emacs/site-lisp/nrepl-client
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-popup hides /usr/share/emacs/site-lisp/cider-popup
/home/platon/.emacs.d/elpa/parseedn-20200419.1124/parseedn hides /usr/share/emacs/site-lisp/parseedn
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-cheatsheet hides /usr/share/emacs/site-lisp/cider-cheatsheet
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-debug hides /usr/share/emacs/site-lisp/cider-debug
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-completion hides /usr/share/emacs/site-lisp/cider-completion
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-eval hides /usr/share/emacs/site-lisp/cider-eval
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-repl hides /usr/share/emacs/site-lisp/cider-repl
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-inspector hides /usr/share/emacs/site-lisp/cider-inspector
/home/platon/.emacs.d/elpa/parseclj-20190531.711/parseclj hides /usr/share/emacs/site-lisp/parseclj
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-util hides /usr/share/emacs/site-lisp/cider-util
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-eldoc hides /usr/share/emacs/site-lisp/cider-eldoc
/home/platon/.emacs.d/elpa/parseclj-20190531.711/parseclj-parser hides /usr/share/emacs/site-lisp/parseclj-parser
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-browse-ns hides /usr/share/emacs/site-lisp/cider-browse-ns
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-macroexpansion hides /usr/share/emacs/site-lisp/cider-macroexpansion
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-resolve hides /usr/share/emacs/site-lisp/cider-resolve
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-compat hides /usr/share/emacs/site-lisp/cider-compat
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-format hides /usr/share/emacs/site-lisp/cider-format
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-common hides /usr/share/emacs/site-lisp/cider-common
/home/platon/.emacs.d/elpa/a-20180907.953/a hides /usr/share/emacs/site-lisp/a
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-profile hides /usr/share/emacs/site-lisp/cider-profile
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-selector hides /usr/share/emacs/site-lisp/cider-selector
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-client hides /usr/share/emacs/site-lisp/cider-client
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-scratch hides /usr/share/emacs/site-lisp/cider-scratch
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-repl-history hides /usr/share/emacs/site-lisp/cider-repl-history
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-find hides /usr/share/emacs/site-lisp/cider-find
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-test hides /usr/share/emacs/site-lisp/cider-test
/home/platon/.emacs.d/elpa/cider-20200604.1627/nrepl-dict hides /usr/share/emacs/site-lisp/nrepl-dict
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-overlays hides /usr/share/emacs/site-lisp/cider-overlays
/home/platon/.emacs.d/elpa/protobuf-mode-20200520.15/protobuf-mode hides /usr/share/emacs/site-lisp/protobuf-mode
/home/platon/.emacs.d/elpa/parseclj-20190531.711/parseclj-lex hides /usr/share/emacs/site-lisp/parseclj-lex
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-mode hides /usr/share/emacs/site-lisp/cider-mode
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-xref hides /usr/share/emacs/site-lisp/cider-xref
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-apropos hides /usr/share/emacs/site-lisp/cider-apropos
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-browse-spec hides /usr/share/emacs/site-lisp/cider-browse-spec
/home/platon/.emacs.d/elpa/cider-20200604.1627/cider-tracing hides /usr/share/emacs/site-lisp/cider-tracing
/home/platon/.emacs.d/elpa/clojure-mode-20200419.559/clojure-mode hides /usr/share/emacs/site-lisp/clojure-mode
/home/platon/.emacs.d/elpa/epl-20180205.2049/epl hides /usr/share/emacs/site-lisp/epl/epl
/home/platon/.emacs.d/elpa/pkg-info-20150517.1143/pkg-info hides /usr/share/emacs/site-lisp/pkg-info/pkg-info
/home/platon/.emacs.d/elpa/queue-0.2/queue hides /usr/share/emacs/site-lisp/queue/queue
/home/platon/.emacs.d/elpa/sesman-20190909.1754/sesman-browser hides /usr/share/emacs/site-lisp/sesman/sesman-browser
/home/platon/.emacs.d/elpa/sesman-20190909.1754/sesman hides /usr/share/emacs/site-lisp/sesman/sesman
/home/platon/.emacs.d/elpa/spinner-1.7.3/spinner hides /usr/share/emacs/site-lisp/spinner/spinner
/home/platon/.emacs.d/elpa/less-css-mode-20161001.453/less-css-mode hides /usr/share/emacs/28.0.50/lisp/textmodes/less-css-mode

Features:
(shadow sort emacsbug sendmail term disp-table ehelp tramp-cmds
make-mode sql view mhtml-mode term/xterm xterm smartparens-python python
bs mail-extr tabify ox-odt rng-loc rng-uri rng-parse rng-match rng-dt
rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
ox-icalendar ox-html table ox-ascii ox-publish ox sh-script executable
org-indent bug-reference conf-mode magit-patch magit-subtree magit-ediff
ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help ediff-init
ediff-util eieio-opt dabbrev ffap misearch multi-isearch tramp-cache
tramp-sh recentf tree-widget magit-bookmark bookmark pp magit-extras
magit-submodule magit-obsolete 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 which-func magit-diff
smerge-mode diff diff-mode magit-core magit-autorevert magit-margin
magit-transient magit-process magit-mode rainbow-delimiters org-element
avl-tree ol-w3m ol-rmail ol-mhe ol-irc ol-info org-habit org-agenda
ol-gnus nnir gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range
gnus-win ol-eww ol-docview doc-view jka-compr image-mode exif ol-bibtex
bibtex ol-bbdb lispy pcase lispy-inline avy edebug backtrace help-fns
radix-tree lispy-tags mode-local counsel xdg swiper ivy delsel ivy-faces
ivy-overlay colir smartparens-config smartparens-javascript
smartparens-rust smartparens-ruby smartparens-org smartparens-text
smartparens-html smartparens-c smartparens git-gutter-fringe
fringe-helper git-gutter hydra lv git-commit with-editor async-bytecomp
async transient cl-extra server magit-git magit-section magit-utils crm
log-edit message rmc dired dired-loaddefs rfc822 mml mml-sec epa epg
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader pcvs-util dash tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell parse-time iso8601 ls-lisp
lpr rust-mode php-mode rx speedbar ezimage dframe etags fileloop
generator xref project flymake-proc flymake compile warnings add-log
cc-langs autorevert filenotify whitespace sass-mode haml-mode js cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs css-mode sgml-mode imenu eww mm-url gnus nnheader gnus-util
rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils wid-edit
mm-util mail-prsvr thingatpt url-queue url url-proxy url-privacy
url-expand url-methods url-history mailcap shr text-property-search
url-cookie url-domsuf url-util puny svg xml dom color ruby-mode smie
windmove quail help-mode besi derived scala-mode-inf cl
scala-mode-constants scala-mode-lib scala-mode-ui textindent edmacro
kmacro org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color
ring org-list org-faces org-entities time-date noutline outline
easy-mmode org-version ob-emacs-lisp ob-core ob-eval org-table ol
org-keys org-compat advice org-macs org-loaddefs format-spec find-func
cal-menu calendar cal-loaddefs darcula-theme finder-inf
scala-mode2-autoloads info package easymenu browse-url 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 tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type 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 elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu 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 charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 623254 95403)
   (symbols 48 47866 1)
   (strings 32 197193 14289)
   (string-bytes 1 6125919)
   (vectors 16 83568)
   (vector-slots 8 1548448 96210)
   (floats 8 399 662)
   (intervals 56 10173 917)
   (buffers 992 65))