git-annex/Utility
Joey Hess 1558e03014
Refuse to upgrade direct mode repositories when git is older than 2.22
That git fixed a memory leak that could cause an OOM during the upgrade.

Most git-annex builds have a new enough git already.
OSX git was upgraded with brew.

Linux i386ancient build's git was too old. Upgrading it to a fixed
git didn't work (due to the newer git not working with the old ssh,
https://bugs.chromium.org/p/git/issues/detail?id=7 )

Choices to deal with that were:

* Somehow make direct mode upgrade work with the old git, avoiding its
  OOM problem. One way would be to switch the repo to indirect mode
  first, and so upgrade to a repo with locked files. Not good when
  the filesystem does not support symlinks.
* backport the OOM fix from git 2.22
  (And do what about the version number so git-annex knows it's fixed?)
* backport openssh (and possibly more stuff)
* move the i386ancient build to at least Debian stretch (still backporting git)
  But this will make it no longer work with some of the ancient kernels it
  targets.

Of those, backporting the OOM fix seemed the best approach. Put "oomfix"
in the git version number to indicate it.

I have not automated building the git backport, so here's the patch I
used:

diff -ur orig/git-2.1.4/convert.c git-2.1.4/convert.c
--- orig/git-2.1.4/convert.c	2014-12-18 18:42:18.000000000 +0000
+++ git-2.1.4/convert.c	2019-08-29 20:05:04.371872338 +0100
@@ -404,7 +404,7 @@
 	if (start_async(&async))
 		return 0;	/* error was already reported */

-	if (strbuf_read(&nbuf, async.out, len) < 0) {
+	if (strbuf_read(&nbuf, async.out, 0) < 0) {
 		error("read from external filter %s failed", cmd);
 		ret = 0;
 	}
diff -ur orig/git-2.1.4/GIT-VERSION-GEN git-2.1.4/GIT-VERSION-GEN
--- orig/git-2.1.4/GIT-VERSION-GEN	2014-12-18 18:42:18.000000000 +0000
+++ git-2.1.4/GIT-VERSION-GEN	2019-08-29 20:06:39.132743228 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh

 GVF=GIT-VERSION-FILE
-DEF_VER=v2.1.4
+DEF_VER=v2.1.4.oomfix

 LF='
 '
diff -ur orig/git-2.1.4/configure git-2.1.4/configure
--- orig/git-2.1.4/configure	2014-12-18 18:42:19.000000000 +0000
+++ git-2.1.4/configure	2019-08-29 20:27:45.896380015 +0100
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='git'
 PACKAGE_TARNAME='git'
-PACKAGE_VERSION='2.1.4'
-PACKAGE_STRING='git 2.1.4'
+PACKAGE_VERSION='2.1.4.oomfix'
+PACKAGE_STRING='git 2.1.4.oomfix'
 PACKAGE_BUGREPORT='git@vger.kernel.org'
 PACKAGE_URL=''

diff -ur orig/git-2.1.4/version git-2.1.4/version
--- orig/git-2.1.4/version	2014-12-18 18:42:19.000000000 +0000
+++ git-2.1.4/version	2019-08-29 20:06:17.572545210 +0100
@@ -1 +1 @@
-2.1.4
+2.1.4.oomfix
2019-08-29 15:24:41 -04:00
..
Directory add streamDirectoryContents 2018-04-26 13:38:36 -04:00
DirWatcher remove many old version ifdefs 2019-07-05 15:09:37 -04:00
Env fix unused module import warnings when building on windows 2019-08-08 12:18:53 -04:00
LockFile strict bytestring encoders and decoders 2019-01-01 14:55:15 -04:00
LockPool add DebugLocks build flag 2018-11-19 15:02:43 -04:00
Path fix unused module import warnings when building on windows 2019-08-08 12:18:53 -04:00
Process fixed processTranscript hang problem 2018-03-15 16:14:22 -04:00
Scheduled
Tmp avoid conflicting definitions of Template type 2018-12-30 15:03:31 -04:00
Aeson.hs switch MetaValue to ByteString and MetaField to Text 2019-01-07 14:18:24 -04:00
Android.hs avoid unused imports warning on non-linux 2018-08-07 15:06:33 -04:00
Applicative.hs
AuthToken.hs comment typo 2019-01-03 00:22:05 -04:00
Base64.hs switch MetaValue to ByteString and MetaField to Text 2019-01-07 14:18:24 -04:00
Batch.hs removed the old Android app 2018-10-13 01:41:11 -04:00
Bloom.hs remove many old version ifdefs 2019-07-05 15:09:37 -04:00
CoProcess.hs
CopyFile.hs small optimisation to file copying 2019-07-17 14:22:21 -04:00
Daemon.hs terminateProcessId renamed 2017-10-25 19:46:28 -04:00
Data.hs
DataUnits.hs
DBus.hs
DebugLocks.hs add DebugLocks build flag 2018-11-19 15:02:43 -04:00
Directory.hs finally really add back custom-setup stanza 2017-12-31 16:36:39 -04:00
DirWatcher.hs
DiskFree.hs removed the old Android app 2018-10-13 01:41:11 -04:00
Dot.hs
DottedVersion.hs Refuse to upgrade direct mode repositories when git is older than 2.22 2019-08-29 15:24:41 -04:00
Env.hs finally really add back custom-setup stanza 2017-12-31 16:36:39 -04:00
Exception.hs removed the old Android app 2018-10-13 01:41:11 -04:00
FileMode.hs Make test suite work better when the temp directory is on NFS. 2018-12-19 12:44:56 -04:00
FileSize.hs
FileSystemEncoding.hs slight optimisation more 2019-01-11 19:56:31 -04:00
Format.hs
FreeDesktop.hs
GitLFS.hs add exports useful if using this module to write a git-lfs server 2019-08-05 15:40:36 -04:00
Glob.hs
Gpg.hs fix unused module import warnings when building on windows 2019-08-08 12:18:53 -04:00
Hash.hs Add BLAKE2BP512 and BLAKE2BP512E backends 2019-07-05 15:30:03 -04:00
HtmlDetect.hs fix regression in addurl --file caused by youtube-dl support 2017-12-06 13:22:31 -04:00
HttpManagerRestricted.hs merge from http-client-restricted 2019-07-17 16:48:50 -04:00
HumanNumber.hs
HumanTime.hs Estimated time to completion display shortened from eg "1h1m1s" to "1h1m" 2019-01-21 00:04:35 -04:00
InodeCache.hs fix unused module import warnings when building on windows 2019-08-08 12:18:53 -04:00
IPAddress.hs add back support for ftp urls 2019-05-30 14:51:34 -04:00
libkqueue.c
libkqueue.h
LinuxMkLibs.hs
LockFile.hs
LockPool.hs
LogFile.hs finally really add back custom-setup stanza 2017-12-31 16:36:39 -04:00
Lsof.hs removed the old Android app 2018-10-13 01:41:11 -04:00
MagicWormhole.hs fix p2p --pair 2018-07-04 15:14:03 -04:00
Matcher.hs avoid list lookup by parseToken 2019-05-14 13:11:29 -04:00
MD5.hs Corrected some license statements 2019-07-28 14:27:33 -04:00
Metered.hs followup and display rsync exit status 2019-08-15 14:47:22 -04:00
Misc.hs finally really add back custom-setup stanza 2017-12-31 16:36:39 -04:00
Monad.hs
Mounts.hs removed the old Android app 2018-10-13 01:41:11 -04:00
Network.hs
NotificationBroadcaster.hs
OptParse.hs
OSX.hs
Parallel.hs
PartialPrelude.hs moved module and relicensed 2018-10-29 23:13:36 -04:00
Path.hs finally really add back custom-setup stanza 2017-12-31 16:36:39 -04:00
Percentage.hs
PID.hs Revert "Revert "remove dep on Win32-extras"" 2017-11-13 12:55:23 -04:00
Process.hs fix bogus ghc 8.6.3 build warning 2018-12-30 14:43:27 -04:00
QuickCheck.hs remove many old version ifdefs 2019-07-05 15:09:37 -04:00
RawFilePath.hs use ByteStrings when reading annex symlinks and pointers 2019-01-14 15:37:08 -04:00
Rsync.hs followup and display rsync exit status 2019-08-15 14:47:22 -04:00
SafeCommand.hs Revert "fix comment" 2018-11-06 17:26:20 -04:00
Scheduled.hs add dropFromEnd 2018-11-23 11:24:05 -04:00
Shell.hs removed the old Android app 2018-10-13 01:41:11 -04:00
SimpleProtocol.hs clean P2P protocol shutdown on EOF 2018-09-13 10:46:37 -04:00
Split.hs add dropFromEnd 2018-11-23 11:24:05 -04:00
SshConfig.hs
SshHost.hs
Su.hs finally really add back custom-setup stanza 2017-12-31 16:36:39 -04:00
SystemDirectory.hs
Tense.hs
ThreadLock.hs
ThreadScheduler.hs removed the old Android app 2018-10-13 01:41:11 -04:00
TimeStamp.hs remove many old version ifdefs 2019-07-05 15:09:37 -04:00
TList.hs
Tmp.hs use relatedTempate in viaTmp 2019-03-04 14:12:00 -04:00
Tor.hs Support building with socks-0.6 and persistant-template-2.7 2019-07-30 12:50:48 -04:00
Touch.hs remove unused import 2018-10-30 13:38:29 -04:00
Tuple.hs
Url.hs fix display of http exceptions 2019-08-10 11:09:25 -04:00
UserInfo.hs removed the old Android app 2018-10-13 01:41:11 -04:00
Verifiable.hs
WebApp.hs removed the old Android app 2018-10-13 01:41:11 -04:00
Yesod.hs remove many old version ifdefs 2019-07-05 15:09:37 -04:00