all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#29326: 26.0.90; Emacs crash on running comment-dwim
@ 2017-11-16 19:43 Kaushal Modi
  2017-11-17  7:03 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Kaushal Modi @ 2017-11-16 19:43 UTC (permalink / raw)
  To: 29326


[-- Attachment #1.1: Type: text/plain, Size: 14129 bytes --]

Hello,

All of a sudden I can get emacs to crash consistently because of some rogue
font lock regexp parsing between Org mode and nim-mode[1].

I have attached a test file (that's the smallest I can get to from
originally ~1000 line file). I can make the crash happen on doing M-x
comment-dwim on line 69 (in the test.org file) but not on line 52 and
earlier lines for example.

[1]: https://github.com/nim-lang/nim-mode

It will be tricky to get an emacs -Q recipe with org and nim-mode
dependencies. So while I work on getting that recipe, does the below
backtrace help?

=====
Thread 1 "emacs" received signal SIGABRT, Aborted.
0x00000033e380f6ab in raise () from /lib64/libpthread.so.0
(gdb) bt
#0  0x00000033e380f6ab in raise () from /lib64/libpthread.so.0
#1  0x000000000058c8f4 in terminate_due_to_signal (sig=6,
backtrace_limit=2147483647) at emacs.c:394
#2  0x00000000006232d5 in die (msg=0x723428 "charpos < 0 || (charpos >=
BUF_BEG (current_buffer) && charpos <= ZV)", file=0x72313d "xdisp.c",
line=2752) at alloc.c:7419
#3  0x0000000000449caa in init_iterator (it=0x7fffffff22f0, w=0x888fb60,
charpos=9982, bytepos=9982, row=0x7d9e430, base_face_id=DEFAULT_FACE_ID) at
xdisp.c:2751
#4  0x000000000044af1b in start_display (it=0x7fffffff22f0, w=0x888fb60,
pos=...) at xdisp.c:3060
#5  0x00000000005f8e41 in line_number_display_width (w=0x888fb60,
width=0x7fffffff366c, pixel_width=0x7fffffff3668) at indent.c:1976
#6  0x00000000005f8efa in Fline_number_display_width (pixelwise=...) at
indent.c:2007
#7  0x000000000064ab54 in funcall_subr (subr=0x9dca60
<Sline_number_display_width>, numargs=1, args=0x7fffffff37f0) at eval.c:2841
#8  0x000000000064a6ab in Ffuncall (nargs=2, args=0x7fffffff37e8) at
eval.c:2766
#9  0x000000000069f6c7 in exec_byte_code (bytestr=..., vector=...,
maxdepth=..., args_template=..., nargs=2, args=0x7fffffff4050) at
bytecode.c:629
#10 0x000000000064b2bd in funcall_lambda (fun=..., nargs=2,
arg_vector=0x7fffffff4040) at eval.c:2967
#11 0x000000000064a6ef in Ffuncall (nargs=3, args=0x7fffffff4038) at
eval.c:2768
#12 0x000000000069f6c7 in exec_byte_code (bytestr=..., vector=...,
maxdepth=..., args_template=..., nargs=2, args=0x7fffffff47a0) at
bytecode.c:629
#13 0x000000000064b2bd in funcall_lambda (fun=..., nargs=2,
arg_vector=0x7fffffff4790) at eval.c:2967
#14 0x000000000064aef9 in apply_lambda (fun=..., args=..., count=58) at
eval.c:2903
#15 0x000000000064910b in eval_sub (form=...) at eval.c:2276
#16 0x00000000006439af in Fprogn (body=...) at eval.c:455
#17 0x0000000000645977 in Flet (args=...) at eval.c:969
#18 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#19 0x0000000000646801 in internal_lisp_condition_case (var=...,
bodyform=..., handlers=...) at eval.c:1303
#20 0x0000000000646293 in Fcondition_case (args=...) at eval.c:1227
#21 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#22 0x00000000006439af in Fprogn (body=...) at eval.c:455
#23 0x000000000064b729 in funcall_lambda (fun=..., nargs=1, arg_vector=0x0)
at eval.c:3042
#24 0x000000000064aef9 in apply_lambda (fun=..., args=..., count=53) at
eval.c:2903
#25 0x0000000000649312 in eval_sub (form=...) at eval.c:2306
#26 0x0000000000648e44 in eval_sub (form=...) at eval.c:2219
#27 0x00000000006436f6 in Fif (args=...) at eval.c:407
#28 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#29 0x00000000006439af in Fprogn (body=...) at eval.c:455
#30 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#31 0x0000000000643754 in Fif (args=...) at eval.c:410
#32 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#33 0x00000000006439af in Fprogn (body=...) at eval.c:455
#34 0x00000000006323d0 in Fsave_excursion (args=...) at editfns.c:1050
#35 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#36 0x00000000006439af in Fprogn (body=...) at eval.c:455
#37 0x0000000000645dd1 in internal_catch (tag=..., func=0x64390f <Fprogn>,
arg=...) at eval.c:1097
#38 0x0000000000645d85 in Fcatch (args=...) at eval.c:1074
#39 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#40 0x00000000006439af in Fprogn (body=...) at eval.c:455
#41 0x000000000064b729 in funcall_lambda (fun=..., nargs=1, arg_vector=0x0)
at eval.c:3042
#42 0x000000000064aef9 in apply_lambda (fun=..., args=..., count=44) at
eval.c:2903
#43 0x0000000000649312 in eval_sub (form=...) at eval.c:2306
#44 0x00000000006435a3 in For (args=...) at eval.c:368
#45 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#46 0x00000000006436f6 in Fif (args=...) at eval.c:407
#47 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#48 0x00000000006439af in Fprogn (body=...) at eval.c:455
#49 0x0000000000645977 in Flet (args=...) at eval.c:969
#50 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#51 0x00000000006439af in Fprogn (body=...) at eval.c:455
#52 0x00000000006323d0 in Fsave_excursion (args=...) at editfns.c:1050
#53 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#54 0x00000000006439af in Fprogn (body=...) at eval.c:455
#55 0x000000000064b729 in funcall_lambda (fun=..., nargs=0, arg_vector=0x0)
at eval.c:3042
#56 0x000000000064aef9 in apply_lambda (fun=..., args=..., count=37) at
eval.c:2903
#57 0x0000000000649312 in eval_sub (form=...) at eval.c:2306
#58 0x0000000000648e44 in eval_sub (form=...) at eval.c:2219
#59 0x0000000000648cda in eval_sub (form=...) at eval.c:2197
#60 0x0000000000643c68 in Fsetq (args=...) at eval.c:513
#61 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#62 0x00000000006439af in Fprogn (body=...) at eval.c:455
---Type <return> to continue, or q <return> to quit---
#63 0x000000000064b729 in funcall_lambda (fun=..., nargs=0, arg_vector=0x0)
at eval.c:3042
#64 0x000000000064aef9 in apply_lambda (fun=..., args=..., count=32) at
eval.c:2903
#65 0x0000000000649312 in eval_sub (form=...) at eval.c:2306
#66 0x0000000000643679 in Fand (args=...) at eval.c:389
#67 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#68 0x0000000000645243 in FletX (args=...) at eval.c:876
#69 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#70 0x00000000006439af in Fprogn (body=...) at eval.c:455
#71 0x000000000064b729 in funcall_lambda (fun=..., nargs=1, arg_vector=0x0)
at eval.c:3042
#72 0x000000000064aef9 in apply_lambda (fun=..., args=..., count=28) at
eval.c:2903
#73 0x0000000000649312 in eval_sub (form=...) at eval.c:2306
#74 0x0000000000643679 in Fand (args=...) at eval.c:389
#75 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#76 0x0000000000645243 in FletX (args=...) at eval.c:876
#77 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#78 0x00000000006439af in Fprogn (body=...) at eval.c:455
#79 0x00000000006323d0 in Fsave_excursion (args=...) at editfns.c:1050
#80 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#81 0x00000000006439af in Fprogn (body=...) at eval.c:455
#82 0x0000000000645977 in Flet (args=...) at eval.c:969
#83 0x0000000000648ae4 in eval_sub (form=...) at eval.c:2183
#84 0x00000000006439af in Fprogn (body=...) at eval.c:455
#85 0x000000000064b729 in funcall_lambda (fun=..., nargs=1, arg_vector=0x0)
at eval.c:3042
#86 0x000000000064aef9 in apply_lambda (fun=..., args=..., count=20) at
eval.c:2903
#87 0x0000000000649312 in eval_sub (form=...) at eval.c:2306
#88 0x00000000006439af in Fprogn (body=...) at eval.c:455
#89 0x000000000064b729 in funcall_lambda (fun=..., nargs=0, arg_vector=0x0)
at eval.c:3042
#90 0x000000000064a7f1 in Ffuncall (nargs=1, args=0x7fffffff8658) at
eval.c:2780
#91 0x000000000069f6c7 in exec_byte_code (bytestr=..., vector=...,
maxdepth=..., args_template=..., nargs=0, args=0x7fffffff8db0) at
bytecode.c:629
#92 0x000000000064b2bd in funcall_lambda (fun=..., nargs=0,
arg_vector=0x7fffffff8db0) at eval.c:2967
#93 0x000000000064a6ef in Ffuncall (nargs=1, args=0x7fffffff8da8) at
eval.c:2768
#94 0x000000000069f6c7 in exec_byte_code (bytestr=..., vector=...,
maxdepth=..., args_template=..., nargs=1, args=0x7fffffff9658) at
bytecode.c:629
#95 0x000000000064b2bd in funcall_lambda (fun=..., nargs=1,
arg_vector=0x7fffffff9650) at eval.c:2967
#96 0x000000000064a6ef in Ffuncall (nargs=2, args=0x7fffffff9648) at
eval.c:2768
#97 0x00000000006403df in Ffuncall_interactively (nargs=2,
args=0x7fffffff9648) at callint.c:252
#98 0x000000000064aa62 in funcall_subr (subr=0xd84260
<Sfuncall_interactively>, numargs=2, args=0x7fffffff9648) at eval.c:2821
#99 0x000000000064a6ab in Ffuncall (nargs=3, args=0x7fffffff9640) at
eval.c:2766
#100 0x0000000000642951 in Fcall_interactively (function=...,
record_flag=..., keys=...) at callint.c:841
#101 0x000000000064aba1 in funcall_subr (subr=0xd842a0
<Scall_interactively>, numargs=1, args=0x7fffffff9b08) at eval.c:2846
#102 0x000000000064a6ab in Ffuncall (nargs=2, args=0x7fffffff9b00) at
eval.c:2766
#103 0x000000000069f6c7 in exec_byte_code (bytestr=..., vector=...,
maxdepth=..., args_template=..., nargs=1, args=0x7fffffffa378) at
bytecode.c:629
#104 0x000000000064b2bd in funcall_lambda (fun=..., nargs=1,
arg_vector=0x7fffffffa370) at eval.c:2967
#105 0x000000000064a6ef in Ffuncall (nargs=2, args=0x7fffffffa368) at
eval.c:2768
#106 0x00000000006403df in Ffuncall_interactively (nargs=2,
args=0x7fffffffa368) at callint.c:252
#107 0x000000000064aa62 in funcall_subr (subr=0xd84260
<Sfuncall_interactively>, numargs=2, args=0x7fffffffa368) at eval.c:2821
#108 0x000000000064a6ab in Ffuncall (nargs=3, args=0x7fffffffa360) at
eval.c:2766
#109 0x0000000000642951 in Fcall_interactively (function=...,
record_flag=..., keys=...) at callint.c:841
#110 0x000000000064aba1 in funcall_subr (subr=0xd842a0
<Scall_interactively>, numargs=3, args=0x7fffffffa850) at eval.c:2846
#111 0x000000000064a6ab in Ffuncall (nargs=4, args=0x7fffffffa848) at
eval.c:2766
#112 0x000000000069f6c7 in exec_byte_code (bytestr=..., vector=...,
maxdepth=..., args_template=..., nargs=1, args=0x7fffffffb040) at
bytecode.c:629
#113 0x000000000064b2bd in funcall_lambda (fun=..., nargs=1,
arg_vector=0x7fffffffb038) at eval.c:2967
#114 0x000000000064a6ef in Ffuncall (nargs=2, args=0x7fffffffb030) at
eval.c:2768
#115 0x0000000000649fa8 in call1 (fn=..., arg1=...) at eval.c:2617
#116 0x0000000000591dad in command_loop_1 () at keyboard.c:1482
#117 0x000000000064689d in internal_condition_case (bfun=0x5915d0
<command_loop_1>, handlers=..., hfun=0x590c26 <cmd_error>) at eval.c:1332
#118 0x00000000005911d5 in command_loop_2 (ignore=...) at keyboard.c:1110
#119 0x0000000000645dd1 in internal_catch (tag=..., func=0x5911ac
<command_loop_2>, arg=...) at eval.c:1097
#120 0x0000000000591177 in command_loop () at keyboard.c:1089
#121 0x000000000059073b in recursive_edit_1 () at keyboard.c:695
#122 0x000000000059091a in Frecursive_edit () at keyboard.c:766
#123 0x000000000058e617 in main (argc=1, argv=0x7fffffffb538) at
emacs.c:1713
=====

In GNU Emacs 26.0.90 (build 13, x86_64-pc-linux-gnu, GTK+ Version 2.24.23)
 of 2017-11-16
Repository revision: 720322aab8cd8ffc24481f280c3acf60efdbc28b
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6
(Santiago)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
GNU Emacs 26.0.90 (build 13, x86_64-pc-linux-gnu, GTK+ Version 2.24.23) of
2017-11-16

Configured using:
 'configure --with-modules
 --prefix=/home/kmodi/usr_local/apps/6/emacs/emacs-26
 '--program-transform-name=s/^ctags$/ctags_emacs/'
 --enable-checking=yes,glyphs --enable-check-lisp-object-type
 'CPPFLAGS=-I/home/kmodi/usr_local/6/include -I/usr/include/freetype2
 -I/usr/include' 'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
 'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 96668 5900)
 (symbols 48 20863 1)
 (miscs 40 42 94)
 (strings 32 28740 1175)
 (string-bytes 1 765224)
 (vectors 16 14889)
 (vector-slots 8 511550 7362)
 (floats 8 49 68)
 (intervals 56 233 0)
 (buffers 992 11)
 (heap 1024 35228 805))

-- 

Kaushal Modi

[-- Attachment #1.2: Type: text/html, Size: 17004 bytes --]

[-- Attachment #2: test.org --]
[-- Type: application/octet-stream, Size: 2461 bytes --]

#+PROPERTY: header-args:nim :exports both :results output

* Nim in Action
** Threads
*** 6.2.1 The =threads= module and GC safety
**** Problematic code
#+BEGIN_SRC nim :flags --threads:on :eval no
var data = "Hello World"

proc showData() {.thread.} =
  echo(data)

var thread: Thread[void]
createThread[void](thread, showData)
joinThread(thread)
#+END_SRC

#+RESULTS:
: nim_src_I3YWGm.nim(6, 6) Error: 'showData' is not GC-safe as it
:  accesses 'data' which is a global using GC'ed memory

/Remove =:eval no= to see the above error./
**** Fixed code
#+BEGIN_SRC nim :flags --threads:on
var data = "Hello World"

proc showData(param: string) {.thread.} =
  echo(param)

var thread: Thread[string]
createThread[string](thread, showData, data)
joinThread(thread)
#+END_SRC

#+RESULTS:
: Hello World
** Parsing
*** 6.3.2 Parsing the Wikipedia page counts format
**** Using regular expressions
#+BEGIN_SRC nim
import re
let pattern = re"([^\s]+)\s([^\s]+)\s(\d+)\s(\d+)"
var line = "en Nim_(programming_language) 1 70231"
var matches: array[4, string]
let start = find(line, pattern, matches)

doAssert start      == 0
doAssert matches[0] == "en"
doAssert matches[1] == "Nim_(programming_language)"
doAssert matches[2] == "1"
doAssert matches[3] == "70231"

echo "Parsed successfully!"
#+END_SRC

#+RESULTS:
: Parsed successfully!

**** Parsing the data manually using =split=
#+BEGIN_SRC nim
import strutils
var line = "en Nim_(programming_language) 1 70231"
var matches = line.split()

doAssert matches[0] == "en"
doAssert matches[1] == "Nim_(programming_language)"
doAssert matches[2] == "1"
doAssert matches[3] == "70231"

echo "Parsed successfully!"
#+END_SRC

#+RESULTS:
: Parsed successfully!

**** Parsing the data manually using =parseutils=
#+BEGIN_SRC nim
import parseutils               # https://nim-lang.org/docs/parseutils.html
var line = "en Nim_(programming_language) 1 70231"

var i = 0
var domainCode = ""
#     parseUntil(s, token, until, start)
#       returns the number of parsed characters
i.inc parseUntil(line, domainCode, {' '}, i)
i.inc
var pageTitle = ""
i.inc parseUntil(line, pageTitle, {' '}, i)
i.inc
var countViews = 0
i.inc parseInt(line, countViews, i)
i.inc
var totalSize = 0
i.inc parseInt(line, totalSize, i)
i.inc

doAssert domainCode == "en"
doAssert pageTitle  == "Nim_(programming_language)"
doAssert countViews == 1
doAssert totalSize  == 70231

echo "Parsed successfully!"
#+END_SRC

#+RESULTS:
: Parsed successfully!

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-11-17 20:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 19:43 bug#29326: 26.0.90; Emacs crash on running comment-dwim Kaushal Modi
2017-11-17  7:03 ` Eli Zaretskii
2017-11-17  7:45   ` Eli Zaretskii
2017-11-17 17:11     ` Kaushal Modi
2017-11-17 18:06       ` Eli Zaretskii
2017-11-17 18:08         ` Kaushal Modi
2017-11-17 18:13           ` Kaushal Modi
2017-11-17 18:16             ` Noam Postavsky
2017-11-17 18:18               ` Kaushal Modi
2017-11-17 18:29                 ` Eli Zaretskii
2017-11-17 18:36                 ` Kaushal Modi
2017-11-17 19:46                   ` Eli Zaretskii
2017-11-17 20:04                     ` Kaushal Modi
2017-11-17 20:24                       ` Eli Zaretskii
2017-11-17 20:29                         ` Kaushal Modi

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.