From 01515f6ba53ed118c2bcbf1fd8e38a1f09e1a93d Mon Sep 17 00:00:00 2001 From: Kirill Date: Wed, 13 Oct 2021 14:35:36 +0300 Subject: [PATCH] libgit2: update to 1.2.0. Updated libgit2 to `v1.2.0`, added patch with PR https://github.com/libgit2/libgit2/pull/6032 of `git_remote_name_is_valid` fix. --- common/shlibs | 2 +- .../extern_git_remote_name_is_valid.patch | 58 +++++++++++++++++++ srcpkgs/libgit2/template | 6 +- 3 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/libgit2/patches/extern_git_remote_name_is_valid.patch diff --git a/common/shlibs b/common/shlibs index 840fbc0b9a9f..64e4eafdf728 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1315,7 +1315,7 @@ libunwind-ppc64.so.8 libunwind-1.5.0_3 libunwind-setjmp.so.0 libunwind-1.5.0_3 libmicrohttpd.so.12 libmicrohttpd-0.9.73_1 libmicrodns.so.1 libmicrodns-0.2.0_1 -libgit2.so.1.0 libgit2-1.0.1_3 +libgit2.so.1.2 libgit2-1.2.0_4 libgit2-glib-1.0.so.0 libgit2-glib-0.23.4_1 libagg.so.2 agg-2.5_1 libzzip-0.so.13 zziplib-0.13.62_1 diff --git a/srcpkgs/libgit2/patches/extern_git_remote_name_is_valid.patch b/srcpkgs/libgit2/patches/extern_git_remote_name_is_valid.patch new file mode 100644 index 000000000000..a84a285da726 --- /dev/null +++ b/srcpkgs/libgit2/patches/extern_git_remote_name_is_valid.patch @@ -0,0 +1,58 @@ +From 27f50a66124054518d5febe984bccad02ee0846b Mon Sep 17 00:00:00 2001 +From: Miguel Arroz <750683+arroz@users.noreply.github.com> +Date: Thu, 2 Sep 2021 18:59:19 -0700 +Subject: [PATCH 1/2] #6028: Check if `threadstate->error_t.message` is not + `git_buf__initbuf` before freeing. + +This follows the same principle as `buffer.c` where the same check is done before freeing the buffer. It fixes the crash described in #6028. +--- + src/threadstate.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/threadstate.c b/src/threadstate.c +index 6031e8280..e2c08975f 100644 +--- a/src/threadstate.c ++++ b/src/threadstate.c +@@ -36,7 +36,8 @@ static void threadstate_dispose(git_threadstate *threadstate) + if (!threadstate) + return; + +- git__free(threadstate->error_t.message); ++ if (threadstate->error_t.message != git_buf__initbuf) ++ git__free(threadstate->error_t.message); + threadstate->error_t.message = NULL; + } + +-- +2.33.0 + + +From 62ee779ea4cdd877419571442860a0d29896a59c Mon Sep 17 00:00:00 2001 +From: lhchavez +Date: Sat, 4 Sep 2021 18:01:10 -0700 +Subject: [PATCH 2/2] remote: Mark `git_remote_name_is_valid` as `GIT_EXTERN` + +This change makes `git_remote_name_is_valid` be part of the public +interface of the library. This is needed for other language bindings to +be able to find this symbol (like in git2go, when linking against +libgit2 dynamically). +--- + include/git2/remote.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/git2/remote.h b/include/git2/remote.h +index 1f52fcd94..51a7d1cdc 100644 +--- a/include/git2/remote.h ++++ b/include/git2/remote.h +@@ -971,7 +971,7 @@ GIT_EXTERN(int) git_remote_rename( + * @param remote_name name to be checked. + * @return 0 on success or an error code + */ +-int git_remote_name_is_valid(int *valid, const char *remote_name); ++GIT_EXTERN(int) git_remote_name_is_valid(int *valid, const char *remote_name); + + /** + * Delete an existing persisted remote. +-- +2.33.0 + diff --git a/srcpkgs/libgit2/template b/srcpkgs/libgit2/template index 2722bd6553f7..463c7cda8c25 100644 --- a/srcpkgs/libgit2/template +++ b/srcpkgs/libgit2/template @@ -1,7 +1,7 @@ # Template file for 'libgit2' pkgname=libgit2 -version=1.0.1 -revision=3 +version=1.2.0 +revision=4 build_style=cmake hostmakedepends="python3 git pkg-config" makedepends="zlib-devel openssl-devel http-parser-devel libssh2-devel" @@ -10,7 +10,7 @@ maintainer="q66 " license="custom:GPL-2.0-or-later WITH GCC-exception-2.0" homepage="https://libgit2.org" distfiles="https://github.com/libgit2/libgit2/archive/v${version}.tar.gz" -checksum=1775427a6098f441ddbaa5bd4e9b8a043c7401e450ed761e69a415530fea81d2 +checksum=701a5086a968a46f25e631941b99fc23e4755ca2c56f59371ce1d94b9a0cc643 post_install() { vlicense COPYING