Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAzsI-0005hY-EW for buildfarm-members@arkaria.postgresql.org; Tue, 03 Aug 2021 19:14:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mAzsG-0001DY-Sc for buildfarm-members@arkaria.postgresql.org; Tue, 03 Aug 2021 19:14:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAzsG-0001DQ-Na for buildfarm-members@lists.postgresql.org; Tue, 03 Aug 2021 19:14:48 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAzsD-0006tS-Nt for buildfarm-members@postgresql.org; Tue, 03 Aug 2021 19:14:48 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 1E7E8100008; Tue, 3 Aug 2021 19:14:42 +0000 (UTC) Subject: Re: Release 13 of the PostgreSQL BuildFarm client From: Andrew Dunstan To: Tom Lane Cc: buildfarm-members@postgresql.org References: <18c03f7e-3ab9-f7b4-9248-feb85b0f03ed@dunslane.net> <1660080.1627945870@sss.pgh.pa.us> <5462d8bd-b8aa-3c38-b078-4bf5e94f8eba@dunslane.net> Message-ID: <0234f0ff-221a-e6a4-39c7-137ed4edb74e@dunslane.net> Date: Tue, 3 Aug 2021 15:14:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <5462d8bd-b8aa-3c38-b078-4bf5e94f8eba@dunslane.net> Content-Type: multipart/mixed; boundary="------------14C1CBA5DBB8AF1AB8646D2B" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------14C1CBA5DBB8AF1AB8646D2B Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 8/3/21 8:47 AM, Andrew Dunstan wrote: > On 8/2/21 7:11 PM, Tom Lane wrote: >> Andrew Dunstan 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 --------------14C1CBA5DBB8AF1AB8646D2B Content-Type: text/x-patch; charset=UTF-8; name="v13-git-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v13-git-fix.patch" 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 --------------14C1CBA5DBB8AF1AB8646D2B--