I was trying to debug another bug by putting a debug_print(tag) into
Fthrow, when temacs starts to sigsegv while dumping. After a few hours bug
tracing I found inhibit_non_essential_conversion_operations changes
while print_internal in print.c is active. I'm not sure which function
down the call path makes this change, but actually, I think
print_internal should not be sensitive to such a change, whether the
sub-functions of print_internal are allowed to change
inhibit_..._operations or not.
This patch saves a local copy of inhibit_.._operations on the stack, so
the behaviour is guaranteed to be consistant across the whole stack
frame lifetime of print_internal. Inconsistant behaviour results in an
unbind_to(specdepth = 0), which results in a crash..
Diffed against sjt-xft.
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.758.2.27
diff -u -r1.758.2.27 ChangeLog
--- ChangeLog 2005/09/20 16:05:56 1.758.2.27
+++ ChangeLog 2005/09/22 13:13:11
@@ -1,3 +1,10 @@
+2005-09-22 Clemens Fruhwirth <clemens(a)endorphin.org>
+
+ * print.c (print_internal): Incorrectly calls unbind_to, when
+ inhibit_non_essential_conversion_operations is changed while this
+ function is active. Hence, save a local copy of this variable when
+ entering print_internal.
+
2005-09-14 Stephen J. Turnbull <stephen(a)xemacs.org>
* XEmacs 21.5.22 "cucumber" is released.
Index: print.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/print.c,v
retrieving revision 1.51.2.3
diff -u -r1.51.2.3 print.c
--- print.c 2005/07/13 04:46:55 1.51.2.3
+++ print.c 2005/09/22 13:13:15
@@ -1541,6 +1541,7 @@
{
/* This function can GC */
int specdepth = 0;
+ int local_inhibit_non_ess_conv_ops = inhibit_non_essential_conversion_operations;
struct gcpro gcpro1, gcpro2;
QUIT;
@@ -1586,7 +1587,7 @@
/* Avoid calling internal_bind_int, which conses, when called from
debug_prin1. In that case, we have bound print_depth to 0 anyway. */
- if (!inhibit_non_essential_conversion_operations)
+ if (!local_inhibit_non_ess_conv_ops)
{
specdepth = internal_bind_int (&print_depth, print_depth + 1);
@@ -1679,7 +1680,7 @@
debug_print() or we're already crashing. In such cases,
(further) crashing is counterproductive. */
- if (inhibit_non_essential_conversion_operations &&
+ if (local_inhibit_non_ess_conv_ops &&
!debug_can_access_memory (lheader, sizeof (*lheader)))
{
write_fmt_string (printcharfun, "#<EMACS BUG: BAD MEMORY %p>",
@@ -1725,7 +1726,7 @@
(e.g. under Unix we typically have to set a SIGSEGV handler and
try to trigger a seg fault). */
- if (inhibit_non_essential_conversion_operations)
+ if (local_inhibit_non_ess_conv_ops)
{
if (!debug_can_access_memory
(lheader, detagged_lisp_object_size (lheader)))
@@ -1768,7 +1769,7 @@
}
}
- if (!inhibit_non_essential_conversion_operations)
+ if (!local_inhibit_non_ess_conv_ops)
unbind_to (specdepth);
UNGCPRO;
}
Show replies by date