public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrew Dunstan <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: Release 13 of the PostgreSQL BuildFarm client
Date: Tue, 3 Aug 2021 15:14:41 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>


On 8/3/21 8:47 AM, Andrew Dunstan wrote:
> On 8/2/21 7:11 PM, Tom Lane wrote:
>> Andrew Dunstan <[email protected]> writes:
>>> I have pushed Release 13 of the PostgreSQL BuildFarm client.
>> FYI, this seems to have broken compatibility with ancient versions
>> of git.  prairiedog and gaur/pademelon are both using
>> git version 1.7.9.6, and they both choked on the --prune-tags
>> option.  I tried removing that, as it seemed possibly unnecessary,
>> but it didn't improve matters.
>>
>> I suppose I'm overdue to update git on these machines, but anyone
>> else running dinosaur versions may want to be cautious.
>
> Not so much dinosaurs either. I just tried on Centos 7 which isn't that
> old, and got a failure. Not just from the prune-tags but from 'git
> ls-remote' not supporting symref. I will come up with a solution in a
> couple of days, but for now please don't deploy unless you have a fairly
> modern git. If you do deploy, be prepared to roll back.
>
>

OK, I have come up with this fix. Essentially the code detects if the
git version can run `git ls-remote --symref` and refuses to run branch
name checking code if it fails. It also outputs a warning message unless
the config setting skip_git_default_check has been explicitly set. In
either case the owner will have to update their git installation or face
a flag day event when the default branch name changes.


I have tested this on Centos 7 which has a git that's plenty old enough
to exhibit the problems Tom encountered.


I'm planning on issuing a 12.1 release fairly soon with this patch, but
as I developed it fairly quickly and through the fog of some painkillers
I'd appreciate more eyes on it first :-)


cheers


andrew


-- 

Andrew Dunstan
EDB: https://www.enterprisedb.com



Attachments:

  [text/x-patch] v13-git-fix.patch (1.6K, ../[email protected]/2-v13-git-fix.patch)
  download | inline diff:
diff --git a/PGBuild/SCM.pm b/PGBuild/SCM.pm
index 8372255..5862634 100644
--- a/PGBuild/SCM.pm
+++ b/PGBuild/SCM.pm
@@ -473,7 +473,7 @@ use Fcntl qw(:flock);
 use File::Find;
 use File::Basename;
 
-use PGBuild::Utils;
+use PGBuild::Utils qw(:DEFAULT $devnull);
 use PGBuild::Options;
 
 sub new
@@ -503,6 +503,17 @@ sub new
 	}
 	$self->{target} = $target;
 	$self->{skip_git_default_check} = $conf->{skip_git_default_check} || 0;
+	if (!$self->{skip_git_default_check})
+	{
+		system("git ls-remote --symref $self->{gitrepo} HEAD > $devnull 2>&1");
+		if ($?)
+		{
+			my $gversion = `git --version`;
+			chomp $gversion;
+			print "$gversion too old to for automatic default branch update\n";
+			$self->{skip_git_default_check} = "detected by SCM module";
+		}
+	}
 	return bless $self, $class;
 }
 
@@ -720,16 +731,22 @@ sub _create_or_update_mirror
 
 	my $gitserver = $self->{gitrepo};
 
+	my $skip_default_name_check = $self->{skip_git_default_check};
+
 	my @gitlog;
 	my $status;
 	if (-d $self->{mirror})
 	{
+		# do we need --prune-tags here? I'm not sure. Only very modern versions
+		# of git have --prune-tags, so for now we'll leave it out.
+		# see https://git-scm.com/docs/git-fetch/2.25.1 for a discussion
+		# of different ways of saying it
 		@gitlog =
 		  run_log(
-			qq{git --git-dir="$self->{mirror}" fetch --prune --prune-tags});
+			qq{git --git-dir="$self->{mirror}" fetch --prune});
 		$status = $self->{ignore_mirror_failure} ? 0 : $? >> 8;
 
-		if (!$status)
+		if (!$status && !$skip_default_name_check)
 		{
 			# make sure we have the same idea of the default branch name
 			# as upstream


view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Release 13 of the PostgreSQL BuildFarm client
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox