Doom-emacs: doom --yes upgrade asks for y/n confirmation

Created on 30 Oct 2020  ·  11Comments  ·  Source: hlissner/doom-emacs

I expected doom upgrade --yes to allow an unattended upgrade

However, I am prompted twice for y/n, making it more difficult to automate.

λ .emacs.d/bin/doom --yes upgrade
- Confirmations auto-accept enabled
> Preparing to upgrade Doom Emacs and its packages...
- A new version of Doom Emacs is available!

  Old revision: adff1aa68d (8 days ago)
  New revision: 57ef63d6ba (22 hours ago)

Link to diff: https://github.com/hlissner/doom-emacs/compare/adff1aa68da379370cfd6a7605fc15c28ade52f1...57ef63d6ba8432067a2c32cca3f5ccd369d21099
View the comparison diff in your browser? (y or n) n
Proceed with upgrade? (y or n) y

Steps to reproduce:

  1. run `doom --yes upgrade
  2. observe it asks you twice for y/n

System information:

SYSTEM  type       gnu/linux
    config     x86_64-pc-linux-gnu
    shell      /usr/bin/fish
    uname      Linux 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64
    path       (~/.pyenv/shims ~/.pyenv/bin /snap/bin/ ~/.local/share/junest/bin ~/.nimble/bin ~/.cargo/bin/ ~/.scripts/bin ~/.fzf/bin ~/.nix-profile/bin ~/.cargo/bin ~/.local/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /usr/lib/emacs/27.1/x86_64-linux-gnu)
EMACS   dir        ~/.emacs.d/
    version    27.1
    build      Sep 19, 2020
    buildopts  --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/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp --program-suffix=27 --with-modules --with-file-notification=inotify --with-mailutils --with-harfbuzz --with-json --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/emacs27-bifpWT/emacs27-27.1~1.git86d8d76aa3=. -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'
    features   XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP
    traits     (batch envvar-file)
DOOM    dir        ~/SparkleShare/github.com/dropbox/scripts/doom.d/
    version    2.0.9
    build      HEAD -> develop 57ef63d6b 2020-10-29 05:42:10 -0400
    elc-files  0
    modules    (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo ligatures minimap modeline ophints (popup +defaults) vc-gutter vi-tilde-fringe workspaces :editor (evil +everywhere) file-templates fold snippets :emacs dired electric undo vc :term vterm :checkers syntax spell grammar :tools (eval +overlay) lookup lsp magit terraform :os tty :lang emacs-lisp json javascript markdown nim org python rest rust sh web yaml :app calendar twitter :config (default +bindings +smartparens))
    packages   ((olivetti) (todoist) (alda-mode) (system-packages) (w3m) (rustic) (org-superstar))
    unpin      (n/a)
    elpa       (n/a)
bidoom unknown

Most helpful comment

Here's a Dockerfile that repros the issue.

FROM iquiw/alpine-emacs

RUN apk update && \
        apk add \
        bash \
        git \
        make \
        curl \
        cifs-utils \
        nano

RUN adduser -S doomer

ENV HOME=/home/doomer
ENV TERM=xterm-256color

WORKDIR ${HOME}

USER doomer

RUN git clone --depth 1 https://github.com/hlissner/doom-emacs ${HOME}/.emacs.d

RUN ${HOME}/.emacs.d/bin/doom -y install

All 11 comments

I can confirm this behavior too.

Can you try doom -y upgrade ?

Same behaviour

λ .emacs.d/bin/doom -y upgrade
- Confirmations auto-accept enabled
> Preparing to upgrade Doom Emacs and its packages...
- A new version of Doom Emacs is available!

  Old revision: 57ef63d6ba (4 days ago)
  New revision: fcdd238291 (12 hours ago)

Link to diff: https://github.com/hlissner/doom-emacs/compare/57ef63d6ba8432067a2c32cca3f5ccd369d21099...fcdd238291f0831ccc0de5badf73dd68c0c9e61f
View the comparison diff in your browser? (y or n) ^C⏎                                                   ~ via  v3.7.8 took 3s 
λ .emacs.d/bin/doom --yes upgrade
- Confirmations auto-accept enabled
> Preparing to upgrade Doom Emacs and its packages...
- A new version of Doom Emacs is available!

  Old revision: 57ef63d6ba (4 days ago)
  New revision: fcdd238291 (12 hours ago)

Link to diff: https://github.com/hlissner/doom-emacs/compare/57ef63d6ba8432067a2c32cca3f5ccd369d21099...fcdd238291f0831ccc0de5badf73dd68c0c9e61f
View the comparison diff in your browser? (y or n) ^C⏎ 

This issue probably is caused by the same reason as #4199.

This is also an issue when running doom install as it asks whether do download the all-the-icon's fonts.

$ ~/.emacs.d/bin/doom -y install

- Confirmations auto-accept enabled
Installing Doom Emacs!

> Creating .dotfiles/doom.d/
  ✓ Created .dotfiles/doom.d/
! init.el already exists, skipping
! config.el already exists, skipping
! packages.el already exists, skipping
- Envvar file already exists, skipping
Installing plugins
> Installing packages...
  - No packages need to be installed
Regenerating autoloads files
> (Re)generating autoloads file...
  > Generating autoloads file...
  > Byte-compiling autoloads file...
  ✓ Generated .local/autoloads.26.3.elc
Download and install all-the-icon's fonts? (y or n) 

My current solution is to pipe yes to it.

$ yes | ~/.emacs.d/bin/doom install

Nice workaround

Sorry folks, I cannot reproduce this. On my nixos, arch, and macOS VMs doom -y upgrade successfully suppresses confirmation prompts (and on 26.3, 27.1 and 28). Not sure where to dig deeper into this.

Here's a Dockerfile that repros the issue.

FROM iquiw/alpine-emacs

RUN apk update && \
        apk add \
        bash \
        git \
        make \
        curl \
        cifs-utils \
        nano

RUN adduser -S doomer

ENV HOME=/home/doomer
ENV TERM=xterm-256color

WORKDIR ${HOME}

USER doomer

RUN git clone --depth 1 https://github.com/hlissner/doom-emacs ${HOME}/.emacs.d

RUN ${HOME}/.emacs.d/bin/doom -y install

If you remove --depth 1 from git clone, it still does not work, and if you run yes | ${HOME}/.emacs.d/bin/doom -y install runs successfully.

Genius plan reproducing this in Docker. I can confirm it breaks on expecting stdin to be available for the y/n.

If you can't run docker, here's the output:

λ docker build .
Sending build context to Docker daemon  2.048kB
Step 1/9 : FROM iquiw/alpine-emacs
latest: Pulling from iquiw/alpine-emacs
df20fa9351a1: Pull complete 
7d84d9267211: Pull complete 
f363778734a0: Pull complete 
ec76021a3b62: Pull complete 
Digest: sha256:2fbfcc6bdaedd41543eee0c4d6a8eaaa140620325b8291d9273d86b6e71ac14e
Status: Downloaded newer image for iquiw/alpine-emacs:latest
 ---> 0de150cd3b1d
Step 2/9 : RUN apk update &&         apk add         bash         git         make         curl         cifs-utils         nano
 ---> Running in 443a35552ab8
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
v3.12.1-32-g3dc1dba8df [http://dl-cdn.alpinelinux.org/alpine/v3.12/main]
v3.12.1-33-ge462514615 [http://dl-cdn.alpinelinux.org/alpine/v3.12/community]
OK: 12752 distinct packages available
(1/22) Installing readline (8.0.4-r0)
(2/22) Installing bash (5.0.17-r0)
Executing bash-5.0.17-r0.post-install
(3/22) Installing libcap (2.27-r0)
(4/22) Installing keyutils-libs (1.6.1-r1)
(5/22) Installing krb5-conf (1.0-r2)
(6/22) Installing libcom_err (1.45.6-r0)
(7/22) Installing libverto (0.3.1-r1)
(8/22) Installing krb5-libs (1.18.2-r0)
(9/22) Installing talloc (2.3.1-r0)
(10/22) Installing tevent (0.10.2-r0)
(11/22) Installing samba-util-libs (4.12.9-r0)
(12/22) Installing libwbclient (4.12.9-r0)
(13/22) Installing cifs-utils (6.10-r1)
(14/22) Installing nghttp2-libs (1.41.0-r0)
(15/22) Installing libcurl (7.69.1-r1)
(16/22) Installing curl (7.69.1-r1)
(17/22) Installing expat (2.2.9-r1)
(18/22) Installing pcre2 (10.35-r0)
(19/22) Installing git (2.26.2-r0)
(20/22) Installing make (4.3-r0)
(21/22) Installing libmagic (5.38-r0)
(22/22) Installing nano (4.9.3-r0)
Executing busybox-1.31.1-r16.trigger
OK: 170 MiB in 50 packages
Removing intermediate container 443a35552ab8
 ---> 142f7e3e073c
Step 3/9 : RUN adduser -S doomer
 ---> Running in 76bcf3e69be9
Removing intermediate container 76bcf3e69be9
 ---> a9cb7e186f72
Step 4/9 : ENV HOME=/home/doomer
 ---> Running in ae36b98cd3df
Removing intermediate container ae36b98cd3df
 ---> 7352f8e50354
Step 5/9 : ENV TERM=xterm-256color
 ---> Running in caa8372162de
Removing intermediate container caa8372162de
 ---> c00ab4a45465
Step 6/9 : WORKDIR ${HOME}
 ---> Running in 704b99da3709
Removing intermediate container 704b99da3709
 ---> e9e3e6cdd209
Step 7/9 : USER doomer
 ---> Running in 8bf01ab631ac
Removing intermediate container 8bf01ab631ac
 ---> 7afab0a6c7e7
Step 8/9 : RUN git clone --depth 1 https://github.com/hlissner/doom-emacs ${HOME}/.emacs.d
 ---> Running in 48e0b9f54e71
Cloning into '/home/doomer/.emacs.d'...
Removing intermediate container 48e0b9f54e71
 ---> d9902a504d39
Step 9/9 : RUN ${HOME}/.emacs.d/bin/doom -y install
 ---> Running in db747ecb4754
Installing straight...
Cloning use-package...
Cloning use-package...done
Building use-package...
Building use-package -> Building bind-key...
Building use-package -> Building bind-key...done
Building use-package...
Building use-package...done
- Confirmations auto-accept enabled
Installing Doom Emacs!

> Creating .doom.d/
  ✓ Created .doom.d/
- Creating .doom.d/init.el
✓ Done!
- Creating .doom.d/config.el
✓ Done!
- Creating .doom.d/packages.el
✓ Done!
Generate an envvar file? (see `doom help env` for details) (y or n) x There was an unexpected error
  Message: error
  Data: (error . "Error reading from stdin")
  Backtrace:
    (read-string "Generate an envvar file? (see `doom help env` for details) (
    (y-or-n-p "Generate an envvar file? (see `doom help env` for details)")
    (or doom-auto-accept (y-or-n-p "Generate an envvar file? (see `doom help e
    (if (or doom-auto-accept (y-or-n-p "Generate an envvar file? (see `doom he
    (if (file-exists-p doom-env-file) (doom--print (doom--format (format (doom
    (if noenv-p (doom--print (doom--format (format (doom--output-class (quote 
    (let ((default-directory (doom-path "~"))) (if noconfig-p (doom--print (do
    (let ((noconfig-p (cdr (assq (quote noconfig-p) --alist--))) (noenv-p (cdr
    ((closure ((plist) (aliases i) (name . install) t) (--alist--) (ignore --a
    (funcall (closure ((plist) (aliases i) (name . install) t) (--alist--) (ig
! Extended backtrace logged to .emacs.d/.local/doom.error.log
The command '/bin/sh -c ${HOME}/.emacs.d/bin/doom -y install' returned a non-zero code: 255

I've realised that piping yes into it isn't a very good solution, as it'll open your default browser:

View the comparison diff in your browser? (y or n) y
Proceed with upgrade? (y or n) y

:-/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gilbertw1 picture gilbertw1  ·  3Comments

luisenrike picture luisenrike  ·  3Comments

governorgoat picture governorgoat  ·  3Comments

rgrinberg picture rgrinberg  ·  3Comments

idoo picture idoo  ·  3Comments