Hi Paul,

> Unfortunately that didn't work for me when I tried it with GNU Tar, 
> which led to some of my confusion.
> 
> Here's how I can reproduce the problem, starting with a fresh checkout 
> of the latest GNU Tar (commit 5c4f8cadbd362497dc3c3136566589557ce00f1b). 
> The following commands replace Tar's 'bootstrap' (which is 
> top/bootstrap) with build-aux/bootstrap, removes the files that are 
> supposed to be fetched automatically, and then runs ./bootstrap which 
> fails because the files are not fetched automatically.
> 
>    $ cp $HOME/src/gnu/gnulib/build-aux/bootstrap .
>    $ rm autogen.sh autopull.sh bootstrap-funclib.sh
>    $ ./bootstrap
>    grep: paxutils/gnulib.modules: No such file or directory
>    ./bootstrap: Bootstrapping from checked-out tar sources...
>    ./bootstrap: line 793: ./autopull.sh: No such file or directory
>    ./bootstrap: autopull.sh failed.

Oh, I see. From this recipe, I guess the first phase of the automatic
sync succeeded, but the second phase didn't (because your bootstrap.conf
was not yet adjusted). As a result, the intermediate 'bootstrap' without
its companion files was left on the disk. And that is what caused the
further errors and need for manual intervention.

This patch fixes it.


2022-07-25  Bruno Haible  <br...@clisp.org>

        bootstrap: Make the automatic sync more resilient.
        Reported by Paul Eggert in
        <https://lists.gnu.org/archive/html/bug-gnulib/2022-07/msg00060.html>.
        * top/bootstrap (bootstrap_sync): Set to true when bootstrap-funclib.sh
        is not present.
        * top/gen-bootstrap.sed: Insert a couple of comment lines.
        * build-aux/bootstrap: Regenerated using "make build-aux/bootstrap".

diff --git a/top/bootstrap b/top/bootstrap
index b7216d20fe..e9d8ad82aa 100755
--- a/top/bootstrap
+++ b/top/bootstrap
@@ -153,14 +153,7 @@ do
   --bootstrap-sync)
     bootstrap_sync=true;;
   --no-bootstrap-sync)
-    if test -f "$medir"/bootstrap-funclib.sh; then
-      bootstrap_sync=false
-    else
-      # We have only completed the first phase of an upgrade from a bootstrap
-      # version < 2022-07-24. Need to do the second phase now.
-      bootstrap_sync=true
-    fi
-    ;;
+    bootstrap_sync=false;;
   --no-git)
     use_git=false;;
   *)
@@ -179,6 +172,12 @@ fi
 
 check_build_prerequisites $use_git
 
+if ! test -f "$medir"/bootstrap-funclib.sh; then
+  # We have only completed the first phase of an upgrade from a bootstrap
+  # version < 2022-07-24. Need to do the second phase now.
+  bootstrap_sync=true
+fi
+
 if $bootstrap_sync; then
   prepare_GNULIB_SRCDIR
   upgrade_bootstrap
diff --git a/top/gen-bootstrap.sed b/top/gen-bootstrap.sed
index 2851db5eaf..c182abfa50 100644
--- a/top/gen-bootstrap.sed
+++ b/top/gen-bootstrap.sed
@@ -1,3 +1,13 @@
+1{
+a\
+# DO NOT EDIT! GENERATED AUTOMATICALLY!
+a\
+# This script is only a trampoline that fetches the companion scripts
+a\
+# (bootstrap-funclib.sh, autopull.sh, autogen.sh).
+a\
+
+}
 /^[.] "[$]medir"[/]bootstrap-funclib.sh/{
   s/^.*$//
   r top/bootstrap-funclib.sh




Reply via email to