From owner-freebsd-bugs Mon Apr 2 1:20: 9 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 A6CF537B71B for ; Mon, 2 Apr 2001 01:20:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f328K3j22505; Mon, 2 Apr 2001 01:20:03 -0700 (PDT) (envelope-from gnats) Date: Mon, 2 Apr 2001 01:20:03 -0700 (PDT) Message-Id: <200104020820.f328K3j22505@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: enderle@mdn.de Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/26283: column coredumps on specific input Date: Mon, 2 Apr 2001 11:11:20 +0300 On Mon, Apr 02, 2001 at 12:16:58AM -0700, enderle@mdn.de wrote: > > >Number: 26283 > >Category: bin > >Synopsis: column coredumps on specific input > >Originator: Steven Enderle > >Release: 4.2-STABLE > >Organization: > mdn Hübner GmbH > >Environment: > FreeBSD BSD03 4.2-STABLE FreeBSD 4.2-STABLE #0: Mon Dec 4 16:34:57 CET 2000 root@BSD03:/usr/src/sys/compile/BSD03 i386 > >Description: > column coredumps on some input > >How-To-Repeat: > % printf "1\n2\n3\n4\n5\n6\n" | column -c 2 > zsh: done printf 1\n2\n3\n4\n5\n6\n | > zsh: floating point exception (core dumped) column -c 2 Hmm. It would seem that the problem is that maxlength is TAB-aligned after the maxlength > termwidth check, and *then* the number of columns is calculated as termwidth / maxlength. In the case of termwidth < TAB, this leads to numcols = 0 (termwidth / TAB). 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 ;) G'luck, Peter -- I am the meaning of this sentence. 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:08:38 @@ -52,6 +52,8 @@ #include #include +#define TAB 8 + void c_columnate __P((void)); void *emalloc __P((int)); void input __P((FILE *)); @@ -122,7 +124,7 @@ if (tflag) maketbl(); - else if (maxlength >= termwidth) + else if ((maxlength >= termwidth) || (termwidth < TAB)) print(); else if (xflag) c_columnate(); @@ -131,7 +133,6 @@ exit(eval); } -#define TAB 8 void c_columnate() { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message