This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-12-session-parity
in repository terminology.
View the commit online.
commit bdd5af8072e28d766e64cedbce2bb4f685c7faf5
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Nov 23 18:08:12 2026 -0600
termpty: bound the blocks waiting for their placement
A program that displays blocks and never fills the cells it announced
queued one entry per block id without limit, so output alone could grow
the memory of the terminal, and of the tymux daemon.
Keep at most 64 and drop the oldest when another comes in.
---
src/bin/termpty.c | 6 ++++++
src/bin/termpty.h | 4 ++++
src/bin/termptyblock.c | 23 +++++++++++++++++++++++
src/bin/tytest.c | 1 +
src/bin/unit_tests.h | 1 +
5 files changed, 35 insertions(+)
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 67ed39e6..d15d7510 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1878,6 +1878,12 @@ termpty_block_insert(Termpty *ty, int ch, Termblock *blk)
ex->w = blk->w;
ex->h = blk->h;
ty->block.expecting = eina_list_append(ty->block.expecting, ex);
+ if (eina_list_count(ty->block.expecting) > TERMPTY_BLOCK_EXPECTING_MAX)
+ {
+ free(eina_list_data_get(ty->block.expecting));
+ ty->block.expecting = eina_list_remove_list(ty->block.expecting,
+ ty->block.expecting);
+ }
}
Termblock *
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 3ac4f2f1..c1c82fe1 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -125,6 +125,10 @@ typedef enum exmod {
/* longest terminology escape: twice tysend's largest data packet */
#define TERMPTY_TY_ESCAPE_MAX (128 * 1024)
+/* The cells a program announced with "is" that its output did not fill yet.
+ * What it announces and never fills is not kept without bound: the oldest
+ * goes. */
+#define TERMPTY_BLOCK_EXPECTING_MAX 64
typedef enum _Termpty_Selection_Read_Answer {
TERMPTY_SELECTION_READ_DENY = 0,
diff --git a/src/bin/termptyblock.c b/src/bin/termptyblock.c
index 24a8e590..e949f412 100644
--- a/src/bin/termptyblock.c
+++ b/src/bin/termptyblock.c
@@ -647,6 +647,29 @@ tytest_termpty_block_channel_find_newer_claims(void)
return 0;
}
+int
+tytest_termpty_block_expecting_cap(void)
+{
+ Termpty ty;
+ Termblock blk = { .w = 1, .h = 1 };
+ Termexp *ex;
+ Eina_List *l;
+ int i, id;
+
+ memset(&ty, 0, sizeof(ty));
+ for (i = 0; i < 1000; i++)
+ {
+ blk.id = i;
+ termpty_block_insert(&ty, 'a', &blk);
+ }
+ assert(eina_list_count(ty.block.expecting) == TERMPTY_BLOCK_EXPECTING_MAX);
+ id = 1000 - TERMPTY_BLOCK_EXPECTING_MAX;
+ EINA_LIST_FOREACH(ty.block.expecting, l, ex)
+ assert(ex->id == id++);
+ EINA_LIST_FREE(ty.block.expecting, ex) free(ex);
+ return 0;
+}
+
int
tytest_termpty_block_msg_count(void)
{
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index 1769839b..5ca1e01e 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -113,6 +113,7 @@ static struct {
{ "termpty_block_serialize", tytest_termpty_block_serialize},
{ "termpty_block_channel_find", tytest_termpty_block_channel_find},
{ "termpty_block_msg_count", tytest_termpty_block_msg_count},
+ { "termpty_block_expecting_cap", tytest_termpty_block_expecting_cap},
{ "termpty_file_packet", tytest_termpty_file_packet},
{ "termpty_block_channel_find_newer_claims", tytest_termpty_block_channel_find_newer_claims},
{ "backlog_row_get_args", tytest_backlog_row_get_args},
diff --git a/src/bin/unit_tests.h b/src/bin/unit_tests.h
index ee966ee1..5b353c1e 100644
--- a/src/bin/unit_tests.h
+++ b/src/bin/unit_tests.h
@@ -10,6 +10,7 @@ int tytest_termpty_block_command(void);
int tytest_termpty_block_serialize(void);
int tytest_termpty_block_channel_find(void);
int tytest_termpty_block_msg_count(void);
+int tytest_termpty_block_expecting_cap(void);
int tytest_termpty_file_packet(void);
int tytest_termpty_block_channel_find_newer_claims(void);
int tytest_write_hook(void);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.