NetBSD Problem Report #4841

Received: (qmail 23890 invoked from network); 19 Jan 1998 06:59:01 -0000
Message-Id: <19980119065656.414.qmail@topaz.nemeton.com.au>
Date: 19 Jan 1998 06:56:56 -0000
From: giles@nemeton.com.au
Reply-To: giles@nemeton.com.au
To: gnats-bugs@gnats.netbsd.org
Subject: cat(1) bug with interaction of -b, -e options
X-Send-Pr-Version: 3.95

>Number:         4841
>Category:       bin
>Synopsis:       cat(1) bug with interaction of -b, -e options
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 18 23:05:01 +0000 1998
>Closed-Date:    Tue Feb 03 23:43:33 +0000 1998
>Last-Modified:  Mon Jun 27 14:15:00 +0000 2016
>Originator:     Giles Lean
>Release:        NetBSD-current January 18th 1998
>Organization:

Giles Lean               <giles@nemeton.com.au>             +61 3 9480 2118
Nemeton Pty. Ltd.                                       fax +61 3 9480 1771
PGP Fingerprint (DA68EE41) 9F FB 28 37 81 F2 AC F3  8A B0 37 E5 73 CF 39 E7
P5 Fingerprint char x[5]={0xf0, 0x0f, 0xc7, 0xc8}; main(){void(*f)()=x;f();}
>Environment:

System: NetBSD topaz.nemeton.com.au 1.3_ALPHA NetBSD 1.3_ALPHA (TOPAZ-DISKLESS) #0: Sat Nov 22 15:15:58 EST 1997 giles@topaz.nemeton.com.au:/usr/src/sys/arch/i386/compile/TOPAZ-DISKLESS i386


>Description:

Note here how the '$' are not lining up with the LHS of the file data
on blank lines:

% cat -be /etc/motd
     1	NetBSD 1.3_ALPHA (TOPAZ-DISKLESS) #0: Sat Nov 22 15:15:58 EST 1997$
$
     2	Welcome to NetBSD!$
$

I'd rather see:

% ./cat -be /etc/motd
     1	NetBSD 1.3_ALPHA (TOPAZ-DISKLESS) #0: Sat Nov 22 15:15:58 EST 1997$
      	$
     3	Welcome to NetBSD!$
      	$

For comparison, -ne gets it "right":

% cat -ne /etc/motd
     1	NetBSD 1.3_ALPHA (TOPAZ-DISKLESS) #0: Sat Nov 22 15:15:58 EST 1997$
     2	$
     3	Welcome to NetBSD!$
     4	$

>How-To-Repeat:
	$ cat -be /etc/motd
 Fix:
*** /a/NetBSD/SUP/src/bin/cat/cat.c	Tue Jan 13 23:13:40 1998
--- cat/cat.c	Mon Jan 19 17:36:39 1998
***************
*** 167,176 ****
  					gobble = 1;
  					continue;
  				}
! 				if (nflag && !bflag) {
! 					(void)fprintf(stdout, "%6d\t", ++line);
! 					if (ferror(stdout))
  						break;
  				}
  			} else if (nflag) {
  				(void)fprintf(stdout, "%6d\t", ++line);
--- 167,183 ----
  					gobble = 1;
  					continue;
  				}
! 				if (nflag) {
! 					++line;
! 					if (!bflag) {
! 					  (void)fprintf(stdout, "%6d\t", line);
! 					  if (ferror(stdout))
  						break;
+ 					} else if (eflag) {
+ 					  (void)fprintf(stdout, "%6s\t", " ");
+ 					  if (ferror(stdout))
+ 						break;
+ 					}
  				}
  			} else if (nflag) {
  				(void)fprintf(stdout, "%6d\t", ++line);
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open-> 
State-Changed-By: kleink 
State-Changed-When: Tue Jan 27 08:33:54 PST 1998 
State-Changed-Why:  
Fixed, thanks. 
(I've modified your fix so that the line-counting semantics of the `-b' option 
will not be affected, though.)

State-Changed-From-To: open->closed
State-Changed-By: mikel
State-Changed-When: Tue Feb  3 23:43:33 1998
State-Changed-Why:
should be closed.

From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/4841 CVS commit: src
Date: Tue, 27 Mar 2012 08:16:33 +0000

 Module Name:	src
 Committed By:	jruoho
 Date:		Tue Mar 27 08:16:33 UTC 2012

 Modified Files:
 	src/distrib/sets/lists/tests: mi
 	src/etc/mtree: NetBSD.dist.tests
 	src/tests/bin: Makefile
 Added Files:
 	src/tests/bin/cat: Makefile d_align.in d_align.out t_cat.sh

 Log Message:
 Add regression tests for the 1990s bugs PR bin/3538 and PR bin/4841.


 To generate a diff of this commit:
 cvs rdiff -u -r1.457 -r1.458 src/distrib/sets/lists/tests/mi
 cvs rdiff -u -r1.69 -r1.70 src/etc/mtree/NetBSD.dist.tests
 cvs rdiff -u -r1.1 -r1.2 src/tests/bin/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/bin/cat/Makefile \
     src/tests/bin/cat/d_align.in src/tests/bin/cat/d_align.out \
     src/tests/bin/cat/t_cat.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: venture37@geeklan.co.uk
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Adjust the ATF test case for bin/4841
Date: Sun, 26 Jun 2016 02:41:12 +0000 (UTC)

 >Submitter-Id:	net
 >Originator:	Sevan Janiyan
 >Organization:	Venture 37 Ltd
 >Confidential:	no
 >Synopsis:	Adjust the ATF test case for bin/4841
 >Severity:	non-critical
 >Priority:	low
 >Category:	standards
 >Class:		sw-bug
 >Release:	HEAD
 >Environment:	NetBSD 7.99.26 (GENERIC) #0: Sat Apr  2 19:23:46 UTC 2016 GENERIC amd64
 >Description:
 bin/4841 was filed regarding the handling of blank lines when cat was invoked with -be, however the test case did not utilise any blank lines, only testing that the text was aligned.

 Supplied patch introduces blank lines to the test case
 ok to commit?
 >How-To-Repeat:

 >Fix:
 Index: tests/bin/cat/d_align.in
 ===================================================================
 RCS file: /cvsroot/src/tests/bin/cat/d_align.in,v
 retrieving revision 1.1
 diff -u -p -u -r1.1 d_align.in
 --- tests/bin/cat/d_align.in	27 Mar 2012 08:16:33 -0000	1.1
 +++ tests/bin/cat/d_align.in	26 Jun 2016 02:32:06 -0000
 @@ -1,3 +1,5 @@
  a b c
 +
  1 2 3
 +
  x y z
 Index: tests/bin/cat/d_align.out
 ===================================================================
 RCS file: /cvsroot/src/tests/bin/cat/d_align.out,v
 retrieving revision 1.1
 diff -u -p -u -r1.1 d_align.out
 --- tests/bin/cat/d_align.out	27 Mar 2012 08:16:33 -0000	1.1
 +++ tests/bin/cat/d_align.out	26 Jun 2016 02:32:06 -0000
 @@ -1,3 +1,5 @@
       1	a b c$
 +      	$
       2	1 2 3$
 +      	$
       3	x y z$

From: David Holland <dholland-sourcechanges@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/4841: cat(1) bug with interaction of -b, -e options
Date: Mon, 27 Jun 2016 14:12:03 +0000

 commits no longer autoforward to PRs < 10000 (to reduce mishaps)

    ------

 From: Sevan Janiyan <sevan@netbsd.org>
 To: source-changes@NetBSD.org
 Subject: CVS commit: src/tests/bin/cat
 Date: Sun, 26 Jun 2016 22:50:46 +0000
 Mail-Followup-To: source-changes-d@NetBSD.org

 Module Name:	src
 Committed By:	sevan
 Date:		Sun Jun 26 22:50:46 UTC 2016

 Modified Files:
 	src/tests/bin/cat: d_align.in d_align.out

 Log Message:
 PR bin/4841 was filed regarding the handling of blank lines when cat was invoked
 with -be, the test case however did not utilise any blank lines, only testing
 that the text was aligned.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/tests/bin/cat/d_align.in \
     src/tests/bin/cat/d_align.out

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.