all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#49924: 28.0.50; `package-quickstart-refresh' fails for "long" (according to `print-length') `package-alist'
@ 2021-08-07  8:45 Pal Gloss
  2021-08-07 11:03 ` Lars Ingebrigtsen
  2021-08-07 14:02 ` bug#49924: e1ce9904aa5511468d295cac3221cb77de994331 does not fix #49924 Pal Gloss
  0 siblings, 2 replies; 4+ messages in thread
From: Pal Gloss @ 2021-08-07  8:45 UTC (permalink / raw)
  To: 49924

Following #49922, I was able to diagnose & fix an issue with
`package-quickstart-refresh' when `print-length' is lower than
`(length package-activated-list)'.  There are two possible
user-visible symptoms, caused by the presence of the "..." ellipsis
in the `package-quickstart-file':
1. A warning in *Compile-Log* about a free variable ‘\.\.\.’
2. When restarting emacs, an error message about a missing package
   named "..."

I did not make any experiments, but I am pretty sure that it also would
be possible to produce a broken `package-quickstart-file' with
`print-level' suitably low (1 or 2, maybe even 3?).




;; !!! This reproduction scenario ruins your                       !!!
;; !!! $HOME/.emacs.d/package-quickstart.el unless you are careful !!!
;; !!! Run it with:                                                !!!
;; env HOME=/tmp emacs -Q

(let ((print-length 2))
  (require 'package)
  (package-quickstart-refresh))

;; There is a warning in *Compile-Log*
;;
;; Compiling file c:/msys64/tmp/.emacs.d/package-quickstart.el at Sat Aug  7 10:09:10 2021
;; Entering directory ‘c:/msys64/tmp/.emacs.d/’
;; package-quickstart.el:4:30: Warning: reference to free variable ‘\.\.\.’

Now look inside the generated "package-quickstart.el" with

(find-file package-quickstart-file)

And you will see "(setq package-activated-list ...)" (literally with 3
dots) instead of "(setq package-activated-list (append <text elided for brevity>))".



There is another way to reproduce it that can work with a more "likely"
(or reasonable) value of `print-length', but this is not with `emacs -Q'
because it requires a non-NIL `package-alist', i.e. an existing emacs
configuration with some outside packages:

;; !!! This reproduction scenario ruins your                 !!!
;; !!! `package-quickstart-file'.  Regenerate it afterwards. !!!
;; Assuming you have at least 4 external packages activated in
;; your configuration
(progn
  (package-initialize)
  (let ((print-length (- (length package-alist) 1)))
    (package-quickstart-refresh)))

Now look inside the generated "package-quickstart.el" with

(find-file package-quickstart-file)

And you will see that a package named "..." is added to the
`package-activated-list'.  Next time you start emacs, the package
initialization will fail because there is no such package.





My work-around is to rebind `print-level' and `print-length' before
calling `package-quickstart-refresh' (I do so periodically in the
background):

;; -------- From my early-init.el file --------
;; Enable package quickstart ...
(funcall (or (get 'package-quickstart 'custom-set)
             'set-default)
         'package-quickstart t)
;; ... and make sure it stays up to date
(run-with-idle-timer
 120 ; seconds
 'repeat
 (lambda ()
   (let (;; don't abbreviate lists: the `package-activated-list' is long and
         ;; needs to be complete, otherwise Emacs will search for a package
         ;; called "...".
         (print-length nil)
         ;; I haven't had a problem with it yet, but better safe than sorry.
         (print-level nil))
     (package-quickstart-refresh))))
;; -------- End of my early-init.el file --------




In GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32)
 of 2021-08-06 built on <hostname>
Repository revision: 0afab352e02d7070a8ced2af53c1d01217400cdf
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 6.3.9600
System Description: Microsoft Windows 8.1 (v6.3.0.9600.20069)

Configured using:
 'configure --with-xml2 --with-zlib --without-pop
 --prefix=/home/username/emacs-native-comp/dest
 --without-compress-install --without-dbus --with-native-compilation
 --with-modules 'CFLAGS=-O2 -g3'
 PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XPM ZLIB

Important settings:
  value of $LC_CTYPE: fr_FR.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: cp1252

Major mode: ELisp/l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils modus-vivendi-theme
modus-themes pcase compile text-property-search comint ansi-color ring
pp info finder-inf package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source eieio eieio-core
eieio-loaddefs password-cache json map url-vars comp comp-cstr warnings
subr-x rx cl-seq cl-macs cl-extra help-mode seq byte-opt gv cl-loaddefs
cl-lib bytecomp byte-compile cconv iso-transl tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-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 cl-generic
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 charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads w32notify
w32 lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 174962 29708)
 (symbols 48 12845 1)
 (strings 32 34208 2217)
 (string-bytes 1 1074693)
 (vectors 16 20567)
 (vector-slots 8 314808 27474)
 (floats 8 82 46)
 (intervals 56 304 0)
 (buffers 992 15))






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

* bug#49924: 28.0.50; `package-quickstart-refresh' fails for "long" (according to `print-length') `package-alist'
  2021-08-07  8:45 bug#49924: 28.0.50; `package-quickstart-refresh' fails for "long" (according to `print-length') `package-alist' Pal Gloss
@ 2021-08-07 11:03 ` Lars Ingebrigtsen
  2021-08-07 14:02 ` bug#49924: e1ce9904aa5511468d295cac3221cb77de994331 does not fix #49924 Pal Gloss
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-07 11:03 UTC (permalink / raw)
  To: Pal Gloss; +Cc: 49924

Pal Gloss <pcfeb0009@gmx.com> writes:

> Following #49922, I was able to diagnose & fix an issue with
> `package-quickstart-refresh' when `print-length' is lower than
> `(length package-activated-list)'. 

Yup.  I've now pushed a similar fix for this to the trunk.

Thanks for analysing and identifying these two problems.  Perhaps we
should have a version of prin1-to-string that really did prin1 the
entire expression, because this problem comes up again and again...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#49924: e1ce9904aa5511468d295cac3221cb77de994331 does not fix #49924
  2021-08-07  8:45 bug#49924: 28.0.50; `package-quickstart-refresh' fails for "long" (according to `print-length') `package-alist' Pal Gloss
  2021-08-07 11:03 ` Lars Ingebrigtsen
@ 2021-08-07 14:02 ` Pal Gloss
  2021-08-09 12:47   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Pal Gloss @ 2021-08-07 14:02 UTC (permalink / raw)
  To: 49924


Hi,
 
Thank you for the quick response.  Unfortunately, the proposed fix is not sufficient: the issue is not that `file' in `package-quickstart-refresh' is a long list (it's 1 string).  I think that the problem is `pp' that calls `prin1' (through `pp-to-string') and `prin1' is controlled by `print-length' and `print-level', too.
 
> Thanks for analysing and identifying these two problems.  Perhaps we
> should have a version of prin1-to-string that really did prin1 the
> entire expression, because this problem comes up again and again...

I don't know if `pp' is supposed to print "readably" (which I understand
as can be `read' again, resulting in `equalp' object).  If it is, changing
`pp-to-string' to bind the `print-*' variables would at least solve #49924.

If changing `pp-to-string' (no idea who else uses it) is too risky can
`print-length' and `print-level' be rebound in the top `let' of
`package-quickstart-refresh'.  Otherwise, rebind them locally around the
two calls to `pp'.

Kind regards.





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

* bug#49924: e1ce9904aa5511468d295cac3221cb77de994331 does not fix #49924
  2021-08-07 14:02 ` bug#49924: e1ce9904aa5511468d295cac3221cb77de994331 does not fix #49924 Pal Gloss
@ 2021-08-09 12:47   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-09 12:47 UTC (permalink / raw)
  To: Pal Gloss; +Cc: 49924

Pal Gloss <pcfeb0009@gmx.com> writes:

> Thank you for the quick response.  Unfortunately, the proposed fix is
> not sufficient: the issue is not that `file' in
> `package-quickstart-refresh' is a long list (it's 1 string).  I think
> that the problem is `pp' that calls `prin1' (through `pp-to-string')
> and `prin1' is controlled by `print-length' and `print-level', too.

Oh, right, the problem is in the pp calls.  I've now hoisted the print-*
bindings further up.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-08-09 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-07  8:45 bug#49924: 28.0.50; `package-quickstart-refresh' fails for "long" (according to `print-length') `package-alist' Pal Gloss
2021-08-07 11:03 ` Lars Ingebrigtsen
2021-08-07 14:02 ` bug#49924: e1ce9904aa5511468d295cac3221cb77de994331 does not fix #49924 Pal Gloss
2021-08-09 12:47   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.