[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/6] use print or printf or cat as $ECHO
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH 6/6] use print or printf or cat as $ECHO |
Date: |
Mon, 10 Nov 2008 20:59:55 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hello,
* Eric Blake wrote on Mon, Nov 10, 2008 at 05:30:27PM CET:
> Paolo Bonzini <bonzini <at> gnu.org> writes:
>
> > 1) these tests do cost a few subshells (which can be as expensive as a
> > fork on bash, even if the executed command is a builtin). In the
> > attached patch I conditionalized it on ${TMOUT} so that it is not
> > executed unless we're on ksh.
> Your filter based on TMOUT is different
> than my filter on {BASH,ZSH}_VERSION; I could go either way (I tested that
> pdksh also supplies both $TMOUT and print).
Who guarantees you that ksh supplies TMOUT? OTOH, TMOUT is not in any
way restricted, so a user (more likely: a sysadmin) could set and export
it, and reasonably so: every Posix shell understands it, bash included.
> Things to consider: How likely is TMOUT to be exported in bash (causing a
> false
> positive), vs. BASH_VERSION to be exported in ksh (which causes way more
> problems than a spurious export of TMOUT)? On the other hand, using a
> positive
> test (TMOUT being set) vs. a negative test (BASH_VERSION is not set) means
> that
> your version avoids 2 forks on ash or Solaris /bin/sh while mine does not.
> Should we document $TMOUT as a reliable way to detect ksh, the way we already
> use {BASH,ZSH}_VERSION as reliable witnesses of those two shells?
Where did you get the idea that TMOUT is a reliable way to detect ksh?
And since when are 2 forks a suitable tradeoff for portability?
Thanks,
Ralf