Bug#872847: fritzing: fails to bulid against libgit2 0.26.0

2017-10-03 Thread Ximin Luo
On Thu, 21 Sep 2017 03:43:52 +0100 peter green  wrote:
> It appears that git_remote_connect has added a new parameter called "proxy" 
> of type git_proxy_options in the second to last position.
> 
> Unfortunately the documentation seems to be very thin on the ground. In 
> particular it says nothing about whether this new parameter can simply be set 
> to NULL or if it needs some other kind of handling. So I went digging in the 
> libgit2 source.
> 
> git_remote_connect seems to do some kind of version check on the proxy 
> options if they are not null which suggests that they can be NULL. it then 
> passes them off to t->connect.
> 
> Afaict for the standard transports t->connect will point to 
> git_smart__connect which passes the proxy options to git_proxy_options_dup 
> and fails if git_proxy_options_dup fails.
> 
> And it appears that git_proxy_options_dup succeeds if the source is NULL 
> filling in a default set of proxy options.
> 
> So it looks like it is safe to set the "proxy" parameter to NULL.
> 
> ccing the libgit2 maintainers so they can check my analysis and preferablly 
> get some statements on this added to the documentation.
> 
> I have tested that setting the new parameter to NULL makes the package build. 
> I have not tested it beyond that. I have uploaded the change to raspbian.
> 

That sounds good to me. Another data point is that NULL is indeed used a bunch 
of times in the tests:

libgit2$ git grep git_remote_connect
[..]
tests/network/remote/local.c:   cl_git_pass(git_remote_connect(localremote, 
GIT_DIRECTION_PUSH, NULL, NULL, NULL));
tests/network/remote/local.c:   cl_git_pass(git_remote_connect(localremote, 
GIT_DIRECTION_PUSH, NULL, NULL, NULL));
tests/network/remote/local.c:   cl_git_pass(git_remote_connect(localremote, 
GIT_DIRECTION_PUSH, NULL, NULL, NULL));
tests/network/remote/local.c:   cl_git_pass(git_remote_connect(remote, 
GIT_DIRECTION_FETCH, NULL, NULL, NULL));

Looking at `git blame` for that file, this leads me to this commit:
https://github.com/libgit2/libgit2/commit/07bd3e57d9a9930727695be690c8757f79117d45

where that param was added and NULL was also added at the same time to a bunch 
of call-sites.

So indeed your analysis seems correct.

> No immediate intent to NMU in Debian but if I get positive feedback on the 
> patch I may do so later.
> 

NMU sounds good to me too, feel free to do that.

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git



Bug#872847: fritzing: fails to bulid against libgit2 0.26.0

2017-09-20 Thread peter green

It appears that git_remote_connect has added a new parameter called "proxy" of 
type git_proxy_options in the second to last position.

Unfortunately the documentation seems to be very thin on the ground. In 
particular it says nothing about whether this new parameter can simply be set 
to NULL or if it needs some other kind of handling. So I went digging in the 
libgit2 source.

git_remote_connect seems to do some kind of version check on the proxy options if 
they are not null which suggests that they can be NULL. it then passes them off to 
t->connect.

Afaict for the standard transports t->connect will point to git_smart__connect 
which passes the proxy options to git_proxy_options_dup and fails if 
git_proxy_options_dup fails.

And it appears that git_proxy_options_dup succeeds if the source is NULL 
filling in a default set of proxy options.

So it looks like it is safe to set the "proxy" parameter to NULL.

ccing the libgit2 maintainers so they can check my analysis and preferablly get 
some statements on this added to the documentation.

I have tested that setting the new parameter to NULL makes the package build. I 
have not tested it beyond that. I have uploaded the change to raspbian.

No immediate intent to NMU in Debian but if I get positive feedback on the 
patch I may do so later.

diff -Nru fritzing-0.9.3b+dfsg/debian/changelog 
fritzing-0.9.3b+dfsg/debian/changelog
--- fritzing-0.9.3b+dfsg/debian/changelog   2017-01-23 16:27:29.0 
+
+++ fritzing-0.9.3b+dfsg/debian/changelog   2017-09-21 02:21:45.0 
+
@@ -1,3 +1,10 @@
+fritzing (0.9.3b+dfsg-4+rpi1) buster-staging; urgency=medium
+
+  * Set new "proxy" parameter in git_remote_connect to NULL (Closes: 872847)
+  * Bump libgit2 build-dependency to >= 0.25 due to above patch.
+
+ -- Peter Michael Green   Thu, 21 Sep 2017 02:21:45 
+
+
 fritzing (0.9.3b+dfsg-4) unstable; urgency=medium
 
   * created a shell script to launch fritzing with a special pwd.
diff -Nru fritzing-0.9.3b+dfsg/debian/control 
fritzing-0.9.3b+dfsg/debian/control
--- fritzing-0.9.3b+dfsg/debian/control 2016-11-01 12:05:59.0 +
+++ fritzing-0.9.3b+dfsg/debian/control 2017-09-21 02:21:45.0 +
@@ -11,7 +11,7 @@
libqt5svg5-dev,
zlib1g-dev,
libboost-dev,
-   libgit2-dev (>= 0.24.1),
+   libgit2-dev (>= 0.25),
sqlite3
 Standards-Version: 3.9.8
 Vcs-Browser: https://bazaar.launchpad.net/~ehbello/fritzing/debian/changes
diff -Nru fritzing-0.9.3b+dfsg/debian/patches/add-proxy-parameter.diff 
fritzing-0.9.3b+dfsg/debian/patches/add-proxy-parameter.diff
--- fritzing-0.9.3b+dfsg/debian/patches/add-proxy-parameter.diff
1970-01-01 00:00:00.0 +
+++ fritzing-0.9.3b+dfsg/debian/patches/add-proxy-parameter.diff
2017-09-21 02:21:45.0 +
@@ -0,0 +1,14 @@
+Description:  Set new "proxy" parameter in git_remote_connect to NULL
+Author: Peter Michael Green 
+
+--- fritzing-0.9.3b+dfsg.orig/src/version/partschecker.cpp
 fritzing-0.9.3b+dfsg/src/version/partschecker.cpp
+@@ -123,7 +123,7 @@ bool PartsChecker::newPartsAvailable(con
+  */
+ git_strarray customheaders;
+ customheaders.count = 0;
+-error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, 
&customheaders);
++error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks,NULL, 
&customheaders);
+ if (error) {
+ partsCheckerResult.partsCheckerError = PARTS_CHECKER_ERROR_REMOTE;
+ partsCheckerResult.errorMessage = QObject::tr("Unable to access 
network site for '%1'. %2").arg(repoPath).arg(sBoilerPlate1);
diff -Nru fritzing-0.9.3b+dfsg/debian/patches/series 
fritzing-0.9.3b+dfsg/debian/patches/series
--- fritzing-0.9.3b+dfsg/debian/patches/series  2017-01-23 16:27:29.0 
+
+++ fritzing-0.9.3b+dfsg/debian/patches/series  2017-09-21 02:21:45.0 
+
@@ -4,3 +4,4 @@
 git-remote-connect.patch
 no-isystem-for-gcc6.patch
 fritzing.desktop.patch
+add-proxy-parameter.diff