bug#73102: 29.4; `package-recompile-all' should skip packages installed by distro package manager

2024-09-07 Thread Zhengyi Fu
When I try recompiling all packages installed by package.el with `M-x
package-recompile-all', I got the following error:

Debugger entered--Lisp error: (permission-denied "Removing old name" 
"Permission denied" "/usr/share/emacs/site-lisp/elpa/mu4e-1.10.8/mu4e-a...")
  package-recompile(#s(package-desc :name mu4e :version (1 10 8) :summary "the 
mu mail user agent" :reqs nil :kind nil :archive nil :dir 
"/usr/share/emacs/site-lisp/elpa/mu4e-1.10.8" :extras nil :signed nil))
  package-recompile-all()
  funcall-interactively(package-recompile-all)
  command-execute(package-recompile-all record)
  execute-extended-command(nil "package-recompile-all" "recom all")
  funcall-interactively(execute-extended-command nil "package-recompile-all" 
"recom all")
  command-execute(execute-extended-command)

This is possibly because the package `mu4e' was installed by the distro
package manager in a path where normal users don't have write access.

I think `package-recompile-all' should either skip those packages that
are not installed by package.el or ignore such errors and continue to
recompile other packages.


In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
 cairo version 1.16.0) of 2024-07-22, modified by Debian built on
 x86-ubc-01
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/reproducible-path/emacs-29.4+1=. 
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LC_ALL: C
  value of $LC_MONETARY: zh_CN.UTF-8
  value of $LANG: zh_CN.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: nil

Major mode: Help

Minor modes in effect:
  consult-denote-mode: t
  denote-menu-bar-mode: t
  TeX-PDF-mode: t
  magit-wip-initial-backup-mode: t
  magit-wip-before-change-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  magit-wip-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  sly-symbol-completion-mode: t
  eat-eshell-visual-command-mode: t
  eat-eshell-mode: t
  shell-dirtrack-mode: t
  xterm-mouse-mode: t
  term-keys-mode: t
  server-mode: t
  lin-global-mode: t
  savehist-mode: t
  repeat-mode: t
  global-diff-hl-mode: t
  global-auto-revert-mode: t
  save-place-mode: t
  recentf-mode: t
  activities-tabs-mode: t
  activities-mode: t
  windmove-mode: t
  corfu-terminal-mode: t
  corfu-popupinfo-mode: t
  corfu-history-mode: t
  global-corfu-mode: t
  corfu-mode: t
  nerd-icons-completion-mode: t
  marginalia-mode: t
  vertico-multiform-mode: t
  vertico-mode: t
  pixel-scroll-mode: t
  spacious-padding-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  isearch-fold-quotes-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: 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:
/home/zhengyi/.emacs.d/elpa/magit-4.1.0/magit-autorevert hides 
/home/zhengyi/.emacs.d/elpa/magit-section-4.1.0/magit-autorevert
/home/zhengyi/.emacs.d/site-lisp/gtags hides 
/usr/share/emacs/site-lisp/global/gtags
/usr/share/emacs/site-lisp/elpa/mu4e-1.10.8/mu4e hides 
/usr/share/emacs/site-lisp/elpa-src/mu4e-1.10.8/mu4e
/usr/share/emacs/site-lisp/elpa/mu4e-1.10.8/mu4e-window hides 
/usr/share/emacs/site-lisp/elpa-src/mu4e-1.10.8/mu4e-window
/usr/share/emacs/site-lisp/elpa/mu4e-1.10.8/mu4e-view hides 
/usr/share/emacs/site-lisp/elpa-src/mu4e-1.10.8/mu4e-view
/usr/share/emacs/site-lisp

bug#73102: 29.4; `package-recompile-all' should skip packages installed by distro package manager

2024-09-10 Thread Zhengyi Fu
Philip Kaludercic  writes:

> Zhengyi Fu  writes:
>
>> When I try recompiling all packages installed by package.el with `M-x
>> package-recompile-all', I got the following error:
>>
>> Debugger entered--Lisp error: (permission-denied "Removing old name"
>> "Permission denied"
>> "/usr/share/emacs/site-lisp/elpa/mu4e-1.10.8/mu4e-a...")
>>   package-recompile(#s(package-desc :name mu4e :version (1 10 8)
>> :summary "the mu mail user agent" :reqs nil :kind nil :archive nil
>> :dir "/usr/share/emacs/site-lisp/elpa/mu4e-1.10.8" :extras nil
>> :signed nil))
>>   package-recompile-all()
>>   funcall-interactively(package-recompile-all)
>>   command-execute(package-recompile-all record)
>>   execute-extended-command(nil "package-recompile-all" "recom all")
>>   funcall-interactively(execute-extended-command nil "package-recompile-all" 
>> "recom all")
>>   command-execute(execute-extended-command)
>>
>> This is possibly because the package `mu4e' was installed by the distro
>> package manager in a path where normal users don't have write access.
>>
>> I think `package-recompile-all' should either skip those packages that
>> are not installed by package.el or ignore such errors and continue to
>> recompile other packages.
>
> We have installed a patch in Bug#68678 on master (the commit is from
> last February, so you wouldn't see it yet on 29.4) that wraps the
> `package-recompile' call in a `with-demoted-errors' block.  That would
> still emit a error message, but it wouldn't break the recompilation
> procedure.  Do you think that is enough, or should be explicitly and
> additionally avoid re-compiling external packages?

Yes.  That patch is enough for me.  Thanks!!

-- 
Zhengyi Fu