GNU bug report logs - #4250
23.1; bookmark.el should raise reasonable error for empty filename entry

Previous Next

Package: emacs;

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

Date: Mon, 24 Aug 2009 22:20:03 UTC

Severity: normal

Merged with 4229

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 (Emacs bug Tracking System)
To: "Drew Adams" <drew.adams <at> oracle.com>
Subject: bug#4250 closed by Karl Fogel <kfogel <at> red-bean.com> (Fix
 "bookmark.el should raise reasonable error for empty filename entry")
Date: Mon, 05 Oct 2009 04:35:05 +0000
[Message part 1 (text/plain, inline)]
This is an automatic notification regarding your bug report
which was filed against the emacs package:

#4250: 23.1; bookmark.el should raise reasonable error for empty filename entry

It has been closed by Karl Fogel <kfogel <at> red-bean.com>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Karl Fogel <kfogel <at> red-bean.com> by
replying to this email.


-- 
4250: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4250
Emacs Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Karl Fogel <kfogel <at> red-bean.com>
To: 4250-close <at> debbugs.gnu.org
Subject: Fix "bookmark.el should raise reasonable error for empty filename entry"
Date: Mon, 05 Oct 2009 00:26:53 -0400
fixed
--

I think this is fixed now, though I'm not positive it was broken in the
first place.  I've made `bookmark-default-handler' raise a catchable
error on entries that have no filename.

But in general, if you're defining your own types of bookmarks, you
should be defining custom handlers for them.  So when you say "I have
code that allows for bookmarks that have no filename", I'm curious to
see that code.  It's impossible, in the general case, for bookmark.el to
tolerate all entries it does not recognize -- a sufficiently bizarre
entry might not even have discernable boundaries, for example.  We must
depend on custom handlers to handle custom data.

Anyway, here's the commit:

  $ cvs ci -F msg lisp/bookmark.el lisp/ChangeLog
  /sources/emacs/emacs/lisp/bookmark.el,v  <--  lisp/bookmark.el
  new revision: 1.131; previous revision: 1.130
  /sources/emacs/emacs/lisp/ChangeLog,v  <--  lisp/ChangeLog
  new revision: 1.16357; previous revision: 1.16356
  Mailing notification to emacs-diffs <at> gnu.org... sent.
  $ 

And this is the log message, so you can get an idea of what I did:

  (bookmark-handle-bookmark): If bookmark has no file,
    don't do anything related to relocating, just return nil. 
  (bookmark-error-no-filename): New error.
  (bookmark-default-handler): Signal `bookmark-error-no-filename' if
    bookmark has no file.  Don't even attempt to handle things that
    are not files; the whole point of custom handlers is to keep that
    knowledge elsewhere anyway.  Tighten some comments.
  (bookmark-file-or-variation-thereof): Remove now-unused function.
  (bookmark-location): Doc string fix.
[Message part 3 (message/rfc822, inline)]
From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 23.1; bookmark.el should raise reasonable error for empty filename entry
Date: Mon, 24 Aug 2009 15:14:50 -0700
I have code that allows for bookmarks that have no filename, that is,
where the `filename' entry in `bookmark-alist' is `(filename)'.
 
It would be ideal and most reasonable if vanilla Emacs simply ignored
such a bookmark - tolerance. More generally, it would be great if it would
tolerate any bookmark in `bookmark-alist' that it doesn't recognize.
 
If that is not something you agree about, then at least it should
raise a reasonable error - not just "wrong-type-arg stringp, nil",
whenever a "malformed" bookmark is encountered.
 
The code in `bookmark-default-handler' is an example of the problem.
The local variable `file' is bound to (bookmark-get-filename bmk) -
which returns nil if there is no `filename' entry or the `filename'
entry is `(filename)'.
 
The code then simply calls (file-exists-p nil), via
(bookmark-file-or-variation-thereof nil), raising the wrong-type-arg
error.
 
In the alternative `if' branch, the code calls (find-file-noselect
nil), which has the same problem.
 
In general, it would be great if places where `bookmark-get-filename'
is called tested the result and treated nil by raising a
bookmark-level error.
 
As I said, it would be even better if the bookmark.el code could be
made tolerant of any bookmark whose format it does not
recognize.

bookmark.el already allows for applications and users to add new,
addtional entries. The problem is that it doesn't allow for
unexpected forms of the entries it predefines. It would be nice if it
were tolerant, and simply ignored any such bookmark (no error).
 

In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
 of 2009-07-29 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'
 




This bug report was last modified 15 years and 311 days ago.

Previous Next


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