bootstrap fails with SHA256 default object format

Seth McDonald <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs
Message-ID <[email protected]>
G'day,

I believe I've found a bug in Gnulib's bootstrap functionality.  When
attempting to ./bootstrap Libntlm 1.8 (from [0]), I ran into this error:

	$ ./bootstrap
	./bootstrap: Bootstrapping from checked-out libntlm sources...
	./bootstrap: getting gnulib files...
	Initialized empty Git repository in /[...]/gnulib/.git/
	warning: redirecting to https://https.git.savannah.gnu.org/git/gnulib.git/
	fatal: couldn't find remote ref dfb71172a46ef41f8cf8ab7ca529c1dd3097a41d
	warning: redirecting to https://https.git.savannah.gnu.org/git/gnulib.git/
	fatal: mismatched algorithms: client sha256; server sha1

I eventually remembered I have init.defaultObjectFormat set to sha256 in
my global git config.  And after temporarily changing it to sha1,
./bootstrap appeared to work.

Usually this shouldn't occur, since I believe git-clone sets the object
format automatically to the same as upstream.  But after grepping
Libntlm's bootstrap scripts, I found that it instead invokes git-init
and manually adds the upstream with git-remote.  From
bootstrap-funclib.sh, lines 527-529 (see [1]):

	git -C "$gnulib_path" init
	git -C "$gnulib_path" remote add origin \
	    ${GNULIB_URL:-$default_gnulib_url}

And briefly searching the current Gnulib repo, it appears this is still
the case.  From top/bootstrap.sh, lines 564-565 (see [2]):

	git -C "$gnulib_path" -c init.defaultBranch=master init
	git -C "$gnulib_path" remote add origin "$gnulib_url"

This explains the bug.  git-init initialises the repo with a SHA256
object format, then git-remote adds an upstream with a SHA1 object
format.

As such, the bug can be fixed by appending --object-format=sha1 to the
git-init command, which forces git to initialise the repo with a SHA1
object format regardless of the global default.  I've tested this with
the same Libntlm repository and it appears to work.

Take care,
	Seth McDonald.

[0] <https://gitlab.com/gsasl/libntlm/-/archive/v1.8/libntlm-1.8.tar.bz2>
[1] <https://gitlab.com/gsasl/libntlm/-/blob/v1.8/bootstrap-funclib.sh#L527>
[2] <https://github.com/coreutils/gnulib/blob/6a1ec8e86781db40430adac7c9c7a2529cbac09b/top/bootstrap-funclib.sh#L564>

-- 
E9D1 26A5 F0D4 9DF7 792B  C2E2 B4BF 4530 D39B 2D51
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.