Kallithea issues archive

Issue #230: Cannot perform push with hg-git mercurial plugin

Reported by: Дмитрий Иванов
State: resolved
Created on: 2016-07-07 13:36
Updated on: 2017-07-02 23:30

Description

I receiving the next error: abort: git remote error: unexpected first line ['# service=git-receive-pack'] from smart server

Also i sniffed traffic and found one difference with working bitbucket repo:

tmp.jpg

kallithea does not puts \n after service=git-receive-pack this behavior deny hg-git dulwich to work with repo.

Attachments

Comments

Comment by Mads Kiilerich, on 2016-07-07 13:48

I'm quite sure that it works in general and elsewhere.

Do you get the same if you take nginx out of the equation?

Do you only see it with hg-git and not with plain git? In that case, while there might be something misbehaving in Kallithea, it also sounds like a dulwich bug?

Comment by Дмитрий Иванов, on 2016-07-07 14:23

I found the workaround. nginx content substitude will fix the problem.

 sub_filter_types application/x-git-receive-pack-advertisement;
  sub_filter '001e# service=git-receive-pack' '001f# service=git-receive-pack\n';
  sub_filter once on;

Comment by Дмитрий Иванов, on 2016-07-07 14:29

native git client works good. Problem widh dulwich based clients.

Comment by Дмитрий Иванов, on 2016-07-07 14:30

Also i want to mention that this problem exist even if i use kallithea directly for example on http://myserver.com:5000 So real problem exist in kallithea.

Comment by Дмитрий Иванов, on 2016-07-07 14:32

Please fix this in your codebase. I spent 3 hours to enable my hg-git to work with kallithea.

Comment by Mads Kiilerich, on 2016-07-07 18:11

Thanks.

Which of the Python web servers are you using?

Can you describe in details how to reproduce the problem?

Comment by Andrej Shadura, on 2016-07-14 10:05

I'd say it's a bug in the Git protocol itself. Apparently it is (was?) written in a way that allows multiple interpretations, and Git client itself supports either of them, which Dulwich follows the spec precisely.

The best thing would be to change this bit of code according to the spec, and to ask Jelmer to change Dulwich too.

Comment by Andrej Shadura, on 2016-07-14 10:05

Comment by Mads Kiilerich, on 2016-07-14 11:29

I wouldn't call it a bug in the Git protocol / implementation that it follows Postel's law.

Agreed, it seems like a bug in Dulwich that it isn't as liberal as Git is.

But there must also be a bug somewhere in the Kallithea stack that violates the "be conservative" part.

Comment by Andrej Shadura, on 2016-07-14 12:00

I have now learned that apparently Git HTTP protocol wasn't defined at all until very recently. That may explain the situation we've got into.

Comment by Andrej Shadura, on 2016-07-14 12:00

In any case, I have a fix in my working directory, for this and other related bugs.

Comment by Andrej Shadura, on 2016-07-14 12:09

Comment by mirrorbot, on 2016-07-25 17:47

git: include an LF at the end of the service advertisement (Fixes #230)

This fixes hg-git/Dulwich and possibly other conservative Git clients, which do not ignore the absence of the LF.

The original comment was a guess based on reverse engineering the protocol not specified in the documentation yet at that moment. Now that the documentation exists and states this explicitly, just do as it says.

→ <<cset 1e373254388c>>

Comment by Дмитрий Иванов, on 2016-07-26 04:43

Thank you guys for this fix.

Comment by mirrorbot, on 2017-07-02 23:30

git: include an LF at the end of the service advertisement (Fixes #230)

This fixes hg-git/Dulwich and possibly other conservative Git clients, which do not ignore the absence of the LF.

The original comment was a guess based on reverse engineering the protocol not specified in the documentation yet at that moment. Now that the documentation exists and states this explicitly, just do as it says.

→ <<cset d28545413343>>