On Wed, Jun 28, 2017 at 07:36:54PM +0200, Martijn van Duren wrote:
> On 06/28/17 19:00, Theo de Raadt wrote:
> > Sounds good.
> >
> > It might be nice to determine if these two variables should be one,
> > ie. tied together better.
>
> I was thinking the same thing. Both are used for input line buffering,
> so I reckon that's sane.
>
> Identical checksum compared to previous diff.
ok anton@
> >> Hello tech@,
> >>
> >> On monday I was playing with the build environment of PHP and all of a
> >> sudden I couldn't finish the command because the command buffer was
> >> full, so I was forced to use bash to finish what I set out to do. Of
> >> course I'd rather stay on ksh, so here's a patch (guided by anton@)
> >> which increases the buffer sizes of ksh.
> >>
> >> I've been running this full time @$DAYJOB for two days with the S
> >> malloc option enabled and just did a full system reboot with the
> >> whole malloc.conf shebang without any issues.
> >>
> >> OK?
> >>
> >> martijn@
> >>
>
> Index: sh.h
> ===================================================================
> RCS file: /cvs/src/bin/ksh/sh.h,v
> retrieving revision 1.58
> diff -u -p -r1.58 sh.h
> --- sh.h 8 Sep 2016 15:50:50 -0000 1.58
> +++ sh.h 28 Jun 2017 17:33:58 -0000
> @@ -32,7 +32,7 @@
> #define MAGIC (7) /* prefix for *?[!{,} during expand */
> #define ISMAGIC(c) ((unsigned char)(c) == MAGIC)
>
> -#define LINE 2048 /* input line size */
> +#define LINE 4096 /* input line size */
> #define PATH 1024 /* pathname size (todo:
> PATH_MAX/pathconf()) */
>
> extern const char *kshname; /* $0 */
> Index: vi.c
> ===================================================================
> RCS file: /cvs/src/bin/ksh/vi.c,v
> retrieving revision 1.47
> diff -u -p -r1.47 vi.c
> --- vi.c 31 May 2017 20:18:43 -0000 1.47
> +++ vi.c 28 Jun 2017 17:33:58 -0000
> @@ -18,7 +18,6 @@
> #include "sh.h"
> #include "edit.h"
>
> -#define CMDLEN 2048
> #define CTRL(c) (c & 0x1f)
>
> struct edstate {
> @@ -143,24 +142,24 @@ const unsigned char classify[128] = {
> #define VSEARCH 9 /* /, ? */
> #define VVERSION 10 /* <ESC> ^V */
>
> -static char undocbuf[CMDLEN];
> +static char undocbuf[LINE];
>
> static struct edstate *save_edstate(struct edstate *old);
> static void restore_edstate(struct edstate *old, struct edstate
> *new);
> static void free_edstate(struct edstate *old);
>
> static struct edstate ebuf;
> -static struct edstate undobuf = { undocbuf, CMDLEN, 0, 0, 0 };
> +static struct edstate undobuf = { undocbuf, LINE, 0, 0, 0 };
>
> static struct edstate *es; /* current editor state
> */
> static struct edstate *undo;
>
> -static char ibuf[CMDLEN]; /* input buffer */
> +static char ibuf[LINE]; /* input buffer */
> static int first_insert; /* set when starting in insert mode */
> static int saved_inslen; /* saved inslen for first insert */
> static int inslen; /* length of input buffer */
> static int srchlen; /* number of bytes in search pattern */
> -static char ybuf[CMDLEN]; /* yank buffer */
> +static char ybuf[LINE]; /* yank buffer */
> static int yanklen; /* length of yank buffer */
> static int fsavecmd = ' '; /* last find command */
> static int fsavech; /* character to find */
> @@ -196,7 +195,7 @@ x_vi(char *buf, size_t len)
> {
> int c;
>
> - vi_reset(buf, len > CMDLEN ? CMDLEN : len);
> + vi_reset(buf, len > LINE ? LINE : len);
> vi_pprompt(1);
> x_flush();
> while (1) {
> @@ -1368,7 +1367,7 @@ static char *wbuf[2]; /* current &
> prev
> static int wbuf_len; /* length of window buffers (x_cols-3)*/
> static int win; /* number of window buffer in use */
> static char morec; /* more character at right of window */
> -static char holdbuf[CMDLEN]; /* place to hold last edit buffer */
> +static char holdbuf[LINE]; /* place to hold last edit buffer */
> static int holdlen; /* length of holdbuf */
>
> static void
>