On 10/18/2014 05:58 PM, Ingo Schwarze wrote:
> Hi,
> 
> this is maybe not a full-grown bug, more like a quirk, but is is
> sure bound to cause confusion, so i'd like to hear what you think...
> 
> I'm the maintainer of the OpenBSD port of groff (GNU troff),
> and Bertrand (see Cc:) is currently migrating the groff build
> system to automake and gnulib.  He uses the bootstrap script,
> among many other parts of the gnulib toolkit.
> 
> On OpenBSD, the usual way to install the autotools is as follows:
> 
>  $ uname -a
> OpenBSD isnote.usta.de 5.6 GENERIC.MP#338 i386
>  $ pkg_info | grep -e autoconf -e automake
> autoconf-2.13p3     automatically configure source code on many Un*x platforms
> autoconf-2.59p4     automatically configure source code on many Un*x platforms
> autoconf-2.61p4     automatically configure source code on many Un*x platforms
> autoconf-2.62p1     automatically configure source code on many Un*x platforms
> autoconf-2.63p0     automatically configure source code on many Un*x platforms
> autoconf-2.65p0     automatically configure source code on many Un*x platforms
> autoconf-2.67p0     automatically configure source code on many Un*x platforms
> autoconf-2.68p0     automatically configure source code on many Un*x platforms
> autoconf-2.69p1     automatically configure source code on many Un*x platforms
> automake-1.11.6p1   GNU Standards-compliant Makefile generator
> automake-1.12.6p0   GNU Standards-compliant Makefile generator
> automake-1.14.1     GNU Standards-compliant Makefile generator
> automake-1.9.6p11   GNU Standards-compliant Makefile generator
>  $ ls /usr/local/bin/auto{conf,make}*
> /usr/local/bin/autoconf                 /usr/local/bin/autoconf-2.68
> /usr/local/bin/autoconf-2.13            /usr/local/bin/autoconf-2.69
> /usr/local/bin/autoconf-2.59            /usr/local/bin/automake
> /usr/local/bin/autoconf-2.61            /usr/local/bin/automake-1.11
> /usr/local/bin/autoconf-2.62            /usr/local/bin/automake-1.12
> /usr/local/bin/autoconf-2.63            /usr/local/bin/automake-1.14
> /usr/local/bin/autoconf-2.65            /usr/local/bin/automake-1.9
> /usr/local/bin/autoconf-2.67
>  $ which autoconf automake
> /usr/local/bin/autoconf
> /usr/local/bin/automake
>  $ autoconf; echo $?
> Provide an AUTOCONF_VERSION environment variable, please
> 127
>  $ automake; echo $? 
> Provide an AUTOMAKE_VERSION environment variable, please
> 127
>  $ export AUTOCONF_VERSION=2.65
>  $ export AUTOMAKE_VERSION=1.12 
>  $ autoconf --version | head -n1; echo $?
> autoconf (GNU Autoconf) 2.65
> 0
> ischwarze@isnote $ automake --version | head -n1; echo $? 
> automake (GNU automake) 1.12.6
> 0
> 
> Now, if you forget to set these variables before running ./bootstrap,
> bootstrap check_exists() redirects the helpful error messages to
> /dev/null and shows bogus diagnostics instead:
> 
>   Error: 'autoconf' not found
> 
> Do you see any way of not hiding the real diagnostics from the
> poor user?
> 
> Thanks for your work on gnulib and for your consideration,
>   Ingo
> 
> 
> Werner LEMBERG wrote on Mon, Sep 22, 2014 at 11:20:31PM +0200:
> 
>>> So this code in ./bootstrap is suboptimal:
>>>
>>>   check_exists() {
>>>     ($1 --version </dev/null) >/dev/null 2>&1
>>>
>>> That deliberately hides the error message from the user and displays
>>> a bogus message instead, so you might wish to refrain from hiding
>>> stderr.
> 
>> ... given that `bootstrap' is a ready-to-run script from `gnulib',
>> this should probably discussed with the gnulib people.

This should be address by the attached patch.

thanks,
Pádraig.
>From 98a50856d90ffaba812de4b538939ed2dccdfeed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Thu, 23 Oct 2014 13:59:08 +0100
Subject: [PATCH] bootstrap: print more diagnostics for missing programs

* build-aux/bootstrap: only suppress stderr when checking for
alternative program names.  This supports programs issuing non
standard error messages like:
  "Provide an AUTOMAKE_VERSION environment variable, please"
Reported by Ingo Schwarze with OpenBSD
---
 ChangeLog           |    7 +++++++
 build-aux/bootstrap |   12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b98a79..b03b571 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2014-10-23  Pádraig Brady  <p...@draigbrady.com>
 
+	bootstrap: print more diagnostics for missing programs
+	* build-aux/bootstrap: only suppress stderr when checking for
+	alternative program names.  This supports programs issuing non
+	standard error messages.
+
+2014-10-23  Pádraig Brady  <p...@draigbrady.com>
+
 	bootstrap: only update the gnulib submodule
 	* build-aux/bootstrap: Restrict the "submodule update" command
 	to the gnulib path.
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 5dbd1b1..eec77be 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -210,7 +210,13 @@ bootstrap_sync=false
 use_git=true
 
 check_exists() {
-  ($1 --version </dev/null) >/dev/null 2>&1
+  if test "$1" = "--verbose"; then
+    ($2 --version </dev/null) >/dev/null 2>&1 ||
+    ($2 --version </dev/null)
+  else
+    ($1 --version </dev/null) >/dev/null 2>&1
+  fi
+
   test $? -lt 126
 }
 
@@ -408,7 +414,7 @@ sort_ver() { # sort -V is not generally available
 get_version() {
   app=$1
 
-  $app --version >/dev/null 2>&1 || return 1
+  $app --version >/dev/null 2>&1 || { $app --version; return 1; }
 
   $app --version 2>&1 |
   sed -n '# Move version to start of line.
@@ -467,7 +473,7 @@ check_versions() {
     if [ "$req_ver" = "-" ]; then
       # Merely require app to exist; not all prereq apps are well-behaved
       # so we have to rely on $? rather than get_version.
-      if ! check_exists $app; then
+      if ! check_exists --verbose $app; then
         warn_ "Error: '$app' not found"
         ret=1
       fi
-- 
1.7.7.6

Reply via email to