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#4229 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:06 +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; wrong-type arg: char or string-p, nil

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; wrong-type arg: char or string-p, nil
Date: Fri, 21 Aug 2009 15:38:22 -0700
emacs -Q
M-x set-variable debug-on-error t
M-x load-file /......./bookmark.el
C-x r l
 
raises error:
 
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  insert(nil)
  (prog1 (insert (bookmark-location bookmark)) (if (and ... ...)
(add-text-properties start ... ...)))
  (let ((start ...)) (prog1 (insert ...) (if ... ...)))
  bookmark-insert-location("*Messages* buffer list" t)
  (let ((bmrk ...)) (setq bookmark-bmenu-hidden-bookmarks (cons bmrk
bookmark-bmenu-hidden-bookmarks)) (let (...) (move-to-column
bookmark-bmenu-file-column t) (if ... ...)) (delete-region (point) (progn ...
...)) (insert "  ") (bookmark-insert-location bmrk t) (forward-line 1))
  (while (< (point) (point-max)) (let (...) (setq
bookmark-bmenu-hidden-bookmarks ...) (let ... ... ...) (delete-region ... ...)
(insert "  ") (bookmark-insert-location bmrk t) (forward-line 1)))
  (let ((inhibit-read-only t)) (while (< ... ...) (let ... ... ... ... ... ...
...)))
  (save-window-excursion (goto-char (point-min)) (forward-line 2) (setq
bookmark-bmenu-hidden-bookmarks nil) (let (...) (while ... ...)))
  (save-excursion (save-window-excursion (goto-char ...) (forward-line 2) (setq
bookmark-bmenu-hidden-bookmarks nil) (let ... ...)))
  (if (and (not force) bookmark-bmenu-toggle-filenames) nil (save-excursion
(save-window-excursion ... ... ... ...)))
  bookmark-bmenu-show-filenames()
  (cond (show (setq bookmark-bmenu-toggle-filenames nil)
(bookmark-bmenu-show-filenames) (setq bookmark-bmenu-toggle-filenames t))
(bookmark-bmenu-toggle-filenames (bookmark-bmenu-hide-filenames) (setq
bookmark-bmenu-toggle-filenames nil)) (t (bookmark-bmenu-show-filenames) (setq
bookmark-bmenu-toggle-filenames t)))
  bookmark-bmenu-toggle-filenames(t)
  (if bookmark-bmenu-toggle-filenames (bookmark-bmenu-toggle-filenames t))
  bookmark-bmenu-list()
  call-interactively(bookmark-bmenu-list nil nil)
 
 
 
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.