From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#24576: 25.1; desktop.el does not fully preserve registers with macros Date: Wed, 22 May 2019 23:43:12 -0400 Message-ID: <87a7fdal9r.fsf@gmail.com> References: <874m4wwu6n.fsf@gmail.com> <87v9yhi3ux.fsf@gmail.com> <45ED012D-B370-473A-AF83-2165F5CD3DE3@knosis.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="24975"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: dpaduchikh@gmail.com, 24576@debbugs.gnu.org To: Matthew Newton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 23 05:44:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTeeJ-0006Lz-Oy for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 May 2019 05:44:11 +0200 Original-Received: from localhost ([127.0.0.1]:57068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTeeI-0007hQ-GD for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 May 2019 23:44:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTeeB-0007hA-Hx for bug-gnu-emacs@gnu.org; Wed, 22 May 2019 23:44:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTee9-0004fG-WA for bug-gnu-emacs@gnu.org; Wed, 22 May 2019 23:44:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58314) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTee9-0004fB-Qh for bug-gnu-emacs@gnu.org; Wed, 22 May 2019 23:44:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hTee9-00029O-NP for bug-gnu-emacs@gnu.org; Wed, 22 May 2019 23:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 May 2019 03:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24576 X-GNU-PR-Package: emacs Original-Received: via spool by 24576-submit@debbugs.gnu.org id=B24576.15585830028208 (code B ref 24576); Thu, 23 May 2019 03:44:01 +0000 Original-Received: (at 24576) by debbugs.gnu.org; 23 May 2019 03:43:22 +0000 Original-Received: from localhost ([127.0.0.1]:43625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hTedV-00028K-J0 for submit@debbugs.gnu.org; Wed, 22 May 2019 23:43:21 -0400 Original-Received: from mail-it1-f176.google.com ([209.85.166.176]:56055) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hTedU-000285-1U for 24576@debbugs.gnu.org; Wed, 22 May 2019 23:43:20 -0400 Original-Received: by mail-it1-f176.google.com with SMTP id g24so415637iti.5 for <24576@debbugs.gnu.org>; Wed, 22 May 2019 20:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=5vDbv8D1c6HFKfa0z7HeS7rbLAxjV1qAhBwzFcDEmf0=; b=GekGvhCjtUxA27PIDxEEJpL/O+j55T6unIm+Eor1gqaV89Gs2BGvTxq7U6nFeopE2l +d9qeQ2kTmZ3adrLzP7bYIRzqRe9U8C/NBvZ8oNUvAHfkkQdDjaPJreC4uLzA2MuHsi6 dMZ5cOQ5wArV1DZwoTQjDheIvoaLJ0fI+xB95Wm7c45p1PQzW04j24SYngKALE/mpC7O nmjymJpdKJLot57QJh0Zc/Mwdy0soUy/xtR13iJvqz/qruLW+i2HyPMBMsYaD2886EU5 hAMv2HL2WtBnSChH8MgDdr7xmUZdaLPKEAB5WHNHeJ9rM2LXNJ63LcJ/BHzAHBQrL4/1 HylQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=5vDbv8D1c6HFKfa0z7HeS7rbLAxjV1qAhBwzFcDEmf0=; b=EJPIy5q3YQzE2WXtXcS1UKpTJSdfWRZ0KHUZkS3c4Vfcf9t4dXSgLU4cIftlDLm6Kk Zh589oIcbr7KLYup+VGVvy3aErdQNrf96fDrN1B8icV/G845CiqH/W6PW9KcZ8FHSMu2 wiL8yfKvblSfklwYT1EjvWIS9kfkgY4ZI+4h1WkpalTORSkNd0jyBZrVLIjzb7AtRgqk Ofr+YGV/vzuUsrUpcT4RZiCgGxL5+MXLVeUXlzkSdvFRAq6xA6qraMPp8wXnX9AIoAzF fGqcKnrSzmt32xXgLN/Cvi8gqj/+MOyXyCERV58UiC19viXfDabf+OZb/XQnM28Wxssk 3vWA== X-Gm-Message-State: APjAAAWKCoocbO6lL4QkpddMuVwp43wtLLYv2E/QMToQ5DQNlrktPFng o5TCcg/jqcPZbmQphseJyAlZxC2f X-Google-Smtp-Source: APXvYqznqeTXYZlACxELNqtagjdblL3il4PPLskC6qX1sxwfXauOJyWHvtudLpwcbUQDSye1r5CHXg== X-Received: by 2002:a24:27c6:: with SMTP id g189mr11314197ita.114.1558582994057; Wed, 22 May 2019 20:43:14 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id p129sm3559883itg.14.2019.05.22.20.43.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 May 2019 20:43:13 -0700 (PDT) In-Reply-To: <45ED012D-B370-473A-AF83-2165F5CD3DE3@knosis.org> (Matthew Newton's message of "Wed, 22 May 2019 13:58:06 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159669 Archived-At: Matthew Newton writes: > (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 don't think `[...] will ever return a byte code function, so the non-special case doesn't seem quite right. > Are there security concerns or other considerations? Well, as (info "(elisp) Byte-Code Objects") mentions, passing the wrong args to make-byte-code can produce a function which will crash Emacs when called, so it's somewhat high risk. >> 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 note that the functions in question come from this code in kmacro.el: (defun kmacro-to-register (r) ... (registerv-make last-kbd-macro :jump-func 'kmacro-execute-from-register :print-func (lambda (k) (princ (format "a keyboard macro:\n %s" (format-kbd-macro k)))) :insert-func (lambda (k) (insert (format-kbd-macro k)))) While in register.el we have: (cl-defun registerv-make (data &key print-func jump-func insert-func) ... (declare (obsolete "Use your own type with methods on register-val-(inser= t|describe|jump-to)" "27.1")) So perhaps this is a good opportunity to change the kmacro register stuff to use the non-obsolete way. =20 >>> I=E2=80=99ve also seen =E2=80=9CUnprintable entity=E2=80=9D show up whe= n a buffer position >>> register points to a nonexistent buffer. Not sure how to reproduce >>> that one. >>=20 >> I guess if you save a position in a buffer, then kill the buffer. >>=20 > 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=E2=80=99m not sure of t= he > case where a buffer position register becomes an =E2=80=9CUnprintable > entity=E2=80=9D. Did you find reproduction steps? Ah, no, I was just guessing based on your initial description, no idea how to reproduce it if desktop.el is already handling these cases.