bug-gnulib
[Top][All Lists]
Advanced

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

./bootstrap --gnulib-srcdir and GNULIB_REVISION


From: Simon Josefsson
Subject: ./bootstrap --gnulib-srcdir and GNULIB_REVISION
Date: Wed, 10 Apr 2024 23:34:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi

I'm trying to get ./bootstrap from a minimal source-only archive
generated via 'git archive' that has GNULIB_REVISION set in
bootstrap.conf, expecting this to work:

./bootstrap --gnulib-srcdir=/home/jas/src/gnulib

Bug #1: it seems GNULIB_REVISION in bootstrap.conf has no effect, and
this code is the reason (quoting bootstrap-funclib.sh):

  # XXX Should this be done if $use_git is false?
  if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
     && ! git_modules_config submodule.gnulib.url >/dev/null; then
    (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
  fi

The reason is that the tarball has .gitmodules looking like this:

[submodule "gnulib"]
        path = gnulib
        url = https://git.savannah.gnu.org/git/gnulib.git

Which trigger the '! git_modules_config submodules.gnulib.url'.

The result is that GNULIB_REVISION is not respected, and I get whatever
gnulib code happens to be checked out in --gnulib-srcdir.

What's the reason for that check?  The logic here isn't that clear.  How
about simply using:

  if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION"; then
    (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
  fi

At least it seems like a bug that GNULIB_REVISION is not respected, the
--help output suggests this should work, which doesn't say anything
about got submodules affecting behaviour:

 * If the environment variable GNULIB_SRCDIR is set (either as an
   environment variable or via the --gnulib-srcdir option), then sources
   are fetched from that local directory.  If it is a git repository and
   the configuration variable GNULIB_REVISION is set in bootstrap.conf,
   then that revision is checked out.

I can work around bug#1 with the following:

rm .gitmodules
./bootstrap --gnulib-srcdir=/home/jas/src/gnulib

That result in the correct gnulib commit being used, and all is fine.

Bug #2: ./bootstrap writes to the path indicated by --gnulib-srcdir with
the 'git checkout' command, and leaves the --gnulib-srcdir path at that
commit after ./bootstrap is finished.  This happens to work in my
example since I pointed it to a writable work tree, but I think altering
that path is unexpected and not documented.  Imagine pointing this to a
system-wide gnulib .git store like --gnulib-srcdir=/usr/share/src/gnulib
or similar read-only place.  Or imagine multiple ./bootstrap running at
the same time for different projects, both pointing to the same gnulib
.git work tree.  I think the path indicated by --gnulib-srcdir should be
read-only.

Should the 'git checkout' code be replaced with something like

  git clone --reference "$GNULIB_SRCDIR" "$gnulib_path" \
  && git checkout -C "$gnulib_path" $GNULIB_REVISION
  GNULIB_SRCDIR="$gnulib_path"

Discussion before suggesting patches would be useful, to establish some
agreement on how we want this to behave.

/Simon

Attachment: signature.asc
Description: PGP signature


reply via email to

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