unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49922: 28.0.50; comp-run-async-workers can be broken by setting print-length or print-level
@ 2021-08-07  7:48 Pal Gloss
  2021-08-07 11:00 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Pal Gloss @ 2021-08-07  7:48 UTC (permalink / raw)
  To: 49922

`comp-run-async-workers' uses `prin1-to-string' to generate the contents
of a temporary file.  It does *NOT* rebind `print-length' and thus
inserts incomplete sexps in the temporary file.  This then leads to
errors during native compilation.

`print-level' is also not rebound to nil but it should, too.  I don't
really understand the failure mechanism, but I am pretty sure that the
usage of `prin1-to-string' in `comp-run-async-workers' intends to have a
faithful representation of its "expr" local variable in the "temp-file",
so that the right thing to do is to rebind those `print-level' and
`print-length' variables to isolate `comp-run-async-workers' from
whatever the settings the user may have at the time the compilation is
started.

Redefining `comp-run-async-workers' to bind `print-length' and
`print-level' to nil in the big `let*' expression inside the `cl-loop'
prevents the reproduction examples below from failing.



1. To reproduce the issue with `print-length' in emacs -Q:

(let* ((print-level nil)
       ;; 16 or lower gives "... error: (void-variable \.\.\.)"
       ;; 17 gives "... error: (wrong-number-of-arguments setf 17)"
       ;; 18 gives no error message nor warning (why?  No idea!)
       ;; 19 to 21 (bounds inclusive) give
       ;;          "Error: File is missing Cannot open load file"
       ;; 22 or higher: no error message nor warning
       (print-length 16)
       (temp-file (make-temp-file "reproduce-the-bug" nil ".el"))
       (_ (with-temp-file temp-file
            (insert "(defun reproduce-the-bug () nil)\n"))))
  (native-compile-async temp-file))

;; *Warnings* buffer pops up with
;;
;; Warning (comp): Debugger entered--Lisp error: (void-variable \.\.\.)
;;
;; or another error message depending on the value of `print-length'




2. To reproduce the issue with `print-level' in emacs -Q:

(let* ((print-level 2) ; 3 is already sufficient for the compilation to succeed
       (print-length nil)
       (temp-file (make-temp-file "reproduce-the-bug" nil ".el"))
       (_ (with-temp-file temp-file
            (insert "(defun reproduce-the-bug () nil\n"))))
  (native-compile-async temp-file))

;; *Warnings* buffer pops up with
;;
;; Warning (comp): <my home directory>/AppData/Local/Temp/reproduce-the-bugLyD27F.el: Error: error Cannot find suitable directory for output in `comp-native-load-path'.

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: Lisp Interaction

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 auth-source eieio eieio-core eieio-loaddefs
password-cache json map text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail 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
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils 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 90320 10381)
 (symbols 48 8078 1)
 (strings 32 23631 1324)
 (string-bytes 1 795325)
 (vectors 16 16573)
 (vector-slots 8 322901 17594)
 (floats 8 30 72)
 (intervals 56 257 0)
 (buffers 992 12))









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

* bug#49922: 28.0.50; comp-run-async-workers can be broken by setting print-length or print-level
  2021-08-07  7:48 bug#49922: 28.0.50; comp-run-async-workers can be broken by setting print-length or print-level Pal Gloss
@ 2021-08-07 11:00 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-07 11:00 UTC (permalink / raw)
  To: Pal Gloss; +Cc: 49922

Pal Gloss <pcfeb0009@gmx.com> writes:

> Redefining `comp-run-async-workers' to bind `print-length' and
> `print-level' to nil in the big `let*' expression inside the `cl-loop'
> prevents the reproduction examples below from failing.

I've now done something similar in on the trunk (just binding those
around the prin1-to-string call), which should fix this issue.

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





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

end of thread, other threads:[~2021-08-07 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-07  7:48 bug#49922: 28.0.50; comp-run-async-workers can be broken by setting print-length or print-level Pal Gloss
2021-08-07 11:00 ` Lars Ingebrigtsen

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).