[krbdev.mit.edu #8979] Portability bug in aclocal.m4

Brook Milligan via RT rt-comment at krbdev.mit.edu
Tue Jan 19 00:18:47 EST 2021


Tue Jan 19 00:18:47 2021: Request 8979 was acted upon.
 Transaction: Ticket created by brook at nmsu.edu
       Queue: krb5
     Subject: Portability bug in aclocal.m4
       Owner: Nobody
  Requestors: brook at nmsu.edu
      Status: new
 Ticket <URL: https://krbdev.mit.edu/rt/Ticket/Display.html?id=8979 >


Empty bodies in shell conditionals are not portable.  Some shells allow them; others do not.  POSIX does not allow them other than as an extension.  As a consequence, including empty conditional bodies in configure scripts intended to be portable is a bug.

An empty conditional body can occur in the configure script generated for Kerberos by the following code fragment in aclocal.m4.  If AC_CONFIG_AUX_DIR() generates no code, this conditional reduces to "if condition; then else … fi” with an empty then body.  Some shells then fail with an “unexpected else” error.

The correct fix seems to be to add a colon to ensure that the then body is never empty.

Cheers,
Brook

--- aclocal.m4.orig	2020-05-22 00:21:40.000000000 +0000
+++ aclocal.m4
@@ -15,6 +15,7 @@ ac_config_fragdir=$ac_reltopdir/config
 # echo "Looking for $srcdir/$ac_config_fragdir"
 if test -d "$srcdir/$ac_config_fragdir"; then
   AC_CONFIG_AUX_DIR(K5_TOPDIR/config)
+  :
 else
   AC_MSG_ERROR([can not find config/ directory in $ac_reltopdir])
 fi





More information about the krb5-bugs mailing list