GNU bug report logs - #19768
json.el: end-of-file errors untrappable

Previous Next

Package: emacs;

Reported by: era eriksson <era <at> iki.fi>

Date: Wed, 4 Feb 2015 14:00:02 UTC

Severity: normal

Found in version 24.3.1

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

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: era eriksson <era <at> iki.fi>
Subject: bug#19768: closed (Re: bug#19768: json.el: end-of-file errors
 untrappable)
Date: Thu, 05 Feb 2015 19:53:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#19768: json.el: end-of-file errors untrappable

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 19768 <at> debbugs.gnu.org.

-- 
19768: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19768
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: era eriksson <era+emacs <at> iki.fi>
Cc: 19768-done <at> debbugs.gnu.org
Subject: Re: bug#19768: json.el: end-of-file errors untrappable
Date: Thu, 05 Feb 2015 14:52:39 -0500
> https://github.com/tripleee/emacs/tree/bug19768 contains a simple patch
> which implements this, but I am uncertain how to test it.  Also, I am
> having second thoughts about defining the new error symbol as a child of
> 'end-of-file when all the other error symbols neatly inherit from
> 'json-error.  Anyway, feel free to review and/or pull and/or ignore. (-:

Installed, making it inherit from both kinds of errors ;-)


        Stefan

[Message part 3 (message/rfc822, inline)]
From: era eriksson <era <at> iki.fi>
To: submit <at> debbugs.gnu.org
Subject: json.el: end-of-file errors untrappable
Date: Wed, 04 Feb 2015 15:59:43 +0200
Package: emacs
Version: 24.3.1
X-Debbugs-Cc: era+emacs <at> iki.fi

The code in json.el uses (signal 'end-of-file) in many scenarios. 
Unfortunately, the default value of debug-ignore-errors causes these
errors to bypass any error checking, and unhelpfully land in the
*Messages* buffer with little indication as to what went wrong or which
code path caused this message.

Once you know this, debugging json-read is easy; but the fix is
unobvious, and might have unintended side effects.

Steps to repro:

    (require 'json)
    (setq debug-on-error t)
    (json-read-from-string "")

Expected result:

*Backtrace* showing where something went wrong

Actual result:

json-read: End of file during parsing

(The "json-read:" prefix is not visible in the minibuffer message for
me, but it lands in the *Messages* buffer.)

Workaround:

    (let (debug-ignore-errors)
      (json-read-from-string ""))

I'm not sure what the proper fix should be.  Maybe these occurrences
could be changed to json-end-of-file or something?  Or maybe json-read
could include the 'let' form from the workaround.

See also:
http://stackoverflow.com/questions/28317081/debug-on-error-vs-debug-on-signal-in-json-el-in-particular

/* era */

-- 
If this were a real .signature, it would suck less.  Well, maybe not.



This bug report was last modified 10 years and 186 days ago.

Previous Next


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