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

Re: Pre-Depends of #CDD#-common meta packages from cdd-common

On Sat, Jun 12, 2004 at 06:03:46PM +0200, Andreas Tille wrote:
> On Fri, 11 Jun 2004, Colin Watson wrote:
> > > > # A cut-down version of 'which' from debianutils.
> > >
> > > Hmmm, which is part of debianutils which is required.  Why do I
> > > have to work around this?
> >
> > You didn't read the patch in detail. (It does *not* use 'which'; it
> Well, I read it in detail and wondered *why* it does *not* use which
> if which is available.
> > reimplements it in pure shell. 'which' isn't reliably-enough portable.)
> This is what I do not understand: In how far is which not portable?

'which' is fine for interactive use, but if you try to use it in a
variety of shells and on a variety of operating systems you'll find that
its output and even sometimes its exit code vary too wildly for reliable
use in scripts. I used to use 'which' in a .bashrc shared across a
number of operating systems, and the astonishing variety of breakage
(even on some Linux distributions) was why I wrote a pure-Bourne-shell
version for myself and routinely avoid the command nowadays.

I guess in debian/postinst you can probably get away without worrying
about this, but I generally prefer portable shell wherever possible, by
way of good practice if nothing else. Of course, base-passwd.postinst
has special requirements because it's part of an Essential package, so
keeping dependencies to an absolute minimum is more valuable there.


Colin Watson                                  [cjwatson@flatline.org.uk]

Reply to: