Date: Wed, 26 Jul 2006 11:59:51 -0700 From: Doug Barton <dougb@FreeBSD.org> To: Yar Tikhiy <yar@comp.chem.msu.su> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/etc rc.subr Message-ID: <44C7BBA7.60109@FreeBSD.org> In-Reply-To: <20060726072415.GC79886@comp.chem.msu.su> References: <200607251720.k6PHKMau082559@repoman.freebsd.org> <44C6FD55.7040204@FreeBSD.org> <20060726072415.GC79886@comp.chem.msu.su>
next in thread | previous in thread | raw e-mail | index | archive | help
Yar Tikhiy wrote: > On Tue, Jul 25, 2006 at 10:27:49PM -0700, Doug Barton wrote: >> Yar Tikhiy wrote: >>> yar 2006-07-25 17:20:22 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> etc rc.subr >>> Log: >>> Avoid extra runs of test(1) by using its built-in logical operations. >>> >>> Revision Changes Path >>> 1.63 +9 -15 src/etc/rc.subr >>> >>> http://www.FreeBSD.org/cgi/cvsweb.cgi/src/etc/rc.subr.diff?&r1=1.62&r2=1.63&f=h >> I'm pretty sure that this commit has the opposite effect from what you >> intended. If you do: >> >> [ foo -a bar ] >> >> then the bar test will always be run, whereas if you do >> >> [ foo ] && [ bar ] >> >> bar won't run unless foo succeeds. > > I believed test(1) was smarter than that. But as a matter of fact, > -a won't skip bar even if foo is false, neither will -o if foo is > true. Is this a bug or a required feature? If it makes you feel any better, I thought the same way you did, and learned my lessons the hard way. :) >> Also, you should be aware that in our /bin/sh test is a builtin, so what >> you're trying to optimize for is not actually an issue to start with. > > I admit that I was under the opposite impression that test(1) is > external to our sh(1). Perhaps our sh(1) manpage didn't state that > clearly enough. (Just clarified it.) Your change looks good, thanks for doing that. > Anyway, I should have looked at builtin(1), it said the truth. Well, no reason to really. Improving sh.1 is the right way to go here. >> Unless you can show that this commit actually does improve performance, I'd >> appreciate it if you'd reverse it. > > No objection! Fetched my back-out tool and gone applying it... Much appreciated. :) Doug -- This .signature sanitized for your protection
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44C7BBA7.60109>