Straight.el: Alert package not compiled correctly since recent commits

Created on 23 Jan 2021  ยท  4Comments  ยท  Source: raxod502/straight.el

Hello,

Intro

I faced a bug that is related to
Alert package, but as I'm having it
in one of my Emacs config copies and not in an earlier one, that makes
it somehow not specific to Alert package. So, I debugged it till I
figured what the real cause is. It turned out that since byte compile
in child process
(#657)

commit, building Alert is not correctly handled. You can notice that by
two factors:

  1. In /straight/build/alert/alert.elc file.

    • (defalias 'alert-log-notify' ...) is not completely compiled, not

      like a compiled version in a Straight commit before the one

      mentioned above.

  2. When evaluating (alert "test") an error will shows up:
Debugger entered--Lisp error: (invalid-function log4e:deflogger)
  log4e:deflogger("alert" "%t [%l] %m" "%H:%M:%S")
  alert-log-notify((:message "test" :title "*scratch*" :icon nil :severity normal :category nil :buffer #<buffer *scratch*> :mode lisp-interaction-mode :id nil :data nil))
  alert("test")
  (progn (alert "test"))
  eval((progn (alert "test")) t)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

How to reproduce the bug

Here are the steps to reproduce this bug:

  1. With init file that have only this:
(setq straight-repository-branch "develop")
(setq straight-base-dir user-emacs-directory)

(defvar bootstrap-version)

(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

(use-package alert
  :straight t)
  1. Launch Emacs and let it setup Straight.
  2. Switch to *scratch* buffer and evaluate (alert "test"). An error
    should occur.

No bug

No bug occur when checking out any commit before
48296ba018a37899b7766f9fb827da5f75eb8178, like this:

  1. Quit Emacs.
  2. Go (cd) to Straight repository directory.
  3. git checkout 8e99d311884f4983108d1d65cddb721ba43c939b.
  4. Trash or backup /straight/build/alert directory to let Straight
    build a new one.
  5. Launch Emacs and evaluate (alert "test"). No error occur.

A workaround (temporary)

I don't know if this bug should be fixed in Alert or Straight; anyway,
it's already issued there: [invalid-function: log4e:deflogger

93](https://github.com/jwiegley/alert/issues/93).

Simply let Straight with old commit, like mentioned in "No bug" section
above, compile Alert correctly. Then replace /straight/build/alert
directory with the one you compiled now.

Thank you!

Software info

  • Emacs 27.1 (Emacs Mac port 8.0)
  • straight.el =47dd03d= (2021-01-21 22:49:37 -0500)
  • alert =7046393= (2020-03-03 13:18:46 -0800)
bug byte compilation external command

All 4 comments

Thank you for the report. I can verify the behavior with the following test:

(straight-bug-report
  :user-dir "alert-byte-compile.develop"
  :preserve t
  :pre-bootstrap 
  (setq straight-repository-branch "develop")
  :post-bootstrap 
  (straight-use-package 'alert)
  (alert "test"))

  • Test run at: 2021-01-23 09:56:07
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> develop, origin/develop) 47dd03d 2021-01-21
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-01-18

Output

Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe โ†’ Cloning melpa...
Looking for gnu-elpa-mirror recipe โ†’ Cloning melpa...done
Looking for emacsmirror-mirror recipe โ†’ Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe โ†’ Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe โ†’ Cloning el-get...
Looking for emacsmirror-mirror recipe โ†’ Cloning el-get...done
Looking for straight recipe โ†’ Cloning emacsmirror-mirror...
Looking for straight recipe โ†’ Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 47dd03d 2021-01-21
Cloning alert...
Cloning alert...done
Building alert...
Building alert โ†’ Cloning gntp.el...
Building alert โ†’ Cloning gntp.el...done
Building alert โ†’ Building gntp...
Building alert โ†’ Building gntp...done
Building alert โ†’ Cloning log4e...
Building alert โ†’ Cloning log4e...done
Building alert โ†’ Building log4e...
Building alert โ†’ Building log4e...done
Building alert...
Building alert...done

Debugger entered--Lisp error: (invalid-function log4e:deflogger)
  log4e:deflogger("alert" "%t [%l] %m" "%H:%M:%S")
  alert-log-notify((:message "test" :title "*scratch*" :icon nil :severity normal :category nil :buffer #<buffer *scratch*> :mode lisp-interaction-mode :id nil :data nil))
  alert("test")
  (let ((straight-bug-report-args '(:post-bootstrap (progn (straight-use-package 'alert) (alert "test")) :pre-bootstrap (progn (setq straight-repository-branch "develop")) :preserve t :user-dir "/tmp/alert-byte-compile.develop" :executable "/usr/bin/emacs"))) (setq user-emacs-directory "/tmp/alert-byte-compile.develop") (setq straight-repository-branch "develop") (setq debug-on-error t) (setq straight-repository-branch "develop") (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously (concat "https://raw.githubusercontent.com/" "raxod502/straight.el/develop/install.el") 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (condition-case nil (message "Test run with version: %s" (straight-version)) (error nil)) (straight-use-package 'alert) (alert "test"))
  eval((let ((straight-bug-report-args '(:post-bootstrap (progn (straight-use-package ...) (alert "test")) :pre-bootstrap (progn (setq straight-repository-branch "develop")) :preserve t :user-dir "/tmp/alert-byte-compile.develop" :executable "/usr/bin/emacs"))) (setq user-emacs-directory "/tmp/alert-byte-compile.develop") (setq straight-repository-branch "develop") (setq debug-on-error t) (setq straight-repository-branch "develop") (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously (concat "https://raw.githubusercontent.com/" "raxod502/straight.el/develop/install.el") 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (condition-case nil (message "Test run with version: %s" (straight-version)) (error nil)) (straight-use-package 'alert) (alert "test")) t)
  command-line-1(("--eval" "(let\n    ((straight-bug-report-args\n      '(:post-..."))
  command-line()
  normal-top-level()


My initial hunch is that we're not adding package dependencies to the load-path in the compilation environment.
In this case alert requires log4e and its log4e:deflogger macro.
I will look into this more tonight and report back.

685 should take care of this.

I'd like to do a little more testing and work out one formatting issue before merging.
Will take care of that tomorrow.

I checked out the PR (685) and it worked with me regarding the bug I
issued.

Thank you for looking into this and for your valuable contributions to
this project.

No worries, take your time. I will leave this issue open to let you
close it when the time is right. Thanks!

I checked out the PR (685) and it worked with me regarding the bug I
issued.

Thank you for looking into this and for your valuable contributions to
this project.

Thank you for catching this bug, reporting, and testing.

No worries, take your time. I will leave this issue open to let you
close it when the time is right. Thanks!

Merged into latest "develop" https://github.com/raxod502/straight.el/commit/cd10de6895800802760d67d021e65da370c801f0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aspiers picture aspiers  ยท  4Comments

dertuxmalwieder picture dertuxmalwieder  ยท  3Comments

Fuco1 picture Fuco1  ยท  3Comments

agsdot picture agsdot  ยท  4Comments

eflanigan00 picture eflanigan00  ยท  4Comments