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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4250 in the body.
You can then email your comments to 4250 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4250; Package emacs. (Mon, 24 Aug 2009 22:20:03 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 Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 24 Aug 2009 22:20:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

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)'
 





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4250; Package emacs. (Sun, 13 Sep 2009 22:25:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 13 Sep 2009 22:25:08 GMT) Full text and rfc822 format available.

Message #10 received at 4250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: kfogel <at> red-bean.com
Cc: 4250 <at> debbugs.gnu.org
Subject: Re: 23.1; bookmark.el should raise reasonable error for empty filename entry
Date: Sun, 13 Sep 2009 18:22:01 -0400
Hi Karl,

Could you take a look at bug#4250 for the bookmark package?  Thanks.

(Drew Adams has filed a few other bookmark.el bugs in the bug tracker,
and if you could look at them as well, that would be good.  Thanks.)



Merged 4229 4250. Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 13 Sep 2009 22:25:10 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4250; Package emacs. (Sun, 13 Sep 2009 22:35:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Karl Fogel <kfogel <at> red-bean.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 13 Sep 2009 22:35:05 GMT) Full text and rfc822 format available.

Message #17 received at 4250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Karl Fogel <kfogel <at> red-bean.com>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 4250 <at> debbugs.gnu.org
Subject: Re: 23.1; bookmark.el should raise reasonable error for empty filename entry
Date: Sun, 13 Sep 2009 18:26:55 -0400
Chong Yidong <cyd <at> stupidchicken.com> writes:
> Hi Karl,
>
> Could you take a look at bug#4250 for the bookmark package?  Thanks.
>
> (Drew Adams has filed a few other bookmark.el bugs in the bug tracker,
> and if you could look at them as well, that would be good.  Thanks.)

Yes, I will take a look.  Thank you for bringing it to my attention.

-Karl



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4250; Package emacs. (Mon, 14 Sep 2009 20:35:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 14 Sep 2009 20:35:04 GMT) Full text and rfc822 format available.

Message #22 received at 4250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Karl Fogel'" <kfogel <at> red-bean.com>, <4250 <at> debbugs.gnu.org>,
        "'Chong Yidong'" <cyd <at> stupidchicken.com>
Subject: RE: bug#4250: 23.1;bookmark.el should raise reasonable error for empty filename entry
Date: Mon, 14 Sep 2009 13:29:12 -0700
> > Could you take a look at bug#4250 for the bookmark package?  Thanks.
> >
> > (Drew Adams has filed a few other bookmark.el bugs in the 
> > bug tracker, and if you could look at them as well, that
> > would be good.  Thanks.)
> 
> Yes, I will take a look.  Thank you for bringing it to my attention.

Thanks. When you can, please take a look also at the bookmark.el bugs filed by
Thierry Volpiatto.

Thx - Drew




Reply sent to Karl Fogel <kfogel <at> red-bean.com>:
You have taken responsibility. (Mon, 05 Oct 2009 04:35:04 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Mon, 05 Oct 2009 04:35:05 GMT) Full text and rfc822 format available.

Message #27 received at 4250-close <at> emacsbugs.donarmstrong.com (full text, mbox):

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.



Reply sent to Karl Fogel <kfogel <at> red-bean.com>:
You have taken responsibility. (Mon, 05 Oct 2009 04:35:05 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Mon, 05 Oct 2009 04:35:06 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Mon, 02 Nov 2009 15:24:12 GMT) Full text and rfc822 format available.

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.