You are not logged in.

#1 2010-06-25 03:47:49

lomov_vl
Member
From: Russia, Irkutsk
Registered: 2010-01-20
Posts: 34
Website

About vercmp return code

Hi.

Sorry if my question is too newbie smile

Consider these three examples:

1.

$ vercmp "1.5" "1.5-1"
0
$ echo $?
0

2.

$ vercmp "1.5-2" "1.5-1"
1
$ echo $?
1

3.

$ vercmp "1.5-1" "1.5-2"
-1
$ echo $?
255

Is this expected? (I mean the program exit status).

P.S.
This question came up while I was trying to figure out why I cannot build kernel26zen (git-stable) after pacman upgrading.

In PKGBUILD there are lines

    msg "Testing if current kernel version is supported by this PKGBUILD..."
    vercmp "2.6.30" "$(make kernelversion)" > /dev/null
    if [ $? -eq 1 ]; then
        error "Failed"
        return 1
    fi

and 'makepkg' stops after 'vercmp'. Could 'vercmp' return other exit codes in past (before 3.4 version of pacman)?

System:
Archlinux x86_64,

$ LANG=C pacman --version

 .--.                  Pacman v3.4.0 - libalpm v5.0.0
/ _.-' .-.  .-.  .-.   Copyright (C) 2006-2010 Pacman Development Team
\  '-. '-'  '-'  '-'   Copyright (C) 2002-2006 Judd Vinet
 '--'
                       This program may be freely redistributed under
                       the terms of the GNU General Public License.

Offline

#2 2010-06-25 04:13:41

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: About vercmp return code

The return value of main is unsigned; therefore, -1 and 255 are equivalent when compared in terms of an 8 bit unsigned binary number. Whether or not this is intended.. not sure.. looks like the intent of the PKGBUILD is not to build anything newer than 2.6.30.

Last edited by falconindy (2010-06-25 04:15:55)

Offline

#3 2010-06-26 01:25:50

lomov_vl
Member
From: Russia, Irkutsk
Registered: 2010-01-20
Posts: 34
Website

Re: About vercmp return code

falconindy wrote:

The return value of main is unsigned; therefore, -1 and 255 are equivalent when compared in terms of an 8 bit unsigned binary number.

Well, up to now I didn't pay much attention what (signed vs unsigned) main should return.

Whether or not this is intended.. not sure..
looks like the intent of the PKGBUILD is not to build anything newer than 2.6.30.

This is another problem. I mentioned it here because I faced with it only when I upgraded pacman and 'makepkg' stops at these lines.
So I thought that the 'vercmp' in PKGBUILD was to check if version of building kernel is newer than 2.6.30 and continue if it is true.
This thought was based on my previous experience with kernel26zen building for kernel version > 2.6.30.

Now 'makepkg' is interrupted on the 'vercmp' (I don't see 'Failed').

If everything is OK with 'vercmp' then something other was changed that cause 'makepkg' to be interrupted.

Thank you for information.

Offline

Board footer

Powered by FluxBB