* bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions @ 2023-05-21 18:08 Adam Ibrahim 2023-05-21 18:22 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Adam Ibrahim @ 2023-05-21 18:08 UTC (permalink / raw) To: 63629 [-- Attachment #1: Type: text/plain, Size: 8479 bytes --] when I use emacsclient on a file that I don't have permissions to open, two problems happen: the client exits without printing an error message so I have no idea what's going on, and then the terminal is broken. when I type into it, no keys are echoed back. though when I press enter whatever I typed in does get submitted to the shell. Neither of these happens when I have emacsclient open up a graphical frame. I've tried these out with my emacs server run with `-Q`, so I've ruled out my configuration as a reason. In GNU Emacs 28.3 (build 1, aarch64-unknown-linux-android) of 2023-02-27 built on localhost Configured using: 'configure --disable-dependency-tracking --prefix=/data/data/com.termux/files/usr --libdir=/data/data/com.termux/files/usr/lib --sbindir=/data/data/com.termux/files/usr/bin --disable-rpath --disable-rpath-hack --host=aarch64-linux-android --disable-autodepend --with-dumping=none --with-gif=no --with-gnutls --with-jpeg=no --with-json --with-modules --with-pdumper=yes --with-png=no --with-tiff=no --with-xml2 --with-xpm=no --without-dbus --without-gconf --without-gsettings --without-lcms2 --without-selinux --without-x emacs_cv_sanitize_address=yes emacs_cv_prog_cc_no_pie=no ac_cv_lib_elf_elf_begin=no gl_cv_func_dup2_works=no ac_cv_func_setrlimit=no --disable-nls --enable-shared --enable-static --libexecdir=/data/data/com.termux/files/usr/libexec 'CFLAGS= -fstack-protector-strong -Oz' 'CPPFLAGS= -I/data/data/com.termux/files/usr/include' 'LDFLAGS=-L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now'' Configured features: GMP GNUTLS JSON LIBXML2 MODULES NOTIFY INOTIFY PDUMPER SECCOMP THREADS XIM ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Dired by name Minor modes in effect: which-key-mode: t diff-hl-dired-mode: t erc-truncate-mode: t erc-track-mode: t erc-spelling-mode: t global-flycheck-mode: t global-hl-todo-mode: t which-function-mode: t global-company-mode: t company-mode: t vertico-mode: t editorconfig-mode: t global-diff-hl-mode: t winner-mode: t global-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 global-display-line-numbers-mode: t display-line-numbers-mode: t override-global-mode: t xterm-mouse-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t menu-bar-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 buffer-read-only: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /data/data/com.termux/files/home/.emacs.d/elpa/transient-20230501.1034/transient hides /data/data/com.termux/files/usr/share/emacs/28.3/lisp/transient Features: (shadow sort mail-extr emacsbug message rfc822 mml mml-sec epa derived gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail mail-utils cursor-sensor which-key dired-aux vc-mtn vc-hg vc-git vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs diff-hl-dired term/xterm xterm add-log server rainbow-mode rainbow-delimiters elisp-slime-nav guru-mode prelude-modules 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-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-perl prelude-lsp lsp-ui lsp-ui-flycheck lsp-ui-doc goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline image lsp-mode spinner network-stream puny nsm rmc smartparens-markdown markdown-mode color lv inline f f-shortdoc shortdoc epg rfc6068 epg-config lsp-ui-util face-remap lsp-protocol s ht 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-css prelude-c prelude-programming flycheck hl-todo which-func prelude-org org-habit org-agenda org-refile 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 find-func cal-menu calendar cal-loaddefs prelude-company company-oddmuse company-keywords 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-vertico orderless vertico compat compat-29 prelude-linux exec-path-from-shell warnings prelude-global-keybindings 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 fringe 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 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 pp 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 wid-edit savehist saveplace diminish smartparens-config smartparens-text smartparens advice loadhist dash autorevert filenotify delsel prelude-mode edmacro kmacro crux 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 misterioso-theme display-line-numbers prelude-custom prelude-packages cl-extra help-mode use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key easy-mmode use-package-core finder-inf xt-mouse regexp-opt rx pcase info tool-bar 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 tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select 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 inotify multi-tty make-network-process emacs) Memory information: ((conses 16 647720 209601) (symbols 48 54050 77) (strings 32 230059 27365) (string-bytes 1 6714998) (vectors 16 89242) (vector-slots 8 900514 196184) (floats 8 408 924) (intervals 56 617 479) (buffers 992 12)) [-- Attachment #2: Type: text/html, Size: 9191 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions 2023-05-21 18:08 bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions Adam Ibrahim @ 2023-05-21 18:22 ` Eli Zaretskii [not found] ` <CAHdC_iKdG9viw__B0j9Pqa4Wq9QMpLk5SSc12Ead_SSGfAFJhw@mail.gmail.com> 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2023-05-21 18:22 UTC (permalink / raw) To: Adam Ibrahim; +Cc: 63629 > From: Adam Ibrahim <ibrahimadam193@gmail.com> > Date: Sun, 21 May 2023 14:08:50 -0400 > > when I use emacsclient on a file that I don't have permissions to open, > two problems happen: the client exits without printing an error message > so I have no idea what's going on, and then the terminal is broken. when > I type into it, no keys are echoed back. though when I press enter > whatever I typed in does get submitted to the shell. > > Neither of these happens when I have emacsclient open up a graphical > frame. I've tried these out with my emacs server run with `-Q`, so I've > ruled out my configuration as a reason. Please show the results of "ls -l" on this problematic file, and also please show the exact emacsclient command you use which causes the problem. And what exactly do you mean by "the terminal is broken"? what doesn't work afterwards and which terminal emulator is that? (My guess is that emacsclient crashes, so perhaps try running it from GDB, and see what that produces.) ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <CAHdC_iKdG9viw__B0j9Pqa4Wq9QMpLk5SSc12Ead_SSGfAFJhw@mail.gmail.com>]
* bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions [not found] ` <CAHdC_iKdG9viw__B0j9Pqa4Wq9QMpLk5SSc12Ead_SSGfAFJhw@mail.gmail.com> @ 2023-05-21 18:57 ` Adam Ibrahim 2023-05-22 13:31 ` Eli Zaretskii 2023-05-21 19:05 ` Eli Zaretskii 1 sibling, 1 reply; 10+ messages in thread From: Adam Ibrahim @ 2023-05-21 18:57 UTC (permalink / raw) To: 63629 [-- Attachment #1: Type: text/plain, Size: 2446 bytes --] ---------- Forwarded message --------- From: Adam Ibrahim <ibrahimadam193@gmail.com> Date: Sun, May 21, 2023, 14:48 Subject: Re: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions To: Eli Zaretskii <eliz@gnu.org> output of `ls -l`: ls -l no-perms ---------- 1 u0_a331 u0_a331 0 May 21 14:27 no-perms commands used: emacs --fg-daemon -Q emacsclient no-perms # in a separate terminal what stops working: when I type, the letters I type don't appear in the terminal anymore. nothing is echoed back to me. stuff still happens, and I can enter commands, but I can't see anything. And the terminal width seems screwed up. like things that should get indented, they don't look right. I've tried this on two terminal emulators: termux on Android and kitty on my desktop running Linux. On termux the problems in the terminal are consistent. and kitty, it happens sometimes. sometimes the terminal continues to function like normal and I can see the keys I typed echoed back to me, and sometimes not. what happens when I try using GDB: I can only use GDB on my desktop right now. when I try running `gdb emacsclient no-perms`, it prints an error message: `/path/to/no-perms: Permission denied`. So whatever this problem is, it doesn't show up in GDB on my desktop. On Sun, May 21, 2023, 14:21 Eli Zaretskii <eliz@gnu.org> wrote: > > From: Adam Ibrahim <ibrahimadam193@gmail.com> > > Date: Sun, 21 May 2023 14:08:50 -0400 > > > > when I use emacsclient on a file that I don't have permissions to open, > > two problems happen: the client exits without printing an error message > > so I have no idea what's going on, and then the terminal is broken. when > > I type into it, no keys are echoed back. though when I press enter > > whatever I typed in does get submitted to the shell. > > > > Neither of these happens when I have emacsclient open up a graphical > > frame. I've tried these out with my emacs server run with `-Q`, so I've > > ruled out my configuration as a reason. > > Please show the results of "ls -l" on this problematic file, and also > please show the exact emacsclient command you use which causes the > problem. > > And what exactly do you mean by "the terminal is broken"? what doesn't > work afterwards and which terminal emulator is that? > > (My guess is that emacsclient crashes, so perhaps try running it from > GDB, and see what that produces.) > [-- Attachment #2: Type: text/html, Size: 3632 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions 2023-05-21 18:57 ` bug#63629: Fwd: " Adam Ibrahim @ 2023-05-22 13:31 ` Eli Zaretskii 2023-05-23 20:30 ` Adam Ibrahim 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2023-05-22 13:31 UTC (permalink / raw) To: Adam Ibrahim; +Cc: 63629 > From: Adam Ibrahim <ibrahimadam193@gmail.com> > Date: Sun, 21 May 2023 14:57:03 -0400 > > output of `ls -l`: > > ls -l no-perms > ---------- 1 u0_a331 u0_a331 0 May 21 14:27 no-perms > > commands used: > > emacs --fg-daemon -Q > emacsclient no-perms # in a separate terminal > > what stops working: when I type, the letters I type don't appear in the terminal anymore. nothing is > echoed back to me. stuff still happens, and I can enter commands, but I can't see anything. And the > terminal width seems screwed up. like things that should get indented, they don't look right. Thanks. Please try the patch below and see if it solves the problem without adding any new ones. diff --git a/lisp/server.el b/lisp/server.el index eaf24a770e4..7e35eaa6176 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1138,6 +1138,11 @@ server-process-filter (server-log "Authentication failed" proc) (server-send-string proc (concat "-error " (server-quote-arg "Authentication failed"))) + (unless (eq system-type 'windows-nt) + (let ((terminal (process-get proc 'terminal))) + ;; Only delete the terminal if it is non-nil. + (when (and terminal (eq (terminal-live-p terminal) t)) + (delete-terminal terminal)))) ;; Before calling `delete-process', give emacsclient time to ;; receive the error string and shut down on its own. (sit-for 1) @@ -1459,6 +1464,11 @@ server-return-error proc (concat "-error " (server-quote-arg (error-message-string err)))) (server-log (error-message-string err) proc) + (unless (eq system-type 'windows-nt) + (let ((terminal (process-get proc 'terminal))) + ;; Only delete the terminal if it is non-nil. + (when (and terminal (eq (terminal-live-p terminal) t)) + (delete-terminal terminal)))) ;; Before calling `delete-process', give emacsclient time to ;; receive the error string and shut down on its own. (sit-for 5) ^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions 2023-05-22 13:31 ` Eli Zaretskii @ 2023-05-23 20:30 ` Adam Ibrahim 2023-05-24 10:52 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Adam Ibrahim @ 2023-05-23 20:30 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 63629 [-- Attachment #1: Type: text/plain, Size: 3431 bytes --] I ran the following commands on my phone in termux and in Kitty on my PC 10 times each and record the results. I did it multiple times because the results seem random. ./src/emacs --fg-daemon -Q ./lib-src/emacsclient path/to/no-perms # in a separate terminal, 10 times Phone + Termux: 9 out of 10 times, I got the expected results where the terminal was not broken and I saw an error message. on the 10th time there was some weird behavior, but I haven't been able to reproduce it and I don't remember what happened. PC + Kitty: there were no crashes meaning the terminal wasn't broken anymore. but 6 out of 10 times the error message didn't print. sometimes all I saw was "waiting for emacs..." and some other times all I saw was "...". the other four times was expected behavior colon the error message printed and the terminal wasn't broken. Note: I have a slightly different environment on my phone compared to the first time. when I first reported the bug I was using the emacs and emacsclient programs located on my phone. this time I used the modified emacs and emacsclient from my desktop over SSH. I don't know if that changed the results. But the bug with unmodified emacs happens just the same over SSH as with emacs on my phone. On Mon, May 22, 2023, 09:30 Eli Zaretskii <eliz@gnu.org> wrote: > > From: Adam Ibrahim <ibrahimadam193@gmail.com> > > Date: Sun, 21 May 2023 14:57:03 -0400 > > > > output of `ls -l`: > > > > ls -l no-perms > > ---------- 1 u0_a331 u0_a331 0 May 21 14:27 no-perms > > > > commands used: > > > > emacs --fg-daemon -Q > > emacsclient no-perms # in a separate terminal > > > > what stops working: when I type, the letters I type don't appear in the > terminal anymore. nothing is > > echoed back to me. stuff still happens, and I can enter commands, but I > can't see anything. And the > > terminal width seems screwed up. like things that should get indented, > they don't look right. > > Thanks. Please try the patch below and see if it solves the problem > without adding any new ones. > > diff --git a/lisp/server.el b/lisp/server.el > index eaf24a770e4..7e35eaa6176 100644 > --- a/lisp/server.el > +++ b/lisp/server.el > @@ -1138,6 +1138,11 @@ server-process-filter > (server-log "Authentication failed" proc) > (server-send-string > proc (concat "-error " (server-quote-arg "Authentication failed"))) > + (unless (eq system-type 'windows-nt) > + (let ((terminal (process-get proc 'terminal))) > + ;; Only delete the terminal if it is non-nil. > + (when (and terminal (eq (terminal-live-p terminal) t)) > + (delete-terminal terminal)))) > ;; Before calling `delete-process', give emacsclient time to > ;; receive the error string and shut down on its own. > (sit-for 1) > @@ -1459,6 +1464,11 @@ server-return-error > proc (concat "-error " (server-quote-arg > (error-message-string err)))) > (server-log (error-message-string err) proc) > + (unless (eq system-type 'windows-nt) > + (let ((terminal (process-get proc 'terminal))) > + ;; Only delete the terminal if it is non-nil. > + (when (and terminal (eq (terminal-live-p terminal) t)) > + (delete-terminal terminal)))) > ;; Before calling `delete-process', give emacsclient time to > ;; receive the error string and shut down on its own. > (sit-for 5) > [-- Attachment #2: Type: text/html, Size: 4388 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions 2023-05-23 20:30 ` Adam Ibrahim @ 2023-05-24 10:52 ` Eli Zaretskii 2023-05-24 12:08 ` Adam Ibrahim 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2023-05-24 10:52 UTC (permalink / raw) To: Adam Ibrahim; +Cc: 63629 > From: Adam Ibrahim <ibrahimadam193@gmail.com> > Date: Tue, 23 May 2023 16:30:14 -0400 > Cc: 63629@debbugs.gnu.org > > I ran the following commands on my phone in termux and in Kitty on my PC 10 times each and record > the results. I did it multiple times because the results seem random. > > ./src/emacs --fg-daemon -Q > ./lib-src/emacsclient path/to/no-perms # in a separate terminal, 10 times > > Phone + Termux: 9 out of 10 times, I got the expected results where the terminal was not broken and I > saw an error message. on the 10th time there was some weird behavior, but I haven't been able to > reproduce it and I don't remember what happened. > > PC + Kitty: there were no crashes meaning the terminal wasn't broken anymore. but 6 out of 10 times > the error message didn't print. sometimes all I saw was "waiting for emacs..." and some other times > all I saw was "...". the other four times was expected behavior colon the error message printed and the > terminal wasn't broken. > > Note: I have a slightly different environment on my phone compared to the first time. when I first > reported the bug I was using the emacs and emacsclient programs located on my phone. this time I > used the modified emacs and emacsclient from my desktop over SSH. I don't know if that changed the > results. But the bug with unmodified emacs happens just the same over SSH as with emacs on my > phone. If the only problem you see after the change is that you don't always see the error message, then it's expected. emacsclient outputs the error message to stderr, and when there's a client frame on that display, it is impossible to make sure the error message will always be shown, before it is erased when the terminal is closed by the server Emacs process. So the only thing the fix tries to guarantee is that you will be able to use the terminal after emacsclient exits. If this happens in all the configurations you tried, then the goal of the change is achieved, and I don't think we can do much more. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions 2023-05-24 10:52 ` Eli Zaretskii @ 2023-05-24 12:08 ` Adam Ibrahim 2023-05-26 10:29 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Adam Ibrahim @ 2023-05-24 12:08 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 63629 [-- Attachment #1: Type: text/plain, Size: 2189 bytes --] Makes sense. Thanks. On Wed, May 24, 2023, 06:52 Eli Zaretskii <eliz@gnu.org> wrote: > > From: Adam Ibrahim <ibrahimadam193@gmail.com> > > Date: Tue, 23 May 2023 16:30:14 -0400 > > Cc: 63629@debbugs.gnu.org > > > > I ran the following commands on my phone in termux and in Kitty on my PC > 10 times each and record > > the results. I did it multiple times because the results seem random. > > > > ./src/emacs --fg-daemon -Q > > ./lib-src/emacsclient path/to/no-perms # in a separate terminal, 10 > times > > > > Phone + Termux: 9 out of 10 times, I got the expected results where the > terminal was not broken and I > > saw an error message. on the 10th time there was some weird behavior, > but I haven't been able to > > reproduce it and I don't remember what happened. > > > > PC + Kitty: there were no crashes meaning the terminal wasn't broken > anymore. but 6 out of 10 times > > the error message didn't print. sometimes all I saw was "waiting for > emacs..." and some other times > > all I saw was "...". the other four times was expected behavior colon > the error message printed and the > > terminal wasn't broken. > > > > Note: I have a slightly different environment on my phone compared to > the first time. when I first > > reported the bug I was using the emacs and emacsclient programs located > on my phone. this time I > > used the modified emacs and emacsclient from my desktop over SSH. I > don't know if that changed the > > results. But the bug with unmodified emacs happens just the same over > SSH as with emacs on my > > phone. > > If the only problem you see after the change is that you don't always > see the error message, then it's expected. emacsclient outputs the > error message to stderr, and when there's a client frame on that > display, it is impossible to make sure the error message will always > be shown, before it is erased when the terminal is closed by the > server Emacs process. So the only thing the fix tries to guarantee is > that you will be able to use the terminal after emacsclient exits. If > this happens in all the configurations you tried, then the goal of the > change is achieved, and I don't think we can do much more. > [-- Attachment #2: Type: text/html, Size: 2902 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions 2023-05-24 12:08 ` Adam Ibrahim @ 2023-05-26 10:29 ` Eli Zaretskii 2023-05-31 13:20 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2023-05-26 10:29 UTC (permalink / raw) To: Adam Ibrahim; +Cc: 63629 > From: Adam Ibrahim <ibrahimadam193@gmail.com> > Date: Wed, 24 May 2023 08:08:13 -0400 > Cc: 63629@debbugs.gnu.org > > Makes sense. Thanks. I eventually found a way of showing the error message in almost all cases, and installed the fix with those changes on the master branch. Please try the patch below and see if it produces better results. diff --git a/lisp/server.el b/lisp/server.el index 608e5df..c3325e5 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1143,8 +1143,18 @@ server-process-filter (process-put proc :authenticated t) (server-log "Authentication successful" proc)) (server-log "Authentication failed" proc) + ;; Display the error as a message and give the user time to see + ;; it, in case the error written by emacsclient to stderr is not + ;; visible for some reason. + (message "Authentication failed") + (sit-for 2) (server-send-string proc (concat "-error " (server-quote-arg "Authentication failed"))) + (unless (eq system-type 'windows-nt) + (let ((terminal (process-get proc 'terminal))) + ;; Only delete the terminal if it is non-nil. + (when (and terminal (eq (terminal-live-p terminal) t)) + (delete-terminal terminal)))) ;; Before calling `delete-process', give emacsclient time to ;; receive the error string and shut down on its own. (sit-for 1) @@ -1462,10 +1472,20 @@ server-execute (defun server-return-error (proc err) (ignore-errors + ;; Display the error as a message and give the user time to see + ;; it, in case the error written by emacsclient to stderr is not + ;; visible for some reason. + (message (error-message-string err)) + (sit-for 2) (server-send-string proc (concat "-error " (server-quote-arg (error-message-string err)))) (server-log (error-message-string err) proc) + (unless (eq system-type 'windows-nt) + (let ((terminal (process-get proc 'terminal))) + ;; Only delete the terminal if it is non-nil. + (when (and terminal (eq (terminal-live-p terminal) t)) + (delete-terminal terminal)))) ;; Before calling `delete-process', give emacsclient time to ;; receive the error string and shut down on its own. (sit-for 5) ^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions 2023-05-26 10:29 ` Eli Zaretskii @ 2023-05-31 13:20 ` Eli Zaretskii 0 siblings, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2023-05-31 13:20 UTC (permalink / raw) To: ibrahimadam193; +Cc: 63629-done > Cc: 63629@debbugs.gnu.org > Date: Fri, 26 May 2023 13:29:38 +0300 > From: Eli Zaretskii <eliz@gnu.org> > > > From: Adam Ibrahim <ibrahimadam193@gmail.com> > > Date: Wed, 24 May 2023 08:08:13 -0400 > > Cc: 63629@debbugs.gnu.org > > > > Makes sense. Thanks. > > I eventually found a way of showing the error message in almost all > cases, and installed the fix with those changes on the master branch. > Please try the patch below and see if it produces better results. No more comments, so I'm closing this bug. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions [not found] ` <CAHdC_iKdG9viw__B0j9Pqa4Wq9QMpLk5SSc12Ead_SSGfAFJhw@mail.gmail.com> 2023-05-21 18:57 ` bug#63629: Fwd: " Adam Ibrahim @ 2023-05-21 19:05 ` Eli Zaretskii 1 sibling, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2023-05-21 19:05 UTC (permalink / raw) To: Adam Ibrahim; +Cc: 63629 > From: Adam Ibrahim <ibrahimadam193@gmail.com> > Date: Sun, 21 May 2023 14:48:05 -0400 > > what happens when I try using GDB: I can only use GDB on my desktop right now. when I try running > `gdb emacsclient no-perms`, it prints an error message: `/path/to/no-perms: Permission denied`. So > whatever this problem is, it doesn't show up in GDB on my desktop. You should invoke emacsclient from GDB like this: $ gdb --args emacsclient no-perms ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-05-31 13:20 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-05-21 18:08 bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions Adam Ibrahim 2023-05-21 18:22 ` Eli Zaretskii [not found] ` <CAHdC_iKdG9viw__B0j9Pqa4Wq9QMpLk5SSc12Ead_SSGfAFJhw@mail.gmail.com> 2023-05-21 18:57 ` bug#63629: Fwd: " Adam Ibrahim 2023-05-22 13:31 ` Eli Zaretskii 2023-05-23 20:30 ` Adam Ibrahim 2023-05-24 10:52 ` Eli Zaretskii 2023-05-24 12:08 ` Adam Ibrahim 2023-05-26 10:29 ` Eli Zaretskii 2023-05-31 13:20 ` Eli Zaretskii 2023-05-21 19:05 ` Eli Zaretskii
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.