Subject: bug#72559: 31.0.50; profiler-report-write-profile produced unreadable data

From: Eli Zaretskii <[email-masked]>
Date: Sat, 10 Aug 2024 17:09:17 +0300

> Cc: [email-masked]
> Date: Sat, 10 Aug 2024 13:56:49 +0000
> From:  Pip Cet via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> "Ihor Radchenko" <[email-masked]> writes:
> 
> > Since ~few months ago, I started having issues with profiler dumps
> > shared by users.  The latest example is in
> > https://list.orgmode.org/[email-masked]/T/#u
> >
> > When trying to open the profiler data with M-x profiler-find-profile, I
> > keep getting
> > profiler-find-profile: Invalid read syntax: "#<", 2, 64028
> > or similar errors.
> 
> (Just trying to save others the work of going to character 64028 in that
> dump).
> 
> In that example, the relevant section of the dump looks like this:
> 
> #[0 "..." [#<killed buffer> buffer-name kill-buffer] 2]
> 
> Which looks like a byte code closure produced by make-closure, probably
> by with-temp-buffer:
> 
> (defmacro with-temp-buffer (&rest body)
>   "Create a temporary buffer, and evaluate BODY there like `progn'.
> The buffer does not run the hooks `kill-buffer-hook',
> `kill-buffer-query-functions', and `buffer-list-update-hook'.
> See also `with-temp-file' and `with-output-to-string'."
>   (declare (indent 0) (debug t))
>   (let ((temp-buffer (make-symbol "temp-buffer")))
>     `(let ((,temp-buffer (generate-new-buffer " *temp*" t)))
>        ;; `kill-buffer' can change current-buffer in some odd cases.
>        (with-current-buffer ,temp-buffer
>          (unwind-protect
> 	     (progn ,@body)
>            (and (buffer-name ,temp-buffer)
>                 (kill-buffer ,temp-buffer)))))))
> 
> No idea what a good fix would be, though.

Thanks, adding Stefan in the hope that he could have some ideas.