unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45854: 28.0.50; [feature/native-comp] autoload behavior different in the presence of errors
@ 2021-01-14  2:52 Mauricio Collares
       [not found] ` <handler.45854.B.161059277013405.ack@debbugs.gnu.org>
  2021-01-17 15:29 ` Andrea Corallo
  0 siblings, 2 replies; 15+ messages in thread
From: Mauricio Collares @ 2021-01-14  2:52 UTC (permalink / raw)
  To: 45854


The example is a bit convoluted, but it is a reduced example from
another error I saw in the wild. It's not a big problem, but since this
might be a bug I thought a report could be useful. I wish I could reduce
it further, but hopefully this is enough.

Suppose I have three files as below (I've appended an x to the original package
names to avoid conflict):

* File 1: transientx.el

;;; transientx.el --- x -*- lexical-binding: t; -*-

;; Package-Requires: ((emacs "25.1"))
;; Package-Version: 0

(require 'cl-lib)
(require 'eieio)

(defclass transient-suffix () ())
(cl-defmethod transient--init-suffix-key ((obj transient-suffix)))

;; (provide 'transientx) commented on purpose to cause an error when requiring
;;; transientx.el ends here

* File 2: git-commitx.el

;;; git-commitx.el --- x  -*- lexical-binding: t; -*-

;; Package-Requires: ((emacs "25.1") (transientx "20200601"))
;; Package-Version: 20210102.1242

(require 'transientx)

;;;###autoload
(define-minor-mode global-git-commit-mode
  "desc"
  :global t
  :initialize (lambda (symbol exp)
                (add-hook 'find-file-hook 'git-commit-setup-check-buffer)))

;;;###autoload
(defun git-commit-setup-check-buffer ())

(provide 'git-commitx)

;;; git-commitx.el ends here

* File 3: elpa2nix.el

(require 'package)
(package-initialize)

(defun elpa2nix-install-package ()
  (pcase command-line-args-left
    (`(,archive)
     (with-temp-buffer
       (insert-file-contents archive)
       (package-unpack (package-buffer-info))))))

Then running the following two commands in order produces the stack
trace below on the native-comp branch:

$ emacs --batch -Q -l ~/elpa2nix.el -f elpa2nix-install-package transientx.el 
$ emacs --batch -Q -l ~/elpa2nix.el -f elpa2nix-install-package git-commitx.el 

git-commitx.el:6:1: Error: Loading file /home/collares/.emacs.d/elpa/transientx-0/transientx.elc failed to provide feature ‘transientx’
Done (Total of 0 files compiled, 1 failed, 2 skipped)

Debugger entered--Lisp error: (error "transient--init-suffix-key is already defined as s...")
  error("%s is already defined as something else than a gen..." transient--init-suffix-key)
  cl-generic-ensure-function(transient--init-suffix-key)
  cl-generic-define-method(transient--init-suffix-key nil ((obj transient-suffix)) nil #f(compiled-function (obj) #<bytecode 0x1bd084804d24a6d3>))
  require(transientx)
  load-with-code-conversion("/home/collares/.emacs.d/elpa/git-commitx-20210102...." "/home/collares/.emacs.d/elpa/git-commitx-20210102...." nil t)
  git-commit-setup-check-buffer()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer git-commitx.el> "~/git-commitx.el" nil nil "~/git-commitx.el" (7340496 65025))
  find-file-noselect("/home/collares/git-commitx.el")
  command-line-1(("-l" "/home/collares/elpa2nix.el" "-f" "elpa2nix-install-package" "/home/collares/git-commitx.el"))
  command-line()
  normal-top-level()

The transient--init-suffix-key error does not appear on trunk (the
"failed to provide feature" error appears as expected). Reverting commit
7d7bfbf0346114b116e14a4338ea235d12674f13 makes the change of behaviour
disappear, but I suspect it's not the true cause of the difference.

Things that might be relevant: package-native-compile is nil, but when
package-unpack is called on git-commitx.el the (require 'transientx)
causes native compilation to happen. The above stacktrace seems to come
from the "(package--load-files-for-activation new-desc :reload)" call in
package.el's package-unpack.

Let me know if I can provide more information.

Best,
Mauricio





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-02-01 14:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14  2:52 bug#45854: 28.0.50; [feature/native-comp] autoload behavior different in the presence of errors Mauricio Collares
     [not found] ` <handler.45854.B.161059277013405.ack@debbugs.gnu.org>
2021-01-14 12:01   ` Mauricio Collares
2021-01-14 14:23     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-17 16:03       ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-17 15:29 ` Andrea Corallo
2021-01-17 15:32   ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-18 12:36   ` Mauricio Collares
2021-01-18 20:56     ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-22 22:00       ` Mauricio Collares
2021-01-28 21:11         ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-28 22:04           ` Mauricio Collares
2021-01-29  9:08             ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-30 14:24               ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-01 12:49                 ` Mauricio Collares
2021-02-01 14:00                   ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).