[Tcsh] Discard ~/.history when it grows over reasonable size

Christos Zoulas christos at zoulas.com
Mon Aug 27 08:36:40 EDT 2018


On Aug 27,  1:54pm, dkaspar at redhat.com ("David Kaspar [Dee'Kej]") wrote:
-- Subject: Re: [Tcsh] Discard ~/.history when it grows over reasonable size

| > diff --git a/sh.lex.c b/sh.lex.c
| > index fee790a..091410e 100644
| > --- a/sh.lex.c
| > +++ b/sh.lex.c
| > @@ -1522,6 +1522,8 @@ reread:
| >             onelflg--;
| >      } while (c == 0);
| >      Strbuf_append1(&histline, c);
| > +    if (histline.len >= INBUFSIZE)
| > +       return CHAR_ERR;
| >      return (c);
| >  }
| >
| > 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... :-/
| 
| I would like to tell you why is that, but I haven't fully understood yet
| how the lexical analyzer of tcsh work.
| 
| So far, only the patch I have sent you works (partially).

How can I test it?

christos


More information about the Tcsh mailing list