bug-gnulib
[Top][All Lists]
Advanced

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

Re: bootstrap check_exists() causes misleading diagnostics on OpenBSD


From: Ingo Schwarze
Subject: Re: bootstrap check_exists() causes misleading diagnostics on OpenBSD
Date: Thu, 23 Oct 2014 16:07:19 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Pádraig,

thank you for looking into this quirk.
Your patch looks reasonable and works for me.
For one minor suggestion, see below.


Pádraig Brady wrote on Thu, Oct 23, 2014 at 02:06:13PM +0100:
> On 10/18/2014 05:58 PM, Ingo Schwarze wrote:

>> On OpenBSD, the usual way to install the autotools is as follows:
[...]
>>  $ autoconf; echo $?
>> Provide an AUTOCONF_VERSION environment variable, please
>> 127
>>  $ export AUTOCONF_VERSION=2.65
>>  $ autoconf --version | head -n1; echo $?
>> autoconf (GNU Autoconf) 2.65
>> 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
[...]

> This should be address by the attached patch.

On OpenBSD, in the GNU troff repository on the automake3 branch,
i end up with the following diagnostics:

   $ ./bootstrap                                                 
  Provide an AUTOCONF_VERSION environment variable, please
  ./bootstrap: Error: 'autoconf' not found
  Provide an AUTOMAKE_VERSION environment variable, please
  ./bootstrap: Error: 'automake' not found
  tar: unknown option -- -
  usage: tar {crtux}[014578befHhjLmNOoPpqsvwXZz]
             [blocking-factor | archive | replstr] [-C directory] [-I file]
             [file ...]
         tar {-crtux} [-014578eHhjLmNOoPpqvwXZz] [-b blocking-factor]
             [-C directory] [-f archive] [-I file] [-s replstr] [file ...]
  
  ./bootstrap: Please install the prerequisite programs

This is the reason:

   $ uname -a
  OpenBSD isnote.usta.de 5.6 GENERIC.MP#5 i386
   $ which tar
  /bin/tar
   $ tar --version
  tar: unknown option -- -
  usage: tar {crtux}[014578befHhjLmNOoPpqsvwXZz]
             [blocking-factor | archive | replstr] [-C directory] [-I file]
             [file ...]
         tar {-crtux} [-014578eHhjLmNOoPpqvwXZz] [-b blocking-factor]
             [-C directory] [-f archive] [-I file] [-s replstr] [file ...]
   $ echo $?
  1

In BSD land, it is unusual to version individual utilities.
The operating system is regarded as one indivisible unit
and only versioned as a whole.

The tweaked version of your patch given below avoids such needless
complaints; it should also help with other utilities that don't
support the non-POSIX --version option or require other arguments
not given here.

Thank you,
  Ingo


diff --git a/bootstrap b/bootstrap
index ce90bc4..afaed4f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -210,7 +210,15 @@ 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
+    if test $? -ge 126; then
+      ($2 --version </dev/null)
+    fi
+  else
+    ($1 --version </dev/null) >/dev/null 2>&1
+  fi
+
   test $? -lt 126
 }
 
@@ -408,7 +416,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 +475,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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]