Hello community,

here is the log from the commit of package apache2-mod_authn_otp for 
openSUSE:Factory checked in at 2014-06-01 19:40:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/apache2-mod_authn_otp (Old)
 and      /work/SRC/openSUSE:Factory/.apache2-mod_authn_otp.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "apache2-mod_authn_otp"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/apache2-mod_authn_otp/apache2-mod_authn_otp.changes  
    2014-03-23 21:07:56.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.apache2-mod_authn_otp.new/apache2-mod_authn_otp.changes
 2014-06-01 19:40:46.000000000 +0200
@@ -1,0 +2,14 @@
+Wed May 28 08:59:41 UTC 2014 - [email protected]
+
+- Fix source download url.
+
+-------------------------------------------------------------------
+Sat May 17 16:41:52 UTC 2014 - [email protected]
+
+- Update to version 1.1.7
+  + Fixed bug where users file could get deleted when using Apache worker MPM 
(issue #22)
+  + Added "OTPAuthFallThrough" to allow fall through to other auth providers 
(issue #23)
+  + Allow "logout" by sending empty password (issue #24)
+  + Count PINs against OTPAuthMaxOTPFailure even when they have the wrong 
length
+
+-------------------------------------------------------------------

Old:
----
  mod_authn_otp-1.1.6.tar.gz

New:
----
  mod_authn_otp-1.1.7.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ apache2-mod_authn_otp.spec ++++++
--- /var/tmp/diff_new_pack.njlZAB/_old  2014-06-01 19:40:47.000000000 +0200
+++ /var/tmp/diff_new_pack.njlZAB/_new  2014-06-01 19:40:47.000000000 +0200
@@ -1,6 +1,7 @@
 #
 # spec file for package apache2-mod_authn_otp
 #
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
 # Copyright (c) 2012 Archie L. Cobbs <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
@@ -11,25 +12,27 @@
 # case the license is the MIT License). An "Open Source License" is a
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
-#
+
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
 %define mod_name           mod_authn_otp
 %define apxs               /usr/sbin/apxs2
 %define apache_libexecdir  %(%{apxs} -q LIBEXECDIR)
 
 Name:           apache2-%{mod_name}
-Version:        1.1.6
+Version:        1.1.7
 Release:        0
-License:        Apache-2.0
 Summary:        Apache module for one-time password authentication
+License:        Apache-2.0
 Group:          Productivity/Networking/Web/Servers
-Source:         
http://mod-authn-otp.googlecode.com/files/%{mod_name}-%{version}.tar.gz
-URL:            http://mod-authn-otp.googlecode.com/
-BuildRoot:      %{_tmppath}/%{name}-%{version}-root
+Source:         
https://s3.amazonaws.com/archie-public/mod-authn-otp/%{mod_name}-%{version}.tar.gz
+Url:            http://mod-authn-otp.googlecode.com/
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %if 0%{?suse_version} >= 1100
-BuildRequires: libopenssl-devel openssl
+BuildRequires:  libopenssl-devel
+BuildRequires:  openssl
 %else
 BuildRequires:  openssl-devel
 %endif

++++++ mod_authn_otp-1.1.6.tar.gz -> mod_authn_otp-1.1.7.tar.gz ++++++
++++ 2700 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/mod_authn_otp-1.1.6/CHANGES new/mod_authn_otp-1.1.7/CHANGES
--- old/mod_authn_otp-1.1.6/CHANGES     2013-04-03 04:10:05.000000000 +0200
+++ new/mod_authn_otp-1.1.7/CHANGES     2014-05-17 18:26:14.000000000 +0200
@@ -1,3 +1,11 @@
+
+Version 1.1.7 (r147) released 17 May 2014
+
+    - Fixed bug where users file could get deleted when using Apache worker 
MPM (issue #22)
+    - Added "OTPAuthFallThrough" to allow fall through to other auth providers 
(issue #23)
+    - Allow "logout" by sending empty password (issue #24)
+    - Count PINs against OTPAuthMaxOTPFailure even when they have the wrong 
length
+
 Version 1.1.6 (r131) released 2 Apr 2013
 
     - Detect errors when writing to the new users.txt file
@@ -40,4 +48,4 @@
 
     - Initial release
 
-$Id: CHANGES 131 2013-04-03 02:10:00Z archie.cobbs $
+$Id: CHANGES 147 2014-05-17 16:26:13Z archie.cobbs $
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/mod_authn_otp-1.1.6/configure.ac new/mod_authn_otp-1.1.7/configure.ac
--- old/mod_authn_otp-1.1.6/configure.ac        2013-04-03 03:56:40.000000000 
+0200
+++ new/mod_authn_otp-1.1.7/configure.ac        2013-11-18 20:36:24.000000000 
+0100
@@ -19,7 +19,7 @@
 # $Id$
 #
 
-AC_INIT([mod_authn_otp Apache2 authentication module supporting one-time 
passwords], [1.1.6], [http://mod-auth-otp.googlecode.com/], [mod_authn_otp])
+AC_INIT([mod_authn_otp Apache2 authentication module supporting one-time 
passwords], [1.1.7], [http://mod-auth-otp.googlecode.com/], [mod_authn_otp])
 AC_CONFIG_AUX_DIR(scripts)
 AM_INIT_AUTOMAKE
 dnl AM_MAINTAINER_MODE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/mod_authn_otp-1.1.6/mod_authn_otp.c new/mod_authn_otp-1.1.7/mod_authn_otp.c
--- old/mod_authn_otp-1.1.6/mod_authn_otp.c     2012-12-21 23:59:59.000000000 
+0100
+++ new/mod_authn_otp-1.1.7/mod_authn_otp.c     2014-04-28 23:55:54.000000000 
+0200
@@ -16,7 +16,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- * $Id: mod_authn_otp.c 129 2012-12-21 22:59:54Z archie.cobbs $
+ * $Id: mod_authn_otp.c 146 2014-04-28 21:55:52Z archie.cobbs $
  */
 
 #include "apr_lib.h"
@@ -90,6 +90,7 @@
 #define DEFAULT_MAX_OFFSET              4
 #define DEFAULT_MAX_LINGER              (10 * 60)   /* 10 minutes */
 #define DEFAULT_LOGOUT_IP_CHANGE        0
+#define DEFAULT_ALLOW_FALLTHROUGH       0
 
 /* PIN configuration */
 #define PIN_CONFIG_LITERAL              0
@@ -117,6 +118,7 @@
     int                 max_linger;             /* Maximum time for which the 
same OTP can be used repeatedly */
     u_int               max_otp_failures;       /* Maximum wrong OTP values 
before account becomes locked, or zero for no limit */
     int                 logout_ip_change;       /* Auto-logout user if IP 
address changes */
+    int                 allow_fallthrough;      /* Allow fall-through if OTP 
auth fails */
     authn_provider_list *provlist;              /* Authorization providers for 
checking PINs */
 };
 
@@ -158,13 +160,16 @@
 /* Powers of ten */
 static const int    powers10[] = { 10, 100, 1000, 10000, 100000, 1000000, 
10000000, 100000000, 1000000000, 1000000000 };
 
+/* Mutex to augment file locking for multi-threaded processes */
+static apr_thread_mutex_t *mutex;
+
 /*
  * Find/update a user in the users file.
  *
  * Note: finding, the "user" structure must be initialized with zeroes.
  */
 static authn_status
-find_update_user(request_rec *r, const char *usersfile, struct otp_user *const 
user, int update)
+find_update_user(request_rec *r, const char *usersfile, struct otp_user *const 
user, const int update)
 {
     char invalid_reason[128];
     char newusersfile[APR_PATH_MAX];
@@ -174,11 +179,12 @@
     apr_file_t *newfile = NULL;
     apr_file_t *lockfile = NULL;
     apr_status_t status;
+    int got_mutex = 0;
     char errbuf[64];
     int found = 0;
     int linenum;
 
-    /* If updating, open and lock lockfile */
+    /* If updating, open and lock lockfile and grab mutex */
     if (update) {
         apr_snprintf(lockusersfile, sizeof(lockusersfile), "%s%s", usersfile, 
LOCKFILE_SUFFIX);
         if ((status = apr_file_open(&lockfile, lockusersfile,
@@ -192,6 +198,15 @@
               lockusersfile, apr_strerror(status, errbuf, sizeof(errbuf)));
             goto fail;
         }
+        if (mutex == NULL) {
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "can't acquire OTP 
mutex: %s", "no mutex exists");
+            goto fail;
+        }
+        if ((status = apr_thread_mutex_lock(mutex)) != 0) {
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "can't acquire OTP 
mutex: %s", apr_strerror(status, errbuf, sizeof(errbuf)));
+            goto fail;
+        }
+        got_mutex = 1;
     }
 
     /* Open existing users file */
@@ -375,6 +390,7 @@
         AP_DEBUG_ASSERT(!update);
         AP_DEBUG_ASSERT(newfile == NULL);
         AP_DEBUG_ASSERT(lockfile == NULL);
+        AP_DEBUG_ASSERT(!got_mutex);
         apr_file_close(file);
         return AUTH_USER_FOUND;
 
@@ -416,9 +432,11 @@
         goto fail;
     }
 
-    /* Close (and implicitly unlock) lock file */
+    /* Close (and implicitly unlock) lock file and release mutex */
     apr_file_close(lockfile);
     lockfile = NULL;
+    AP_DEBUG_ASSERT(got_mutex);
+    apr_thread_mutex_unlock(mutex);
 
     /* Done updating */
     return found ? AUTH_USER_FOUND : AUTH_USER_NOT_FOUND;
@@ -436,6 +454,8 @@
     }
     if (lockfile != NULL)
         apr_file_close(lockfile);
+    if (got_mutex)
+        apr_thread_mutex_unlock(mutex);
     return AUTH_GENERAL_ERROR;
 }
 
@@ -689,11 +709,13 @@
           username, pentry->provider_name);
         break;
     case AUTH_DENIED:
-        ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "user \"%s\" gave 
incorrect PIN according to PIN auth provider \"%s\"",
+        ap_log_rerror(APLOG_MARK, conf->allow_fallthrough ? APLOG_INFO : 
APLOG_NOTICE, 0, r,
+          "user \"%s\" gave incorrect PIN according to PIN auth provider 
\"%s\"",
           username, pentry->provider_name);
         break;
     case AUTH_USER_NOT_FOUND:
-        ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "user \"%s\" is not 
known by any configured PIN auth provider", username);
+        ap_log_rerror(APLOG_MARK, conf->allow_fallthrough ? APLOG_INFO : 
APLOG_NOTICE, 0, r,
+          "user \"%s\" is not known by any configured PIN auth provider", 
username);
         break;
     case AUTH_GENERAL_ERROR:                        /* assume the auth 
provider logged something interesting */
         break;
@@ -719,7 +741,7 @@
     switch (user->pincfg) {
     case PIN_CONFIG_NONE:                               /* User has no PIN, so 
provided PIN must be the empty string */
         if (*pin != '\0') {
-            ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
+            ap_log_rerror(APLOG_MARK, conf->allow_fallthrough ? APLOG_INFO : 
APLOG_NOTICE, 0, r,
               "user \"%s\" supplied a PIN but none is configured in the users 
file", user->username);
             return AUTH_DENIED;
         }
@@ -728,7 +750,8 @@
         return authn_otp_check_pin_external(r, conf, user->username, pin);
     case PIN_CONFIG_LITERAL:                            /* User's PIN was 
given explicitly in the users file */
         if (strcmp(pin, user->pin) != 0) {
-            ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "user \"%s\" PIN 
does not match value in users file", user->username);
+            ap_log_rerror(APLOG_MARK, conf->allow_fallthrough ? APLOG_INFO : 
APLOG_NOTICE, 0, r,
+              "user \"%s\" PIN does not match value in users file", 
user->username);
             return AUTH_DENIED;
         }
         return AUTH_GRANTED;
@@ -772,7 +795,17 @@
     if (conf->max_otp_failures != 0 && user->num_otp_failures >= 
conf->max_otp_failures) {
         ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "user \"%s\" has reached 
the maximum wrong OTP limit of %u",
           user->username, conf->max_otp_failures);
-        return AUTH_DENIED;
+        return conf->allow_fallthrough ? AUTH_USER_NOT_FOUND : AUTH_DENIED;
+    }
+
+    /* Check for a "logout" via empty password */
+    if (*otp_given == '\0' && *user->last_otp != '\0' && *user->last_ip != 
'\0' && strcmp(user->last_ip, USER_AGENT_IP(r)) == 0) {
+        ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "logout for user \"%s\" 
via empty password", user->username);
+
+        /* Forget previous OTP */
+        *user->last_otp = '\0';
+        find_update_user(r, conf->users_file, user, 1);
+        return conf->allow_fallthrough ? AUTH_USER_NOT_FOUND : AUTH_DENIED;
     }
 
     /* Check PIN prefix (if appropriate) */
@@ -783,8 +816,8 @@
         /* Determine the length of the PIN that the user supplied */
         pinlen = strlen(otp_given) - user->num_digits;
         if (pinlen < 0) {
-            ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "user \"%s\" 
provided a too-short OTP", user->username);
-            return AUTH_DENIED;
+            ap_log_rerror(APLOG_MARK, conf->allow_fallthrough ? APLOG_INFO : 
APLOG_NOTICE, 0, r, "user \"%s\" provided a too-short OTP", user->username);
+            return conf->allow_fallthrough ? AUTH_USER_NOT_FOUND : AUTH_DENIED;
         }
 
         /* Extract the PIN from the password given */
@@ -792,15 +825,18 @@
         otp_given += pinlen;
 
         /* Check the PIN */
-        if ((status = authn_otp_check_pin(r, conf, user, pinbuf)) != 
AUTH_GRANTED)
+        if ((status = authn_otp_check_pin(r, conf, user, pinbuf)) != 
AUTH_GRANTED) {
+            if (status == AUTH_DENIED && conf->allow_fallthrough)
+                status = AUTH_USER_NOT_FOUND;
             return status;
+        }
     }
 
     /* Check OTP length */
     if (strlen(otp_given) != user->num_digits) {
-        ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "user \"%s\" OTP has the 
wrong length %d != %d",
+        ap_log_rerror(APLOG_MARK, conf->allow_fallthrough ? APLOG_INFO : 
APLOG_NOTICE, 0, r, "user \"%s\" OTP has the wrong length %d != %d",
           user->username, (int)strlen(otp_given), user->num_digits);
-        return AUTH_DENIED;
+        return conf->allow_fallthrough ? AUTH_USER_NOT_FOUND : AUTH_DENIED;
     }
 
     /* Check for reuse of previous OTP */
@@ -936,7 +972,7 @@
     if (conf->max_otp_failures != 0 && user->num_otp_failures >= 
conf->max_otp_failures) {
         ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "user \"%s\" has reached 
the maximum wrong OTP limit of %u",
           user->username, conf->max_otp_failures);
-        return AUTH_DENIED;
+        return conf->allow_fallthrough ? AUTH_USER_NOT_FOUND : AUTH_DENIED;
     }
 
     /* The user's PIN must be known to us */
@@ -1028,6 +1064,7 @@
     conf->max_linger = dir_conf->max_linger;
     conf->max_otp_failures = dir_conf->max_otp_failures;
     conf->logout_ip_change = dir_conf->logout_ip_change;
+    conf->allow_fallthrough = dir_conf->allow_fallthrough;
     copy_provider_list(r->pool, &conf->provlist, dir_conf->provlist);
 
     /* Apply defaults for any unset values */
@@ -1037,6 +1074,8 @@
         conf->max_linger = DEFAULT_MAX_LINGER;
     if (conf->logout_ip_change == -1)
         conf->logout_ip_change = DEFAULT_LOGOUT_IP_CHANGE;
+    if (conf->allow_fallthrough == -1)
+        conf->allow_fallthrough = DEFAULT_ALLOW_FALLTHROUGH;
 
     /* Done */
     return conf;
@@ -1055,6 +1094,7 @@
     conf->max_linger = -1;
     conf->max_otp_failures = 0;
     conf->logout_ip_change = -1;
+    conf->allow_fallthrough = -1;
     conf->provlist = NULL;
     return conf;
 }
@@ -1074,6 +1114,7 @@
     conf->max_linger = conf2->max_linger != -1 ? conf2->max_linger : 
conf1->max_linger;
     conf->max_otp_failures = conf2->max_otp_failures != 0 ? 
conf2->max_otp_failures : conf1->max_otp_failures;
     conf->logout_ip_change = conf2->logout_ip_change != -1 ? 
conf2->logout_ip_change : conf1->logout_ip_change;
+    conf->allow_fallthrough = conf2->allow_fallthrough != -1 ? 
conf2->allow_fallthrough : conf1->allow_fallthrough;
     copy_provider_list(p, &conf->provlist, conf2->provlist != NULL ? 
conf2->provlist : conf1->provlist);
     return conf;
 }
@@ -1143,6 +1184,14 @@
 register_hooks(apr_pool_t *p)
 {
     ap_register_provider(p, AUTHN_PROVIDER_GROUP, OTP_AUTHN_PROVIDER_NAME, 
AUTHN_PROVIDER_VERSION, &authn_otp_provider);
+    apr_status_t status;
+    char errbuf[64];
+
+    /* Initialize mutex */
+    if (mutex == NULL && (status = apr_thread_mutex_create(&mutex, 
APR_THREAD_MUTEX_DEFAULT, p)) != 0) {
+        ap_log_perror(APLOG_MARK, APLOG_ERR, 0, p, "can't create OTP mutex: 
%s", apr_strerror(status, errbuf, sizeof(errbuf)));
+        return;
+    }
 }
 
 /* Configuration directives */
@@ -1178,6 +1227,11 @@
         NULL,
         OR_AUTHCFG,
         "specify auth provider(s) to be used for PIN verification for a 
directory or location"),
+    AP_INIT_FLAG("OTPAuthFallThrough",
+        ap_set_flag_slot,
+        (void *)APR_OFFSETOF(struct otp_config, allow_fallthrough),
+        OR_AUTHCFG,
+        "allow failed auth attempts to fall through to the next auth provider 
(if any)"),
     { NULL }
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/mod_authn_otp-1.1.6/scripts/missing new/mod_authn_otp-1.1.7/scripts/missing
--- old/mod_authn_otp-1.1.6/scripts/missing     2013-04-03 04:10:32.000000000 
+0200
+++ new/mod_authn_otp-1.1.7/scripts/missing     2014-05-17 18:29:27.000000000 
+0200
@@ -1,10 +1,10 @@
 #! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2012-01-06.18; # UTC
+scriptversion=2012-06-26.16; # UTC
 
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <[email protected]>, 1996.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <[email protected]>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,61 +29,33 @@
   exit 1
 fi
 
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, 'missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
+case $1 in
 
-msg="missing on your system"
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
 
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
 
   -h|--h|--he|--hel|--help)
     echo "\
 $0 [OPTION]... PROGRAM [ARGUMENT]...
 
-Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
 
 Options:
   -h, --help      display this help and exit
   -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
 
 Supported PROGRAM values:
-  aclocal      touch file 'aclocal.m4'
-  autoconf     touch file 'configure'
-  autoheader   touch file 'config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all 'Makefile.in' files
-  bison        create 'y.tab.[ch]', if possible, from existing .[ch]
-  flex         create 'lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create 'lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  yacc         create 'y.tab.[ch]', if possible, from existing .[ch]
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
 
 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
 'g' are ignored when checking the name.
@@ -98,228 +70,141 @@
     ;;
 
   -*)
-    echo 1>&2 "$0: Unknown '$1' option"
+    echo 1>&2 "$0: unknown '$1' option"
     echo 1>&2 "Try '$0 --help' for more information"
     exit 1
     ;;
 
 esac
 
-# normalize program name to check for.
-program=`echo "$1" | sed '
-  s/^gnu-//; t
-  s/^gnu//; t
-  s/^g//; t'`
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).  This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
-  lex*|yacc*)
-    # Not GNU programs, they don't have --version.
-    ;;
+# Run the given program, remember its exit status.
+"$@"; st=$?
 
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running '$TOOL --version' or '$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified 'acinclude.m4' or '${configure_ac}'.  You might want
-         to install the Automake and Perl packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified '${configure_ac}'.  You might want to install the
-         Autoconf and GNU m4 packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified 'acconfig.h' or '${configure_ac}'.  You might want
-         to install the Autoconf and GNU m4 packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' 
${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
 
-  automake*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
-         You might want to install the Automake and Perl packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-          sed 's/\.am$/.in/' |
-          while read f; do touch "$f"; done
-    ;;
-
-  autom4te*)
-    echo 1>&2 "\
-WARNING: '$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get '$1' as part of Autoconf from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-       touch $file
-    else
-       test -z "$file" || exec >$file
-       echo "#! /bin/sh"
-       echo "# Created by GNU Automake missing as a replacement of"
-       echo "#  $ $@"
-       echo "exit 0"
-       chmod +x $file
-       exit 1
-    fi
-    ;;
-
-  bison*|yacc*)
-    echo 1>&2 "\
-WARNING: '$1' $msg.  You should only need it if
-         you modified a '.y' file.  You may need the Bison package
-         in order for those modifications to take effect.  You can get
-         Bison from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG=\${$#}
-       case $LASTARG in
-       *.y)
-           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-           if test -f "$SRCFILE"; then
-                cp "$SRCFILE" y.tab.c
-           fi
-           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-           if test -f "$SRCFILE"; then
-                cp "$SRCFILE" y.tab.h
-           fi
-         ;;
-       esac
-    fi
-    if test ! -f y.tab.h; then
-       echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-       echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex*|flex*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified a '.l' file.  You may need the Flex package
-         in order for those modifications to take effect.  You can get
-         Flex from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG=\${$#}
-       case $LASTARG in
-       *.l)
-           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-           if test -f "$SRCFILE"; then
-                cp "$SRCFILE" lex.yy.c
-           fi
-         ;;
-       esac
-    fi
-    if test ! -f lex.yy.c; then
-       echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-        you modified a dependency of a manual page.  You may need the
-        Help2man package in order for those modifications to take
-        effect.  You can get Help2man from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-       touch $file
-    else
-       test -z "$file" || exec >$file
-       echo ".ab help2man is required to generate this page"
-       exit $?
-    fi
-    ;;
-
-  makeinfo*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified a '.texi' or '.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy 'make' (AIX,
-         DU, IRIX).  You might want to install the Texinfo package or
-         the GNU make package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-       /^@setfilename/{
-         s/.* \([^ ]*\) *$/\1/
-         p
-         q
-       }' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: '$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the 'README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing '$1' program."
-    exit 1
-    ;;
-esac
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
 
-exit 0
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'automa4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
+    ;;
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to