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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Karl Fogel <kfogel <at> red-bean.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#12503: closed (24.2.50; `bookmark-write-file' should bind
 `print-circle' to t)
Date: Mon, 01 Oct 2012 03:50:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 30 Sep 2012 22:48:55 -0500
with message-id <87obkmhmxk.fsf <at> floss.red-bean.com>
and subject line Re: `bookmark-write-file' should bind `print-circle' to t
has caused the debbugs.gnu.org bug report #12503,
regarding 24.2.50; `bookmark-write-file' should bind `print-circle' to t
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
12503: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12503
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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'
 



[Message part 3 (message/rfc822, inline)]
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.


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

Previous Next


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