From owner-freebsd-bugs Mon Apr 2 1:50: 5 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C255537B726 for ; Mon, 2 Apr 2001 01:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f328o1G25952; Mon, 2 Apr 2001 01:50:01 -0700 (PDT) (envelope-from gnats) Date: Mon, 2 Apr 2001 01:50:01 -0700 (PDT) Message-Id: <200104020850.f328o1G25952@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: bin/26283: column coredumps on specific input Reply-To: Peter Pentchev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/26283; it has been noted by GNATS. From: Peter Pentchev To: David Malone Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/26283: column coredumps on specific input Date: Mon, 2 Apr 2001 11:38:51 +0300 On Mon, Apr 02, 2001 at 09:26:21AM +0100, David Malone wrote: > On Mon, Apr 02, 2001 at 01:20:03AM -0700, Peter Pentchev wrote: > > > Could you try the following patch? It works for me.. > > (As a side point, maybe the tab-size should be configurable.. but that's > > another battle ;) > > I think that this leaves the problem open in some other cases. > Try: > > echo "aaaaaaaaaaaa" | ./column -c 15 > > maxlength probably needs to be rounded up to the nearest tabstop > before the test is carried out. Yes, that was my first idea; I can't really remember what was wrong with it, why didn't I fix it that way :) Updated patch follows.. As another side point, column -t (table mode) seems to just ignore the terminal size.. is that The Right Thing (tm)? G'luck, Peter -- .siht ekil ti gnidaer eb d'uoy ,werbeH ni erew ecnetnes siht fI Index: src/usr.bin/column/column.c =================================================================== RCS file: /home/ncvs/src/usr.bin/column/column.c,v retrieving revision 1.4 diff -u -r1.4 column.c --- src/usr.bin/column/column.c 1998/12/06 22:58:18 1.4 +++ src/usr.bin/column/column.c 2001/04/02 08:37:21 @@ -52,6 +52,8 @@ #include #include +#define TAB 8 + void c_columnate __P((void)); void *emalloc __P((int)); void input __P((FILE *)); @@ -120,6 +122,7 @@ if (!entries) exit(eval); + maxlength = (maxlength + TAB) & ~(TAB - 1); if (tflag) maketbl(); else if (maxlength >= termwidth) @@ -131,14 +134,12 @@ exit(eval); } -#define TAB 8 void c_columnate() { int chcnt, col, cnt, endcol, numcols; char **lp; - maxlength = (maxlength + TAB) & ~(TAB - 1); numcols = termwidth / maxlength; endcol = maxlength; for (chcnt = col = 0, lp = list;; ++lp) { @@ -166,7 +167,6 @@ { int base, chcnt, cnt, col, endcol, numcols, numrows, row; - maxlength = (maxlength + TAB) & ~(TAB - 1); numcols = termwidth / maxlength; numrows = entries / numcols; if (entries % numcols) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message