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

Re: Trying to backport valgrind to lenny



On Thu, May 27, 2010 at 05:54:21PM +0200, Carsten Aulbert wrote:
> On Thursday 27 May 2010 17:43:37 Alexander Wirt wrote:
> 
> > Ok, let me see:
> > libc6-dev-i386: libc6-dev-i386 | 2.7-18lenny1 |        stable | amd64
> > 2.7 is smaller than 2.3.0 so this won't work with lenny.
> 
> I am confused...
> 
> $ dpkg --compare-versions "2.7" ">>" "2.3.0"; echo $?           
> 0
> 
> Why is 2.7 smaller than 2.3.0?

Erm, it's not smaller - it's just as it should be :)  From
dpkg's manual page:

  dpkg returns success (zero result) if the specified condition is
  satisfied, and failure (nonzero result) otherwise.

In this case, the condition *is* satisfied, so dpkg returns zero.
The idea here is that in Unix programs, a zero exit code signifies
success, not error, and thus, in Bourne shell scripting, the "if"
and "while" conditionals are satisfied by a zero exit code and
fail on anything else.  So:

  if dpkg --compare-versions 2.7 '>>' 2.3.0; then
     echo 'Everything is just fine!'
  fi

...would succeed precisely because dpkg returns zero :)

HTH, HAND.

G'luck,
Peter

-- 
Peter Pentchev  roam@ringlet.net    roam@space.bg    roam@FreeBSD.org
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553

Attachment: signature.asc
Description: Digital signature


Reply to: