🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.usg
Article #1

Possible bug in cut(1)

#1
From: Daniel R. Levy
Date: Sat, 16 Nov 1985 06:24
41 lines
2094 bytes
Situation: bug in cut(1)

Description:

	When an attempt was made to port cut(1) onto a non-usg system,
	(in this case, Eunice under VMS 4.1) a problem showed up.  Some-
	times an error message

		"bad list for c/f option"

	would appear for no good reason, when the options were all valid.
	The problem is mentioned here because the cause could theoretically
	bite on any system, though it seems to work OK on the usg systems
	tried.

Cause and Fix:

	The (automatic) variable "num" should have been initialized to
	zero before first use.  It was not.  Therefore, it was possible
	for it to begin with a nonzero value.  In fact it did in the
	porting attempt; it began with a value so large that cut detected
	an error in the result.  There is potentially a similar problem
	with the variable "r" also.  Lint caught both of these, as well
	as pointing out that *d is declared and never used, and that
	the function diagl() appears and is not used (it is functionless,
	pardon the pun).

	On (approx.) line 29 of cut.c,

		endflag = supflag = cflag = fflag = 0;

	should be changed to

		r = num = endflag = supflag = cflag = fflag = 0;
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!ihnp4!ttrdc!levy
Technical Details
Message-ID: <579@ttrdc.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mgnetp!ltuxa!ttrdc!levy

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site ttrdc.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mgnetp!ltuxa!ttrdc!levy
From: levy@ttrdc.UUCP (Daniel R. Levy)
Newsgroups: net.bugs.usg
Subject: Possible bug in cut(1)
Message-ID: <579@ttrdc.UUCP>
Date: Sat, 16-Nov-85 01:24:39 EST
Article-I.D.: ttrdc.579
Posted: Sat Nov 16 01:24:39 1985
Date-Received: Mon, 18-Nov-85 06:26:11 EST
Organization: AT&T, Computer Systems Division, Skokie, IL
Lines: 41