🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #1075

Re: Strange behavior with functions

#1075
From: Chet Ramey
Date: Thu, 21 Dec 1989 03:58
49 lines
1398 bytes
In article <1989Dec21.013833.6811@usenet.ins.cwru.edu> I wrote:

	[Stupidity.  Mind-boggling stupidity.  Cursed be NNTP
	 and fast article propogation.  Gawd, it's embarassing]

I have fixed the bug, and I will send the fix to Brian.  Here's what I get
now:

usenet$ type rv
rv is a function
rv ()
{
[ $# = 0 ]&& {
local line=empty\?\?\?;
read line|| return;
echo Read: "$line" 2>&1 ;
rv;
echo "$line";
return;
};
local f=$1;
shift;
[ $# = 0 ]|| rv $*;
rv <$f ;
}
usenet$ rv ~/foo
Read: 1
Read: 2
Read: 3
Read: 4
Read: 5
5
4
3
2
1


It required changing a single line of code.  Funny how this one hasn't hit
before; *all* instances of functions executing `return' have always had
this bug.

Chet Ramey

-- 
Chet Ramey
Network Services Group				"Where's my froggie?"
Case Western Reserve University
chet@ins.CWRU.Edu			
Technical Details
Message-ID: <1989Dec21.035856.16917@usenet.ins.cwru.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet
References: <8912201910.AA16864@.reed.bitnet> <1989Dec21.013833.6811@usenet.ins.cwru.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet
From: chet@cwns1.CWRU.EDU (Chet Ramey)
Newsgroups: gnu.bash.bug
Subject: Re: Strange behavior with functions
Message-ID: <1989Dec21.035856.16917@usenet.ins.cwru.edu>
Date: 21 Dec 89 03:58:56 GMT
References: <8912201910.AA16864@.reed.bitnet> <1989Dec21.013833.6811@usenet.ins.cwru.edu>
Reply-To: chet@po.CWRU.Edu ()
Distribution: gnu
Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA)
Lines: 49