>>>> "Clemens" == Clemens Fruhwirth
<clemens(a)endorphin.org> writes:
Clemens> I was trying to debug another bug by putting a
Clemens> debug_print(tag) into Fthrow, when temacs starts to
Clemens> sigsegv while dumping. After a few hours bug tracing I
Clemens> found inhibit_non_essential_conversion_operations changes
Clemens> while print_internal in print.c is active. I'm not sure
Clemens> which function down the call path makes this change,
It looks to me like it could be debug_p4(), which calls itself recursively
(which resets the global), then starts doing more output.
Clemens> but actually, I think print_internal should not be
Clemens> sensitive to such a change, whether the sub-functions of
Clemens> print_internal are allowed to change
Clemens> inhibit_..._operations or not.
If that's true for print_internal, presumably it should be true for
all of the lower-level functions too, since this is very mutually
recursive. But this is beyond me ... Ben?
For Ben's convenience I preserve the rest of the post below.
Please keep Ben's CC, as it bumps the thread up in priority for him.
------------------------------------------------------------------------
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;
}
--
School of Systems and Information Engineering
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.