Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Apr 2001 01:20:03 -0700 (PDT)
From:      Peter Pentchev <roam@orbitel.bg>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/26283: column coredumps on specific input
Message-ID:  <200104020820.f328K3j22505@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/26283; it has been noted by GNATS.

From: Peter Pentchev <roam@orbitel.bg>
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 <string.h>
  #include <unistd.h>
  
 +#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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104020820.f328K3j22505>