Bad error output from gnome-config



In Gnome 1.2, one can use gnome-config to find out the version of
modules installed, for example:

    gnome-config --modversion applets
        (RESULT = applets-1.4.0.4)
    gnome-config --modversion gnomemm
        (RESULT = gnomemm-1.2.0)

And to get the version of gnome-libs itself, one uses

    gnome-config --version
        (RESULT = gnome-libs-1.2.13)

This is all well and good. The output has a consistent format. So, in my
configure.in for several projects I have, I parse the output of the
above commands to check for library dependencies.

Now, here's my beef:
If suppose I do

    gnome-config --modversion somemodule

and somemodule does not exist, I get a RESULT =

    Unknown library `somemodule'
    gnome-libs-1.2.13

Which is very inconsistent output. The command is requesting the version
of a module, and it is getting the version of gnome-libs. Granted, it is
printing an error message, but the extra info after that is completely
useless, and makes parsing the output difficult.

In addition, it exits with exit status 0 instead of 1 to indicate an
error.

I propose that gnome-config, in the above situation, just print the
error message and exit. I've attached a patch for gnome-config.in (I
used "cvs diff -u", is that correct?)

    = Loban

? patch
Index: gnome-config.in
===================================================================
RCS file: /cvs/gnome/gnome-libs/gnome-config.in,v
retrieving revision 1.29
diff -u -r1.29 gnome-config.in
--- gnome-config.in	2000/11/12 14:39:25	1.29
+++ gnome-config.in	2001/07/26 20:39:44
@@ -18,7 +18,7 @@
 pkgdatadir=${datadir}/@PACKAGE@
 pkglibdir=${libdir}/@PACKAGE@
 pkgincludedir=${includedir}/@PACKAGE@
-MODULE_VERSION= PACKAGE@- VERSION@
+MODULE_VERSION=""
 
 interface_version_installed() {
     error=true
@@ -371,6 +371,10 @@
 fi
 
 if $modversion; then
+    if test -n "$MODULE_VERSION"; then
+	exit 1
+    fi
+
     echo $MODULE_VERSION
     exit 0
 fi


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