On Sat, Aug 8, 2009 at 5:22 AM, Trent W. Buck<[email protected]> wrote:
Correct -- but just because cygwin provides utilities, doesn't mean they're ALL installed at all sites.* * * Allow me to break your script on a more conventional system: Debian. Alice can't apt-get install hlint yet, so she uses cabal-install. This places the binary in ~/.cabal/bin, which is not in her normal PATH. For some misguided reason, she abhors PATH bloat, and so doesn't want to add that directory permanently to her PATH in her .zshrc. She works out that she can use BASH_ENV to make hlint visible to Darcs' test scripts (which run bash) without polluting her interactive zsh environments, nor the Debian-supplied sh scripts: zeus% tail -1 ~/.zshrc export BASH_ENV=~/.bash_env zeus% cat $BASH_ENV PATH=$PATH:~/.cabal/bin zeus% bash -c 'hlint --help | head -1' HLint v1.2, (C) Neil Mitchell 2006-2009, University of York zeus% sh -c 'hlint --help | head -1' sh: hlint: not found This works fine while all Darcs tests use bash, but if some start to use sh, those scripts will break. Since I've just explained WHY they'll break, it's obvious to readers what the problem is. But now imagine trying to isolate the above problem when all you're given is % cabal test [...] sh: hlint: not found That's a contrived example, but it's not far from the real world. (I had essentially the opposite problem: bash was behaving "incorrectly" when invoked as bash, because I didn't know $ENV is read if *and only if* in sh-compatibility mode.)But one might not have bash but have sh.In the case of Darcs test scripts, this scenario is not allowed to occur, because bash is decreed to be a dependency for the tests.
OK, I think that's a very bizarre system. (Oh, we can set up cygwin on top of Windows' bloat and everything, but we can't spare a few bits to have a symlink from sh to bash?) But a counterexample has been produced, so I'll change it.
One should use only what one needs; the hlint script doesn't need the lib script, so it doesn't call it. It doesn't need bash, so it doesn't call it.I understand your reasoning, but I would like to avoid unnecessary differences between tests as much as unnecessary code IN the scripts.
But that's still not any reason to call lib. The only way the hlint script could possibly be affected by lib is by the set -ev call, since it doesn't use any of the 3 shell functions defined in lib, and I don't think those actually matter (hlint can either be found in $PATH & run or not). -- gwern
signature.asc
Description: OpenPGP digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
