GNU bug report logs - #12503
24.2.50; `bookmark-write-file' should bind `print-circle' to t

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 24 Sep 2012 16:14:01 UTC

Severity: normal

Found in version 24.2.50

Done: Karl Fogel <kfogel <at> red-bean.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12503 in the body.
You can then email your comments to 12503 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12503; Package emacs. (Mon, 24 Sep 2012 16:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 24 Sep 2012 16:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.2.50; `bookmark-write-file' should bind `print-circle' to t
Date: Mon, 24 Sep 2012 09:11:36 -0700
Users can define their own bookmark types, which can store anything at
all in bookmark records, that is, any Lisp objects.
 
Such objects can contain circularities: one part referring to another
part or to the whole - IOW circular lists.
 
When `bookmark-write-file' writes a bookmark list to the bookmark file,
it takes care to bind `print-length' and `print-level' to nil, but it
does yet not bind `print-circle' to t.  It should do that as well.
 
The result currently is that a user's bookmark file can be corrupted,
becoming unreadable because it contains invalid Lisp `read' syntax.
 
I have seen this a couple of times now, with users of Bookmark+.
Bookmark+ does use bookmarks that have circular structure, and it saves
them correctly by binding `print-circle' to t.
 
A user can read such a bookmark file into vanilla Emacs, and s?he can
use the bookmarks there.  But if s?he then saves the file again, in
vanilla Emacs, the result is invalid Lisp.
 
The file cannot be read (in either vanilla Emacs or Bookmark+).  The
user has lost bookmarks and can recuperate them only by hand-editing the
corrupted file, which is laborious and error prone.
 
The simple change of binding `print-circle' to t will have no negative
effect on bookmark.el behavior, and it will solve the problem,
preventing data loss if users have defined bookmark structures that are
circular.

In GNU Emacs 24.2.50.1 (i386-mingw-nt5.1.2600)
 of 2012-09-17 on MARVIN
Bzr revision: 110062 cyd <at> gnu.org-20120917054104-r93rtwkrtva73ewe
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
 





Reply sent to Karl Fogel <kfogel <at> red-bean.com>:
You have taken responsibility. (Mon, 01 Oct 2012 03:50:01 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Mon, 01 Oct 2012 03:50:02 GMT) Full text and rfc822 format available.

Message #10 received at 12503-done <at> debbugs.gnu.org (full text, mbox):

From: Karl Fogel <kfogel <at> red-bean.com>
To: 12503-done <at> debbugs.gnu.org
Subject: Re: `bookmark-write-file' should bind `print-circle' to t
Date: Sun, 30 Sep 2012 22:48:55 -0500
Done:

  revno: 110307
  revision-id: kfogel <at> red-bean.com-20121001034459-o8irfybe8zo6mum6
  parent: kfogel <at> red-bean.com-20121001033402-6jrmk69xzz30h3zw
  committer: Karl Fogel <kfogel <at> red-bean.com>
  branch nick: trunk
  timestamp: Sun 2012-09-30 22:44:59 -0500
  message:
    * lisp/bookmark.el (bookmark-write-file): Bind `print-circle' to `t'
      here to allow circular custom bookmark types.  (Bug#12503)

Diff:

  --- lisp/bookmark.el	2012-10-01 03:34:02 +0000
  +++ lisp/bookmark.el	2012-10-01 03:41:42 +0000
  @@ -1359,7 +1359,12 @@
       (goto-char (point-min))
       (delete-region (point-min) (point-max))
       (let ((print-length nil)
  -          (print-level nil))
  +          (print-level nil)
  +          ;; See bug #12503 for why we bind `print-circle'.  Users
  +          ;; can define their own bookmark types, which can result in
  +          ;; arbitrary Lisp objects being stored in bookmark records,
  +          ;; and some users create objects containing circularities.
  +          (print-circle t))
         (bookmark-insert-file-format-version-stamp)
         (insert "(")
         ;; Rather than a single call to `pp' we make one per bookmark.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 29 Oct 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 233 days ago.

Previous Next


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