GNU bug report logs - #15190
24.3; Reader error when combining print-circle and hash tables

Previous Next

Package: emacs;

Reported by: Christopher Wellons <wellons <at> nullprogram.com>

Date: Mon, 26 Aug 2013 06:58:02 UTC

Severity: normal

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 15190 in the body.
You can then email your comments to 15190 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-gnu-emacs <at> gnu.org:
bug#15190; Package emacs. (Mon, 26 Aug 2013 06:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Wellons <wellons <at> nullprogram.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 26 Aug 2013 06:58:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Wellons <wellons <at> nullprogram.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; Reader error when combining print-circle and hash tables
Date: Mon, 26 Aug 2013 01:05:35 -0400
I'm running into an issue in Emacs 24.3 where the lisp reader fails to
parse hash tables printed with print-circle set to t.

(let ((print-circle t)
      (table (make-hash-table)))
  (puthash t table table) ; recursive
  (read-from-string (prin1-to-string table)))
;; => sequencep error!

Or more succinctly:

(read-from-string "#1=#s(hash-table)")

The same error occurs not just with a direct reference, but also if the
hash table is anywhere inside a referenced data structure.

(read-from-string "#1=[#s(hash-table)]")
(read-from-string "#1=(#s(hash-table))")

I came across this problem trying to store a set of circular-referenced
hash tables to a file.


In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2)
 of 2013-06-25 on sochi, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description:	Debian GNU/Linux unstable (sid)

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Message

Minor modes in effect:
  shell-dirtrack-mode: t
  mml-mode: t
  diff-auto-refine-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  ido-ubiquitous-mode: t
  ido-everywhere: t
  show-paren-mode: t
  winner-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  auto-fill-function: message-do-auto-fill
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <backspace> ( M-> <return> C-x C-s M-<
M-> M-< M-> M-< <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> C-e <left>
M-$ M-> M-x i s <return> i i i a i y <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <right> <right>
<right> <down> <left> ! <right> C-x C-s <down> <down>
<down> <down> M-> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <down> <down> <up>
<up> <up> <up> <backspace> / <up> <backspace> <down>
<up> SPC <down> <backspace> . <up> <right> <right>
<right> <right> <right> <right> SPC n o t SPC u s <backspace>
<backspace> j u s t SPC w i t h SPC a SPC d i r e c
t SPC r <backspace> r e f e r n e c e , SPC b u t SPC
a l s o M-q C-x C-s M-> <up> <up> <up> <up> <left>
<down> <left> <down> <down> <down> <down> <down> <left>
C-x C-e <up> C-e C-x C-e M-> C-x C-s M-< M-> <up> <up>
<up> <up> <up> <up> <up> <up> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<up> <up> <up> <up> <up> <up> <left> SPC ; e r r <backspace>
<backspace> <backspace> SPC e r r o r M-> C-x C-s <up>
<up> <up> <up> <up> <up> <left> <M-backspace> <backspace>
<backspace> <backspace> C-x C-s M-> M-x <return> 0
C-x C-s C-x C-g C-x C-f / / t m p / m a i l <backspace>
<backspace> <backspace> <backspace> r e p o r t <return>
<return> M-x i n s C-s C-s C-s <return> <return> C-x
C-s C-x b <return> M-x r e p o r t - <return>

Recent messages:
Wrote /home/wellons/*message*-20130826-005023
Mark set
Spell-checking *unsent mail* using aspell with default dictionary...done
Saving file /home/wellons/*message*-20130826-005023...
Wrote /home/wellons/*message*-20130826-005023
(New file)
Mark set
Saving file /tmp/report...
Wrote /tmp/report
Undo!

Load-path shadows:
/home/wellons/.emacs.d/elpa/magit-20130822.712/.dir-locals hides /home/wellons/.emacs.d/elpa/pkg-info-20130817.2334/.dir-locals
/home/wellons/.emacs.d/elpa/batch-mode-20110113.952/batch-mode hides ~/.emacs.d/etc/batch-mode
/usr/share/emacs/24.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.3/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.3/lisp/textmodes/ispell
/home/wellons/.emacs.d/elpa/magit-20130822.712/.dir-locals hides /usr/share/emacs/24.3/lisp/gnus/.dir-locals

Features:
(shadow mail-extr emacsbug sendmail sort tramp-cache tramp tramp-compat
tramp-loaddefs shell pcomplete cus-start cus-load email-setup notmuch
notmuch-parser notmuch-message notmuch-maildir-fcc notmuch-hello
notmuch-show notmuch-print notmuch-crypto notmuch-mua notmuch-address
notmuch-wash coolj notmuch-query goto-addr icalendar diary-lib
diary-loaddefs cal-menu calendar cal-loaddefs notmuch-tag crm
notmuch-lib message format-spec rfc822 mml mailabbrev gmm-utils
mailheader mm-view mml-smime mml-sec smime dig mm-decode mm-bodies
mm-encode ispell nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph
nxml-enc xmltok mc-edit-lines multiple-cursors-core rect youtube-dl-mode
hyperspec thingatpt mule-util two-column find-func term ehelp electric
shr-color color etags sh-script smie executable debug jka-compr gnutls
view url-queue wid-edit timezone parse-time mail-utils network-stream
starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
url-gw url-cache url-auth url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf mailcap dabbrev
magit-cherry magit-bisect magit-key-mode magit grep epa derived epg
epg-config diff-mode easy-mmode git-commit-mode magit-compat hl-line
feed-setup elfeed disp-table misearch multi-isearch vc-git xml shr
browse-url xml-query dired-aux dired server paredit slime-autoloads init
batch-mode compile-bind yasnippet help-mode wombat-theme smex
ido-ubiquitous ido bracket-face parenface paren warnings skewer-setup
skewer-mode cache-table js2-mode cc-mode cc-fonts cc-guess cc-menus
cc-styles cc-align cc-cmds cc-engine cc-vars cc-defs imenu jekyll
uuid-simple simple-httpd url-util url-parse auth-source eieio byte-opt
bytecomp byte-compile cconv gnus-util time-date mm-util mail-prsvr
password-cache url-vars pp windmove winner uniquify advice help-fns
advice-preload whitespace-cleanup whitespace time utility extras edmacro
kmacro imgur json batch-mode-autoloads glsl-mode-autoloads
graphviz-dot-mode-autoloads ido-ubiquitous-autoloads
impatient-mode-autoloads htmlize-autoloads inf-ruby-autoloads inf-ruby
ruby-mode compile comint ansi-color ring javadoc-lookup-autoloads
lua-mode-autoloads magit-autoloads info easymenu
git-rebase-mode-autoloads git-commit-mode-autoloads
markdown-mode-autoloads memoize-autoloads multiple-cursors-autoloads
notmuch-autoloads nrepl-autoloads clojure-mode-autoloads
paredit-autoloads parenface-autoloads pkg-info-autoloads dash-autoloads
rdp-autoloads s-autoloads skewer-mode-autoloads js2-mode-autoloads
finder-inf simple-httpd-autoloads smex-autoloads yasnippet-autoloads
package-helper cl-macs gv cl cl-lib package tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Mon, 26 Aug 2013 20:35:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Wellons <wellons <at> nullprogram.com>:
bug acknowledged by developer. (Mon, 26 Aug 2013 20:35:02 GMT) Full text and rfc822 format available.

Message #10 received at 15190-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Christopher Wellons <wellons <at> nullprogram.com>
Cc: 15190-done <at> debbugs.gnu.org
Subject: Re: bug#15190: 24.3;
 Reader error when combining print-circle and hash tables
Date: Mon, 26 Aug 2013 16:34:29 -0400
> I'm running into an issue in Emacs 24.3 where the lisp reader fails to
> parse hash tables printed with print-circle set to t.

Indeed, there was an oversight.  It should be fixed on the trunk now,


        Stefan


=== modified file 'src/lread.c'
--- src/lread.c	2013-07-20 14:21:25 +0000
+++ src/lread.c	2013-08-26 20:24:36 +0000
@@ -3229,7 +3229,7 @@
 	if (BOOL_VECTOR_P (subtree))
 	  return subtree;		/* No sub-objects anyway.  */
 	else if (CHAR_TABLE_P (subtree) || SUB_CHAR_TABLE_P (subtree)
-		 || COMPILEDP (subtree))
+		 || COMPILEDP (subtree) || HASH_TABLE_P (subtree))
 	  length = ASIZE (subtree) & PSEUDOVECTOR_SIZE_MASK;
 	else if (VECTORP (subtree))
 	  length = ASIZE (subtree);





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Sep 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 274 days ago.

Previous Next


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