unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauricio Collares <mauricio@collares.org>
To: 45854@debbugs.gnu.org
Subject: bug#45854: 28.0.50; [feature/native-comp] autoload behavior different in the presence of errors
Date: Wed, 13 Jan 2021 23:52:29 -0300	[thread overview]
Message-ID: <87pn282psi.fsf@collares.org> (raw)


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





             reply	other threads:[~2021-01-14  2:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14  2:52 Mauricio Collares [this message]
     [not found] ` <handler.45854.B.161059277013405.ack@debbugs.gnu.org>
2021-01-14 12:01   ` bug#45854: 28.0.50; [feature/native-comp] autoload behavior different in the presence of errors 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pn282psi.fsf@collares.org \
    --to=mauricio@collares.org \
    --cc=45854@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).