bug-gnulib
[Top][All Lists]
Advanced

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

Re: default gnulib_path in build-aux/bootstrap script


From: Jim Meyering
Subject: Re: default gnulib_path in build-aux/bootstrap script
Date: Fri, 14 Jan 2011 09:56:20 +0100

John W. Eaton wrote:

> I updated Octave's copy of the bootstrap script from gnulib's version
> today and hit an error because gnulib_path was set to ''.  The code in
> the bootstrap script for this is
>
>   git_modules_config () {
>     test -f .gitmodules && git config --file .gitmodules "$@"
>   }
>
>   gnulib_path=`git_modules_config submodule.gnulib.path`
>   : ${gnulib_path=gnulib}
>
> I don't have a .gitmodules file, so git_modules_config doesn't return
> anything and gnulib_path is set to '' before the
>
>   : ${gnulib_path=gnulib}
>
> line, so then it remains ''.  Shouldn't this be
>
>   : ${gnulib_path:=gnulib}
>
> (or equivalent if this method is not sufficiently portable) so that it
> will be set to the default value if $gnulib_path is unset or empty,
> not just if it is unset?  It looks to me that $gnulib_path will always
> be set, to the default value of "gnulib" will never be used.

Here's a proposed patch.
There may be another way to do it using something like := as you suggest,
but using an explicit "test and set" seems safer, given the portability
caveats in autoconf's shellology section.

>From 3a91f94f896e5127348e777c171b75da3b20ff40 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 14 Jan 2011 09:43:00 +0100
Subject: [PATCH] bootstrap: avoid failure when there is no .gitmodules file

": ${gnulib_path=gnulib}" fails to set $gnulib_path when that variable
has been assigned to, even when its value is the empty string.
* build-aux/bootstrap (gnulib_path): Test explicitly for an empty
"$gnulib_path", rather than using ${gnulib_path=gnulib}.
Reported by John W. Eaton <address@hidden>.
---
 ChangeLog           |    9 +++++++++
 build-aux/bootstrap |    4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8cffb3a..e1a213c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-14  Jim Meyering  <address@hidden>
+
+       bootstrap: avoid failure when there is no .gitmodules file
+       ": ${gnulib_path=gnulib}" fails to set $gnulib_path when that variable
+       has been assigned to, even when its value is the empty string.
+       * build-aux/bootstrap (gnulib_path): Test explicitly for an empty
+       "$gnulib_path", rather than using ${gnulib_path=gnulib}.
+       Reported by John W. Eaton <address@hidden>.
+
 2011-01-12  Rob Vermaas  <address@hidden>

        save-cwd: no longer include "xgetcwd.h"
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index ecf2517..25bc53b 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2010-11-20.03; # UTC
+scriptversion=2011-01-14.08; # UTC

 # Bootstrap this package from checked-out sources.

@@ -462,7 +462,7 @@ git_modules_config () {
 }

 gnulib_path=`git_modules_config submodule.gnulib.path`
-: ${gnulib_path=gnulib}
+test -z "$gnulib_path" && gnulib_path=gnulib

 # Get gnulib files.

--
1.7.3.5



reply via email to

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