Subject: bug#79188: 31.0.50; Cannot build packages installed from VC

From: Philip Kaludercic <[email-masked]>
Date: Thu, 07 Aug 2025 12:55:43 +0000

Przemyslaw Kryger <[email-masked]> writes:

> I am using package-vc to manage a few pakcages I maintain.  However, in Emacs
> 31 I observed a couple issues.
>
> The first discrepancy with what used to happen on Emacs 30 is when a package is
> installed from a custom location, no *.elc files are produced.  I don't know
> what the expected behaviour should be here.
>
> In addition to that when I attempt to rebuild such a package with
> package-vc-rebuild it signals an error, which I believe shouldn't happen,
> should it?  In this case no *.elc files have been produced nor updated.  Such a
> workflow used to work on Emacs 30.

Both of these shouldn't happen.

> I observed this on a Emacs macport (from
> https://github.com/jdtsmith/emacs-mac/tree/emacs-mac-gnu_master_exp), but the
> issue is reproducible on master (68aaeb3519fd7f6176050e142f0dbc27e07992d2) as
> well.
>
> git clone https://github.com/pkryger/helm-projectile "${HOME}/tmp/helm-projectile"
> emacs -Q
>
> (require 'package)
> (add-to-list 'package-archives '(melpa . "https://melpa.org/packages/"))
                                   ^
                                   this should be a string!

> ;; Just to avoid using existing elpa
> (setq package-user-dir (expand-file-name "tmp/elpa" (getenv "HOME")))

(Unrelated, but is there a reason you aren't doing (expand-file-name
"~/tmp/elpa")?)

> (package-refresh-contents)
> ;; In my config I use hardcoded paths, but `use-package' needs a
> ;; string for `:load-path', so just for this sample
> (let ((pkg-dir (expand-file-name "tmp/helm-projectile" (getenv "HOME"))))
>   (eval
>    `(use-package helm-projectile
>       :vc t
>       :load-path ,pkg-dir)))

For posterity, this expands to

--8<---------------cut here---------------start------------->8---
(progn
  (eval-and-compile (add-to-list 'load-path "/tmp/helm-projectile/"))
  (use-package-vc-install '(helm-projectile) "/tmp/helm-projectile/")
  (defvar use-package--warning0
    #'(lambda (keyword err)
	(let
	    ((msg
	      (format "%s/%s: %s" 'helm-projectile keyword
		      (error-message-string err))))
	  (display-warning 'use-package msg :error))))
  (condition-case-unless-debug err
      (if (not (require 'helm-projectile nil t))
	  (display-warning 'use-package
			   (format "Cannot load %s" 'helm-projectile)
			   :error))
    (error (funcall use-package--warning0 :catch err))))
--8<---------------cut here---------------end--------------->8---

which for us means that we are interested in

(use-package-vc-install '(helm-projectile) "/tmp/helm-projectile/")

which in turn would invoke

(package-vc-install-from-checkout "/tmp/helm-projectile/" "helm-projectile")

>       
> ;; At this point `helm-projectile' has been installed, but no *.elc files are
> ;; produced, which differs from Emacs 30.
>
> (setq debug-on-error t)
> M-x package-vc-rebuild RET helm-projectile RET
>
> Which yields the following:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   expand-file-name(nil)
>   vc-file-getprop(nil vc-working-revision)
>   vc-working-revision(nil)
>   package-vc--unpack-1(#s(package-desc :name helm-projectile :version (1 3 1) :summary "Helm integration for Projectile" :reqs nil :kind vc :archive nil :dir "/Users/pkryger/tmp/elpa/helm-projectile/" :extras ((:commit . "2ecd3d85b7077f39bb2fefe2227cc46931d4b92b")) :signed nil) "/Users/pkryger/tmp/elpa/helm-projectile/")
>   package-vc-rebuild(#s(package-desc :name helm-projectile :version (1 3 1) :summary "Helm integration for Projectile" :reqs nil :kind vc :archive nil :dir "/Users/pkryger/tmp/elpa/helm-projectile/" :extras ((:commit . "2ecd3d85b7077f39bb2fefe2227cc46931d4b92b")) :signed nil))
>   funcall-interactively(package-vc-rebuild #s(package-desc :name helm-projectile :version (1 3 1) :summary "Helm integration for Projectile" :reqs nil :kind vc :archive nil :dir "/Users/pkryger/tmp/elpa/helm-projectile/" :extras ((:commit . "2ecd3d85b7077f39bb2fefe2227cc46931d4b92b")) :signed nil))
>   call-interactively(package-vc-rebuild record nil)
>   command-execute(package-vc-rebuild record)
>   execute-extended-command(nil "package-vc-rebuild" "pack-v-re")
>   funcall-interactively(execute-extended-command nil "package-vc-rebuild" "pack-v-re")
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)

I couldn't reproduce this stack trace :/  It seems like
`package-vc--main-file' returned nil.  Can you check what the function
returns, perhaps using edebug?

> Could these be introduced by  4226eb2b20408ba49787195bbc59bb0066c9c9e4?

That seems reasonable, but in that case we should be able to reproduce
the issue with a more simple example (especially one that doesn't involve
use-package, MELPA and missing dependencies).  I tried it out with a
local package I had lying around and I also noticed that we don't
byte-compile files anymore!

This should fix the first issue, but it probably won't change anything
about the latter:

diff --git a/lisp/package/package-vc.el b/lisp/package/package-vc.el
index db12c76133e..f2c7c460f6d 100644
--- a/lisp/package/package-vc.el
+++ b/lisp/package/package-vc.el
@@ -549,7 +549,14 @@ package-vc--unpack-1
         ;; FIXME: Compilation should be done as a separate, optional, step.
         ;; E.g. for multi-package installs, we should first install all packages
         ;; and then compile them.
-        (package--compile new-desc)
+        (package--compile
+         (if lisp-dir
+             ;; In case we are installing a package from a local
+             ;; checkout, we want to compile the checkout, not the
+             ;; redirection!
+             (package-desc-create :dir lisp-dir)
+          new-desc))
+
         (when package-native-compile
           (package--native-compile-async new-desc))
         ;; After compilation, load again any files loaded by

>
> In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.5.0, X toolkit,
>  cairo version 1.18.4, Xaw3d scroll bars) of 2025-08-07 built on
>  Przemyslaws-MacBook-Air.local
> Repository revision: 68aaeb3519fd7f6176050e142f0dbc27e07992d2
> Repository branch: master
> System Description:  macOS 15.5
>
> Configured using:
>  'configure --without-ns --with-gnutls --with-modules
>  --with-native-compilation=no --with-jpeg=ifavailable
>  --with-gif=ifavailable --with-tiff=ifavailable CFLAGS=-O3'
>
> Configured features:
> ACL CAIRO FREETYPE GLIB GNUTLS GSETTINGS HARFBUZZ LCMS2 LIBXML2 MODULES
> NOTIFY KQUEUE PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS
> TREE_SITTER WEBP X11 XAW3D XDBE XIM XINERAMA XPM XRANDR LUCID ZLIB
>
> Important settings:
>   value of $LANG: en_GB.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: Lisp Interaction
>
> Minor modes in effect:
>   xterm-mouse-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   eldoc-mode: t
>   show-paren-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   minibuffer-regexp-mode: t
>   line-number-mode: t
>   indent-tabs-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>
> Load-path shadows:
> /Users/pkryger/tmp/elpa/helm-4.0.4/helm-packages hides /Users/pkryger/tmp/elpa/helm-core-4.0.4/helm-packages
> /Users/pkryger/tmp/elpa/helm-4.0.4/helm-x-icons hides /Users/pkryger/tmp/elpa/helm-core-4.0.4/helm-x-icons
>
> Features:
> (shadow sort mail-extr emacsbug use-package-ensure help-fns cl-print
> debug backtrace find-func helm-projectile projectile helm-files
> image-dired image-dired-tags image-dired-external image-dired-util
> image-mode exif filenotify dired-x ffap tramp rx trampver
> tramp-integration tramp-message tramp-compat shell pcomplete parse-time
> iso8601 tramp-loaddefs helm-tags helm-buffers helm-x-icons helm-occur
> helm-grep helm-regexp format-spec helm-utils helm-locate helm-help helm
> helm-types helm-global-bindings helm-easymenu edmacro kmacro helm-core
> helm-source helm-multi-match helm-lib cus-edit pp cus-start cus-load
> wid-edit helm-projectile-autoloads helm-autoloads helm-core-autoloads
> vc-git diff-mode track-changes files-x wfnames-autoloads smtpmail
> dired-async dired-aux async-bytecomp async bug-reference async-autoloads
> project skeleton ibuf-macs pcase find-dired grep ibuf-ext ibuffer
> ibuffer-loaddefs thingatpt compile comint ansi-osc ansi-color ring
> projectile-autoloads easy-mmode loaddefs-gen radix-tree tar-mode
> arc-mode archive-mode package-vc vc vc-dispatcher lisp-mnt cl-extra
> help-mode use-package-core finder-inf mm-archive message sendmail
> yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util
> text-property-search mailabbrev gmm-utils mailheader mm-decode mm-bodies
> mm-encode mail-utils gnutls network-stream url-cache warnings url-http
> url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
> mail-prsvr url-gw nsm puny epg rfc6068 epg-config package browse-url xdg
> 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 icons password-cache json
> map url-vars time-date subr-x cl-loaddefs cl-lib xt-mouse term/xterm
> xterm byte-opt gv bytecomp byte-compile rmc iso-transl tooltip cconv
> eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
> elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen
> 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 kqueue
> lcms2 dynamic-setting system-font-setting font-render-setting cairo
> x-toolkit x multi-tty move-toolbar make-network-process tty-child-frames
> emacs)
>
> Memory information:
> ((conses 16 349318 58285) (symbols 48 22829 1) (strings 32 68024 3090)
>  (string-bytes 1 2006739) (vectors 16 34746)
>  (vector-slots 8 661887 21587) (floats 8 132 421)
>  (intervals 56 1420 25) (buffers 1064 20))
>
>

-- 
Philip Kaludercic