GNU bug report logs - #24576
25.1; desktop.el does not fully preserve registers with macros

Previous Next

Package: emacs;

Reported by: Dmitri Paduchikh <dpaduchikh <at> gmail.com>

Date: Sat, 1 Oct 2016 04:50:01 UTC

Severity: normal

Tags: fixed

Found in version 25.1

Fixed in version 27.1

Done: npostavs <at> gmail.com

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Matthew Newton <matt <at> knosis.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: dpaduchikh <at> gmail.com, 24576 <at> debbugs.gnu.org
Subject: bug#24576: 25.1;	desktop.el does not fully preserve registers with macros
Date: Wed, 22 May 2019 13:58:06 -0700
It seems that the more pressing issue is desktop handling byte code.

> On May 11, 2019, at 5:15 AM, Noam Postavsky <npostavs <at> gmail.com> wrote:
> 
> Matthew Newton <matt <at> knosis.org> writes:
> 
>> Apologies for reviving a stale bug but it appears to not be resolved yet.
> 
> No apologies needed, on the contrary, thank you for looking at it.
> 
>> So there seem to be two bugs:
>> 
>> 1. `desktop-save-mode` doesn’t serialize/deserialize keyboard macros
>> properly (is it difficult to serialize a function object?)
Would it make sense to simply do something like this?

(defun desktop--v2s (value)
  ...
  (cond
   ((byte-code-function-p value)
    (let* ((pass1 (mapcar #'desktop--v2s value))
           (special (assq nil pass1)))
      (if special
          (cons nil `(make-byte-code
                      ,@(mapcar (lambda (el)
                                  (if (eq (car el) 'must)
                                      `',(cdr el) (cdr el)))
                                pass1)))
        (cons 'may `[,@(mapcar #'cdr pass1)]))))
   …))

I copied that from the `cond` clause for vector. It works in my limited testing.

Are there security concerns or other considerations?
> 
>> 2. Either :print-func and :insert-func should never be set to
>> “Unprintable entity” or `register-val-describe` should handle the case
>> where they are set to that value instead of a function.
> 
> The "unprintable entity" comes from desktop--v2s, looks like it doesn't
> handle compiled function values, so that's why :print-func and
> :insert-func get messed up like that.
> 
>> I’ve also seen “Unprintable entity” show up when a buffer position
>> register points to a nonexistent buffer. Not sure how to reproduce
>> that one.
> 
> I guess if you save a position in a buffer, then kill the buffer.
> 
Here is what I found: if the killed buffer visits a file, it gets converted into a file-query. If there is no `buffer-file-name` then it stays a file marker pointing to nowhere. Desktop handles both of those cases correctly. So while I have seen it happen I’m not sure of the case where a buffer position register becomes an “Unprintable entity”. Did you find reproduction steps?

Cheers,
Matt






This bug report was last modified 6 years and 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.