Subject: pkg/11182: gtk-- doesn't build on -current (prevents gnome from building)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jchacon@gtei.net>
List: netbsd-bugs
Date: 10/09/2000 21:01:27
>Number:         11182
>Category:       pkg
>Synopsis:       Building gnome requires gtk--. This no longer builds under
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 09 21:01:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     James Chacon
>Release:        -current as of 10/08/00
>Organization:
>Environment:
System: NetBSD wyrm 1.5G NetBSD 1.5G (WYRM) #5: Mon Oct 9 01:16:57 UTC 2000 root@wyrm:/usr/src/sys/arch/i386/compile/WYRM i386


>Description:

When gtk-- configures it attempts to locate a proper version of libsigc++
on the system. Then it uses a bizzare set of expr expressions to compare
version numbers and decide if everything matches.

This appears to have always worked simply due to the old expr silently
truncating after 3 arguments. Since it appears we've always used a proper
libsigc++ in the tree the first test never failed then. The new and improved
expr (based on an actual grammer) parses this expression fully (compile
expr with YYDEBUG and watch) but won't evaluate it completely.

It's not clear if expr is designed to recurse into expressions or not and
in any case it appears the operator order would prevent this from working
anyways as designed here.

The patch below fixes this by running the expr's as separate shell instances
and letting $? determine the final case. Since the shell does lazy evaluation
$? will always equal the right conditions based on the state of the last expr
to have run. This appears to be the most portable method.

I'll leave it up to the person committing this but our expr will handle this
provided you properly force operator precedance. I've included
a 2nd patch below for this but it's getting kinda ugly by this point....
(again I'm also not sure if this is POSIX.2 compliant for expr or just a side
effect from the newly rewritten expr. The man pages aren't clear what an
expression means).

Both of these patches were tested against all cases the version could pass/fail
and they work correctly. Also, both just patch configure and configure.in
but patching the other should be simple to geno.

>How-To-Repeat:

Try to build gnome (or gtk-- by itself) under -current. It will fail on
detecting libsigc++
>Fix:

Apply the patch below to use subshells (and probably the most portable):


--- configure.orig	Tue Oct 10 00:55:40 2000
+++ configure	Tue Oct 10 02:32:35 2000
@@ -2735,14 +2734,14 @@
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
 
     sigc_version_proper=`expr \
-        $sigc_major_version \> $sigc_major_min \| \
-        $sigc_major_version \= $sigc_major_min \& \
-        $sigc_minor_version \> $sigc_minor_min \| \
-        $sigc_major_version \= $sigc_major_min \& \
-        $sigc_minor_version \= $sigc_minor_min \& \
-        $sigc_micro_version \>= $sigc_micro_min `
+        $sigc_major_version \> $sigc_major_min > /dev/null || \
+        (expr $sigc_major_version \= $sigc_major_min > /dev/null && \
+        expr $sigc_minor_version \> $sigc_minor_min) > /dev/null || \
+        (expr $sigc_major_version \= $sigc_major_min > /dev/null && \
+        expr $sigc_minor_version \= $sigc_minor_min > /dev/null && \
+        expr $sigc_micro_version \>= $sigc_micro_min> /dev/null ); echo $? `
 
-    if test "$sigc_version_proper" = "1" ; then
+    if test "$sigc_version_proper" = "0" ; then
       echo "$ac_t""$sigc_major_version.$sigc_minor_version.$sigc_micro_version" 1>&6
     else
       echo "$ac_t""no" 1>&6


--
A version rewriting the expr expression with groupings:


--- configure.orig	Tue Oct 10 03:51:22 2000
+++ configure	Tue Oct 10 03:54:39 2000
@@ -2736,12 +2736,12 @@
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
 
     sigc_version_proper=`expr \
-        $sigc_major_version \> $sigc_major_min \| \
-        $sigc_major_version \= $sigc_major_min \& \
-        $sigc_minor_version \> $sigc_minor_min \| \
-        $sigc_major_version \= $sigc_major_min \& \
-        $sigc_minor_version \= $sigc_minor_min \& \
-        $sigc_micro_version \>= $sigc_micro_min `
+           \( $sigc_major_version \> $sigc_major_min \)    \| \
+        \( \( $sigc_major_version \= $sigc_major_min \) \& \
+           \( $sigc_minor_version \> $sigc_minor_min \) \) \| \
+        \( \( $sigc_major_version \= $sigc_major_min \) \& \
+           \( $sigc_minor_version \= $sigc_minor_min \) \& \
+           \( $sigc_micro_version \>= $sigc_micro_min \) \)`
 
     if test "$sigc_version_proper" = "1" ; then
       echo "$ac_t""$sigc_major_version.$sigc_minor_version.$sigc_micro_version" 1>&6
>Release-Note:
>Audit-Trail:
>Unformatted:
 -current due to a presumption in configure as to how expr works.