Menu

#684 library version check logic buggy

open
5
2007-09-11
2007-08-01
No

I found an odd bug in gphoto2/m4m/gp-check-library.m4:

It has logic like the following. Note that the way this is written, version 2.3.1.0 is newer than 2.4.0 because the third digit "1" is greater than "0".

In other words this test will fail if *any* of the numbers are higher. So 2.4.0 would be considered older than 3.0 (because 4>0), etc.

So, probably we shouldn't just do elif for each array element. If test n fails, then we shouldn't do the n+1 test.

I assume that this code doesn't get hit too much since it only gets called if the libgphoto2.pc files can't be found, then it defaults back to try to call gphoto2-config. I just wanted to let you know it is broken. I don't have a patch to fix it.

---

(note the comparison in this case is -lt)

_tmp=false
if test "${_[$1]_VER_1}" "${_[$1]_COMPN}" "${_[$1]_REQ_1}"; then _tmp=true;
elif test "${_[$1]_VER_2}" "${_[$1]_COMPN}" "${_[$1]_REQ_2}"; then _tmp=true;
elif test "${_[$1]_VER_3}" "${_[$1]_COMPN}" "${_[$1]_REQ_3}"; then _tmp=true;
elif test "x${_[$1]_VER_4}" = "x" && test "x${_[$1]_REQ_4}" != "x"; then _tmp=true;
elif test "${_[$1]_VER_4}" "${_[$1]_COMPN}" "${_[$1]_REQ_4}"; then _tmp=true;
fi
AC_MSG_CHECKING([if ][$2][ version is matching requirement ][$3])
if "${_tmp}"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Version requirement ][$2][ ][$3][ not met. Found: ${_][$1][_VERSION}
])
else
AC_MSG_RESULT([yes])
fi

---

Discussion

  • Marcus Meissner

    Marcus Meissner - 2007-08-02
    • assigned_to: nobody --> hun
     
  • Marcus Meissner

    Marcus Meissner - 2007-08-02

    Logged In: YES
    user_id=48092
    Originator: NO

    over to our m4 / autconf guru

     
  • Hans Ulrich Niedermann

    • summary: odd problem with gphoto calling --> library version check logic buggy
     
  • Hans Ulrich Niedermann

    • labels: 730308 --> build system
     

Log in to post a comment.