<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Aug 24, 2018 at 5:29 PM Christos Zoulas <<a href="mailto:christos@zoulas.com">christos@zoulas.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Aug 24, 2:19pm, <a href="mailto:dkaspar@redhat.com" target="_blank">dkaspar@redhat.com</a> ("David Kaspar [Dee'Kej]") wrote:<br>
-- Subject: [Tcsh] Discard ~/.history when it grows over reasonable size<br>
<br>
<br>
I think you want to catch it earlier (while appending characters):<br>
<br>
diff --git a/sh.lex.c b/sh.lex.c<br>
index fee790a..091410e 100644<br>
--- a/sh.lex.c<br>
+++ b/sh.lex.c<br>
@@ -1522,6 +1522,8 @@ reread:<br>
onelflg--;<br>
} while (c == 0);<br>
Strbuf_append1(&histline, c);<br>
+ if (histline.len >= INBUFSIZE)<br>
+ return CHAR_ERR;<br>
return (c);<br>
}<br>
<br></blockquote><div><div style="font-family:monospace,monospace;font-size:small" class="gmail_default">I have actually tried similar approach before, but it didn't work. And unfortunately, this also leads to to tcsh eating all of the memory and triggering OOM killer... :-/<br><br></div><div style="font-family:monospace,monospace;font-size:small" class="gmail_default">I would like to tell you why is that, but I haven't fully understood yet how the lexical analyzer of tcsh work.<br><br></div><div style="font-family:monospace,monospace;font-size:small" class="gmail_default">So far, only the patch I have sent you works (partially).<br></div></div></div></div>