Subject: 29.0.91; Emacs hangs trying to save encrypted file
From: "Roman Rudakov" <[email-masked]>
To: [email-masked]
Date: Tue, 23 May 2023 12:36:42 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Steps to reproduce:

- Create/open a file with .gpg extension (C-x C-f ~/test.gpg)
- Edit file content
- Save file (C-x C-s)
- If it's a new file, select a key to encrypt this file

Expected result: file is saved and encrypted.

Actual result: emacs is not responding.

Additional info:

If I run `toggle-debug-on-quit` and press `C-g`, I can see that the 
latest called function in a backtrace is `epg-wait-for-status`.

After debugging I also figured out that the code:

(accept-process-output (epg-context-process context) 1)

always returns `nil` so while loop runs forever.

I tried to run gpg command directly in terminal and it works fine:

/opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes 
--enable-progress-filter --command-fd 0 --output test.gpg --encrypt -r 
FB43E281457C5165

Output:
[GNUPG:] KEY_CONSIDERED E66810C6F226B2BD08D67F00FB43E281457C5165 0
Hello
This text is encrypted!
[GNUPG:] PROGRESS stdin ? 0 0 B
[GNUPG:] BEGIN_ENCRYPTION 2 9
[GNUPG:] PROGRESS stdin ? 30 0 B
[GNUPG:] END_ENCRYPTION

In GNU Emacs 29.0.91 (build 1, aarch64-apple-darwin22.5.0, NS
 appkit-2299.60 Version 13.4 (Build 22F66)) of 2023-05-23 built on
 Romans-MacBook-Pro.local
Windowing system distributor 'Apple', version 10.3.2299
System Description:  macOS 13.4

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus@29/29.0.90/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus@29/29.0.90 --with-xml2
 --with-gnutls --with-native-compilation --without-compress-install
 --without-dbus --without-imagemagick --with-modules --with-rsvg
 --without-pop --with-xwidgets --with-ns --disable-ns-self-contained
 'CFLAGS=-Os -w -pipe -mmacosx-version-min=13
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk
 -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT'
 'CPPFLAGS=-I/opt/homebrew/opt/zlib/include
 -I/opt/homebrew/opt/jpeg/include -I/opt/homebrew/opt/readline/include
 -I/opt/homebrew/opt/icu4c/include
 -I/opt/homebrew/opt/[email-masked]/include -isystem/opt/homebrew/include
 -F/opt/homebrew/Frameworks
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk'
 'LDFLAGS=-L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/jpeg/lib
 -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/icu4c/lib
 -L/opt/homebrew/opt/[email-masked]/lib -L/opt/homebrew/lib
 -F/opt/homebrew/Frameworks -Wl,-headerpad_max_install_names
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk
 -L/opt/homebrew/opt/libgccjit/lib''
Configured features:
ACL GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB
Important settings:
  value of $LC_CTYPE: UTF-8
  locale-coding-system: utf-8

Major mode: Authinfo

Minor modes in effect:
  reveal-mode: t
  pdf-occur-global-minor-mode: t
  corfu-popupinfo-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-autoaway-mode: t
  mu4e-modeline-mode: t
  auto-insert-mode: t
  smartparens-global-strict-mode: t
  smartparens-strict-mode: t
  smartparens-mode: t
  persp-mode: t
  projectile-mode: t
  magit-todos-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  winum-mode: t
  org-roam-db-autosync-mode: t
  global-corfu-mode: t
  corfu-mode: t
  vertico-multiform-mode: t
  vertico-mode: t
  minions-mode: t
  save-place-mode: t
  savehist-mode: t
  global-auto-revert-mode: t
  global-hl-line-mode: t
  delete-selection-mode: t
  override-global-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-networks-mode: t
  TeX-PDF-mode: t
  recentf-mode: t
  windmove-mode: t
  shell-dirtrack-mode: t
  csv-field-index-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
  window-divider-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/Users/rrudakov/.emacs.d/elpa/hydra-0.15.0/lv hides 
/Users/rrudakov/.emacs.d/elpa/lv-0.15.0/lv
/Users/rrudakov/.emacs.d/elpa/password-store-20230503.619/password-store 
hides /opt/homebrew/share/emacs/site-lisp/pass/password-store
/Users/rrudakov/.emacs.d/elpa/transient-0.4.0/transient hides 
/opt/homebrew/Cellar/emacs-plus@29/29.0.90/share/emacs/29.0.91/lisp/transient

Features:
(shadow consult-org consult-imenu mailalias gnus-cite smiley qp
mail-extr textsec uni-scripts idna-mapping uni-confusable 
textsec-check
display-line-numbers shortdoc consult-xref vc-git help-fns cl-print
cus-start emacsbug reveal epa-file cursor-sensor pdf-occur
corfu-popupinfo org-duration org-eldoc oc-basic bibtex init
literate-calc-mode gif-screencast google-translate-smooth-ui
password-store-otp nov ob-restclient erc-list erc-menu erc-join 
erc-ring
erc-pcomplete erc-track erc-match erc-netsplit erc-autoaway mu4e
mu4e-org mu4e-notification mu4e-main mu4e-view mu4e-headers 
mu4e-compose
mu4e-draft mu4e-actions smtpmail mu4e-search mu4e-lists mu4e-bookmarks
mu4e-mark mu4e-message flow-fill mu4e-contacts mu4e-update 
mu4e-folders
mu4e-context mu4e-query-items mu4e-server mu4e-modeline mu4e-vars
mu4e-helpers mu4e-config mu4e-window mu4e-obsolete rust-ts-mode
dockerfile-ts-mode smartparens-lua lua-mode yaml-ts-mode font-latex
pip-requirements py-yapf blacken pyvenv web-mode-expansions web-mode
disp-table typescript-mode add-node-modules-path prettier-js
java-ts-mode c-ts-common google-java-format pkgbuild-mode logview
vlf-setup nginx-mode vimrc-mode ssh-config-mode xml-format
nxml-mode-expansions rng-nxml rng-valid nxml-mode nxml-outln nxml-rap
edit-indirect eglot external-completion array jsonrpc google-c-style
bicycle autoinsert flymake-kondor idle-highlight-mode rainbow-mode
smartscan deadgrep rg rg-info-hack rg-menu rg-ibuffer rg-result 
wgrep-rg
wgrep rg-history rg-header avy flyspell-correct expand-region
subword-mode-expansions text-mode-expansions cc-mode-expansions
the-org-mode-expansions python-el-fgallina-expansions
latex-mode-expansions html-mode-expansions clojure-mode-expansions
er-basic-expansions expand-region-core expand-region-custom
multiple-cursors mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines smartparens-rust smartparens-org smartparens-config
smartparens-text smartparens-python smartparens-markdown
smartparens-latex smartparens-html smartparens-haskell
smartparens-clojure smartparens perspective consult projectile 
git-link
gitignore-templates magit-todos pcre2el rxt hl-todo f f-shortdoc grep
diff-hl log-view vc-dir vc vc-dispatcher magit-bookmark 
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 git-commit log-edit pcvs-util add-log
magit-core magit-autorevert magit-margin magit-transient magit-process
magit-mode transient magit-git magit-utils winum org-roam-migrate
org-roam-log org-roam-mode org-roam-capture org-roam-id org-roam-node
org-roam-db emacsql-sqlite-builtin sqlite org-roam-utils 
org-roam-compat
org-roam org-capture org-attach emacsql-sqlite emacsql-sqlite-common
emacsql emacsql-compiler magit-section org-tree-slide face-remap
org-timer async ob-async ob-plantuml ob-ditaa ob-clojure ob-haskell
ob-sqlite ob-shell ob-sql ob-python python org-mime ox-org org-clock
appt diary-lib diary-loaddefs ox-jira ox-confluence org-contrib 
ox-slack
ox-gfm ox-md 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 org-agenda ol-info
ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime dig
gnus-sum gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud nnimap
nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range gnus-win
alert log4e notifications gntp exec-path-from-shell cape corfu 
orderless
vertico-directory vertico-multiform vertico minions
modus-vivendi-tinted-theme modus-themes hippie-exp re-builder flyspell
dired-subtree dired-hacks-utils dired-git-info image-dired
image-dired-tags image-dired-external image-dired-util dired-aux
shr-tag-pre-highlight saveplace savehist autorevert filenotify 
conf-mode
hl-line delsel novice mysecret use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
use-package-core emacs-everywhere-autoloads lua-mode-autoloads
git-link-autoloads erc-hl-nicks erc-button erc-fill erc-stamp
erc-goodies erc erc-backend erc-networks erc-common erc-compat
erc-loaddefs erc-hl-nicks-autoloads timezone texinfo texinfo-loaddefs
toolbar-x reporter desktop frameset context plain-tex latex
latex-flymake tex-ispell tex-style tex crm dbus texmathp
auctex-autoloads tex-site language-detection
shr-tag-pre-highlight-autoloads language-detection-autoloads 
org-element
org-persist org-id org-refile calc calc-loaddefs calc-macs
literate-calc-mode-autoloads gif-screencast-autoloads
google-translate-default-ui google-translate-core-ui ido
google-translate-core google-translate-backend
google-translate-autoloads popup popup-autoloads password-store
password-store-otp-autoloads auth-source-pass with-editor server
password-store-autoloads recentf tree-widget esxml-query nov-autoloads
esxml-autoloads kv-autoloads pdf-virtual pdf-sync pdf-loader pdf-links
ibuf-ext ibuffer ibuffer-loaddefs pdf-tools pdf-isearch let-alist
tablist pdf-misc pdf-view jka-compr pdf-cache pdf-info tq pdf-util
pdf-macs image-mode exif pdf-tools-autoloads tablist-filter
semantic/wisent/comp semantic/wisent semantic/wisent/wisent
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet tablist-autoloads restclient
ob-restclient-autoloads restclient-autoloads elfeed-show elfeed-search
elfeed-csv elfeed elfeed-curl xml-query bookmark elfeed-log elfeed-db
elfeed-lib avl-tree elfeed-autoloads plantuml-mode-autoloads 
groovy-mode
groovy-mode-autoloads inf-haskell haskell-indent haskell-completions
haskell-c2hs haskell-decl-scan quail highlight-uses-mode 
haskell-modules
haskell-sandbox haskell-navigate-imports haskell-repl haskell-svg
haskell-collapse haskell-debug haskell-interactive-mode
haskell-presentation-mode haskell-compile haskell-process
haskell-session haskell-hoogle haskell-mode haskell-cabal 
haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support etags fileloop dabbrev
haskell-customize haskell-mode-autoloads pip-requirements-autoloads
py-yapf-autoloads blacken-autoloads eshell esh-cmd esh-ext esh-opt
esh-proc esh-io esh-arg esh-module esh-groups esh-util 
pyvenv-autoloads
web-mode-autoloads cc-mode cc-fonts cc-guess cc-menus cc-cmds 
cc-styles
cc-align cc-engine cc-vars typescript-mode-autoloads
add-node-modules-path-autoloads prettier-js-autoloads clj-refactor
cap-words superword subword inflections sgml-mode facemenu cider
multiple-cursors-core paredit edmacro kmacro clj-refactor-autoloads
inflections-autoloads hydra-examples windmove rect hydra lv
hydra-autoloads lv-autoloads tramp-sh cider-debug cider-repl-history
cider-scratch cider-mode cider-completion cider-profile 
cider-inspector
cider-eval cider-repl cider-test cider-stacktrace cider-overlays
cider-jar cider-browse-ns cider-eldoc apropos cider-find cider-resolve
cider-doc cider-browse-spec cider-clojuredocs cider-client
cider-connection sesman-browser nrepl-client queue parseedn 
cider-popup
cider-common xref cider-util clojure-mode nrepl-dict cider-autoloads
parseedn-autoloads parseclj-ast parseclj-parser parseclj-lex
parseclj-alist parseclj-autoloads generator queue-autoloads sesman
sesman-autoloads align imenu clojure-mode-autoloads sql-indent sql 
view
sql-indent-autoloads tramp tramp-loaddefs trampver tramp-integration
files-x tramp-compat shell parse-time iso8601 ls-lisp sh-script smie
treesit executable pkgbuild-mode-autoloads pulse datetime
logview-autoloads extmap datetime-autoloads bindat extmap-autoloads
ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help 
ediff-init
ediff-util vlf comp comp-cstr vlf-base vlf-tune vlf-autoloads csv-mode
sort csv-mode-autoloads nginx-mode-autoloads vimrc-mode-autoloads
generic ssh-config-mode-autoloads reformatter xml-format-autoloads
reformatter-autoloads edit-indirect-autoloads eww xdg url-queue shr
pixel-fill kinsoku url-file svg xml dom mm-url gnus nnheader range
ispell markdown-mode checkdoc markdown-mode-autoloads cc-defs
google-c-style-autoloads hideshow compat bicycle-autoloads 
flymake-proc
flymake flymake-kondor-autoloads thingatpt pcase
idle-highlight-mode-autoloads benchmark dtrt-indent
dtrt-indent-autoloads rainbow-mode-autoloads smartscan-autoloads cl
warnings org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src ob-comint org-pcomplete pcomplete org-list org-footnote
org-faces org-entities noutline outline ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs
cal-menu calendar cal-loaddefs org-version org-compat org-macs
format-spec ert-x ert ewoc advice edebug debug backtrace find-func 
color
yasnippet cl-extra help-mode yasnippet-autoloads easy-mmode tar-mode
arc-mode archive-mode rx project spinner dash s compile comint 
ansi-osc
ansi-color ring deadgrep-autoloads loaddefs-gen lisp-mnt radix-tree
mm-archive message sendmail yank-media dired dired-loaddefs rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date mailabbrev gmm-utils mailheader 
mm-decode
mm-bodies mm-encode mail-utils gnutls network-stream url-cache 
url-http
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-gw nsm puny finder-inf cus-edit pp cus-load icons
wid-edit org-tree-slide-autoloads flyspell-correct-autoloads
avy-autoloads dired-git-info-autoloads consult-autoloads
paredit-autoloads org-roam-autoloads orderless-autoloads
zenburn-theme-autoloads emacsql-autoloads perspective-autoloads
dired-subtree-autoloads dired-hacks-utils-autoloads spinner-autoloads
projectile-autoloads alert-autoloads ox-slack-autoloads
ob-async-autoloads org-contrib-autoloads vertico-autoloads
org-mime-autoloads gitignore-templates-autoloads gntp-autoloads
multiple-cursors-autoloads cape-autoloads expand-region-autoloads
corfu-autoloads modus-themes-autoloads log4e-autoloads rg-autoloads
ox-jira-autoloads diff-hl-autoloads wgrep-autoloads ox-gfm-autoloads
minions-autoloads magit-todos-autoloads magit-autoloads
magit-section-autoloads git-commit-autoloads with-editor-autoloads
transient-autoloads hl-todo-autoloads compat-autoloads f-autoloads
s-autoloads async-autoloads winum-autoloads info dash-autoloads
smartparens-autoloads exec-path-from-shell-autoloads pcre2el-autoloads
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode 
mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win 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 nadvice seq simple 
cl-generic
indonesian philippine 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 abbrev obarray oclosure cl-preloaded button 
loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget 
keymap
hashtable-print-readable backquote threads xwidget-internal kqueue 
cocoa
ns lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 2143246 339464)
 (symbols 48 94996 15)
 (strings 32 572919 28667)
 (string-bytes 1 18251781)
 (vectors 16 633685)
 (vector-slots 8 6186275 1024946)
 (floats 8 183470 3099)
 (intervals 56 16287 4741)
 (buffers 984 71))

-- 
Best regards, Roman