Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] lastpipe
Date: Sat, 26 May 2012 00:51:21
Message-Id: 201205252052.01386.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] lastpipe by Ciaran McCreesh
1 On Friday 25 May 2012 18:33:43 Ciaran McCreesh wrote:
2 > On Fri, 25 May 2012 15:02:32 -0500 Dan Douglas wrote:
3 > > If it were made a policy now that ebuilds and eclasses cannot depend
4 > > upon the subshell (for example, to set temporary positional
5 > > parameters or isolate temporary variables), then maybe someday in the
6 > > distant future this could be made the default, and in the meantime,
7 > > an option for those with new enough shells. Since dependence on the
8 > > subshell isn't very common, I think this should be feasible, and of
9 > > course as a workaround all that's required is to wrap any such
10 > > commands in parentheses.
11 >
12 > We'll be able to turn that on in a controlled way in EAPI 6. Having
13 > said that, if we're reaching the point where speed of bash code is
14 > at all relevant, then ebuilds are doing something wrong...
15
16 i don't think speed is the main motivator, but rather avoiding behavior that
17 bites new people all the time:
18 count=0
19 printf '%s\n' a b c | \
20 while read line ; do
21 : $(( count++ ))
22 done
23 echo $count
24
25 w/out lastpipe, that shows 0. w/lastpipe, that shows 3.
26 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] lastpipe Dan Douglas <ormaaj@×××××.com>