Emacs Bug: file-remote-p 2014-05-15
now my emacs is fried.
◆ xah@xah-p6813w◆ 2014-05-15 17:30 ◆ ~/ ◆ setsid emacs ◆ xah@xah-p6813w◆ 2014-05-15 17:30 ◆ ~/ ◆ Backtrace: emacs[0x50030b] emacs[0x4e631d] emacs[0x4feabe] emacs[0x4feb23] /lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f218c9c5cb0] emacs[0x44334c] emacs[0x448dea] emacs[0x45cbed] emacs[0x45f936] emacs[0x557c2c] emacs[0x42da1e] emacs[0x42d9e4] emacs[0x4498d5] emacs[0x4f10e1] emacs[0x4f2f74] emacs[0x4f41aa] emacs[0x557b02] emacs[0x4e8a3e] emacs[0x557a08] emacs[0x4eadb7] emacs[0x4eb0b2] emacs[0x41524f] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f218b61376d] emacs[0x415d55]
This post is just a record for myself. Following are the details.
the version is
GNU Emacs 126.96.36.199 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of 2014-04-24 on xah-p6813w ErgoEmacs distribution 2.0.0
(it's from emacs github mirror, i compiled myself on that date.)
here's what happened.
I have a elisp script that process 7 thousand html files.
(this https://github.com/xahlee/xahscripts/blob/master/make_download_copy/make_download_copy-find.el )
I run it regularly, few times a month.
Today i noticed a bug. Basically, one of my function expect 2 args of position (aka
point), but it got 2
nil. (due to a empty href value in html file).
the function call is this:
(xahsite-remove-ads (point-min) (point-max))
The calling function is “xah-remove-ads-in-file”.
the error message is this:
xah-remove-ads-in-file: Wrong type argument: integer-or-marker-p, nil
normally, when a function didn't get its args, it would simply cause the script to stop, that's all. But, apparently this caused emacs to semi-freeze and behave strangely. If i have
toggle-debug-on-error on, emacs would freeze hard. And in another instance, i see this error:
file-remote-p: wrong type of argument
and this would be repeated few times per second forever, printed into messages buffer, semi-freeze emacs with cpu going up and fan kicks in. C-g doesn't stop it, nor Cx C-c. Seems the only way is
killall emacs from terminal.
after a few force quit, then when i start emacs, emacs crashes with some
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f218c9c5cb0] error you see in the beginning of this post. (i think this is due to something in loading
/home/xah/.emacs.d/.emacs.desktop (that's emacs's desktop-save, loading previous session stuff.))
if i start emacs with
emacs --debug-init, emacs just freeze or crash
but anyway, i can get emacs to start by not loadin desktop.
i think this is reproducible. This code:
(xah-remove-ads-in-file "/home/xah/web/xahlee_org/diklo/xahlee_info/comp/blog_past_2011-11.html" "/home/xah/web/xahlee_info/comp/blog_past_2011-11.html" "/home/xah/web/xahlee_info/" )
where the first file is a html that contain this content:
<a href="">Screen Size Comparison: DVD, iPhone, iPad, MacBook, Blu-ray</a>
if you actually want to try, it's lightly complicated. All the 3 files should exist. The first 2 should be identical. You'll also need files from my emacs init on github, and also some of my packages in ErgoEmacs. I don't expect anyone to try to reproduce, this is just a log for myself.
i didn't have time to investigate. So, writing a log for now.