bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in function return statement in while subshell


From: Chet Ramey
Subject: Re: Bug in function return statement in while subshell
Date: Tue, 30 Jul 2013 15:03:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 7/30/13 10:30 AM, Chris Down wrote:
> On 2013-07-30 10:18, Greg Wooledge wrote:
>> After the fork() which creates the subshell, each of the two processes
>> (parent and child) is still within its own instance of the function.
>> The "return" command executed in the child causes the child's function
>> to terminate, but this does not cause the parent's function to terminate.
> 
> I think we all understand the technical reasons *why* this occurs, that has
> seemed clear since the beginning. My concern is that I think it is 
> semantically
> wrong to act as if we are still in a function when in a child, and accept a
> return statement there.

And we are now back to where we were yesterday at this time: most people
aren't really aware of when and how subshells are created.  Why should
a pipeline in a function cause `return' to raise an error?  (And this
can change based on the value of the `lastpipe' shell option.)

Chet
> 


- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlH4Df4ACgkQu1hp8GTqdKtpxACgijLSEfNL6LKfETChX/9TyrQc
S2QAniY+QeybzddyVp/BnP6hejtrWVUL
=5XzB
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]