Subject: bug#59029: 29.0.50; noverlay: pdumper.c: dump_interval_node recursion has no base case

From: Matt Armstrong <[email-masked]>
Date: Sat, 05 Nov 2022 11:09:29 -0700

Gerd Möllmann <[email-masked]> writes:

> Yes, I think you are right.
>
> Could we also rename dump_interval_node to dump_itree_node?  There is
> another function dump_interval_tree for text properties, which is a bit
> confusing.

Attached renames the function and tags two related FIXMEs with this bug
number.  The root issue is that pdumping buffers with overlays is not
implemented.

>From 82c448f7f6eda810114151b5339d500fd6cf5826 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <[email-masked]>
Date: Sat, 5 Nov 2022 11:03:09 -0700
Subject: [PATCH 5/5] Add FIXME comments for overlays.

* src/pdumper.c (dump_itree_node): Renamed from dump_interval_node.
Add FIXME(Matt): comment for bug#59029.
(dump_buffer): Tag comment with FIXME bug#59029.
---
 src/pdumper.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/pdumper.c b/src/pdumper.c
index 0a5d96dbb7c..10b6f58bbd8 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2134,8 +2134,8 @@ dump_marker (struct dump_context *ctx, const struct Lisp_Marker *marker)
 }
 
 static dump_off
-dump_interval_node (struct dump_context *ctx, struct itree_node *node,
-                    dump_off parent_offset)
+dump_itree_node (struct dump_context *ctx, struct itree_node *node,
+		 dump_off parent_offset)
 {
 #if CHECK_STRUCTS && !defined (HASH_itree_node_50DE304F13)
 # error "itree_node changed. See CHECK_STRUCTS comment in config.h."
@@ -2158,21 +2158,25 @@ dump_interval_node (struct dump_context *ctx, struct itree_node *node,
   DUMP_FIELD_COPY (&out, node, rear_advance);
   DUMP_FIELD_COPY (&out, node, front_advance);
   dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
+  /* FIXME: bug#59029 We haven't implemented the code to dump overlays
+     that are part of a buffer.  The code below will recurse forever
+     if any of parent, left or right is non-NULL, but isn't worth
+     changing until we have a test case.  */
   if (node->parent)
       dump_remember_fixup_ptr_raw
 	(ctx,
 	 offset + dump_offsetof (struct itree_node, parent),
-	 dump_interval_node (ctx, node->parent, offset));
+	 dump_itree_node (ctx, node->parent, offset));
   if (node->left)
       dump_remember_fixup_ptr_raw
 	(ctx,
 	 offset + dump_offsetof (struct itree_node, left),
-	 dump_interval_node (ctx, node->left, offset));
+	 dump_itree_node (ctx, node->left, offset));
   if (node->right)
       dump_remember_fixup_ptr_raw
 	(ctx,
 	 offset + dump_offsetof (struct itree_node, right),
-	 dump_interval_node (ctx, node->right, offset));
+	 dump_itree_node (ctx, node->right, offset));
   return offset;
 }
 
@@ -2189,7 +2193,7 @@ dump_overlay (struct dump_context *ctx, const struct Lisp_Overlay *overlay)
   dump_remember_fixup_ptr_raw
     (ctx,
      offset + dump_offsetof (struct Lisp_Overlay, interval),
-     dump_interval_node (ctx, overlay->interval, offset));
+     dump_itree_node (ctx, overlay->interval, offset));
   return offset;
 }
 
@@ -2864,7 +2868,8 @@ dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
   DUMP_FIELD_COPY (out, buffer, long_line_optimizations_p);
 
   if (buffer->overlays && buffer->overlays->root != NULL)
-    /* We haven't implemented the code to dump overlays.  */
+    /* FIXME: bug#59029 We haven't implemented the code to dump
+       overlays that are in a buffer.  */
     emacs_abort ();
   else
     out->overlays = NULL;
-- 
2.35.1