icyphox / legit

web frontend for git
https://git.icyphox.sh
MIT License
381 stars 25 forks source link

Regression between 0.2.0 and 0.2.1: git fetch -> bad line length character: PACK #33

Closed gl-yziquel closed 2 months ago

gl-yziquel commented 4 months ago

Hi.

I determined, recently, that a buggy behaviour of legit was due to a regression between 0.2.0 and 0.2.1.

Problematic behaviour on 0.2.1:

mini-me@virtucon ~/h/c/l/just.d (master)> git fetch --all
fatal: protocol error: bad line length character: PACK

legit is the server serving these git repos.

Correct behaviour on 0.2.0:

mini-me@virtucon ~/h/s/m/just.d (master)> git fetch --all
remote: Enumerating objects: 46, done.
remote: Counting objects: 100% (46/46), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 43 (delta 22), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (43/43), 16.11 KiB | 485.00 KiB/s, done.
From https://goldmember.virtucon.evil/legit/mud-just
   05863f5..a0b7332  master     -> origin/master

Current behaviour on 0.2.2 is still buggy.

The reason seems linked to the following note in the following release:

Release: https://github.com/icyphox/legit/releases/tag/v0.2.1

The git executable is no longer required in PATH as git-upload-pack is now implemented using go-git

That same error pops up sporadically: https://github.com/src-d/go-billy/issues/11

gl-yziquel commented 4 months ago

Seems @prologic had the same issue. Here's an unsolved issue in the go-git issue tracker:

https://github.com/go-git/go-git/issues/647#issuecomment-2134524843

And here is a pin of legit on v.0.2.0 that solves the issue by going back before the regression:

https://github.com/gl-yziquel/legit

prologic commented 4 months ago

I was never able to solve this, despite the many suggestions and comments. See gitxt

icyphox commented 4 months ago

Hm, looks like the go-git git-upload-pack implementation is a source of constant annoyance. While I haven't run into the bug mentioned here, I am facing a perhaps related issue with UploadPack blowing up the stack and crashing every time someone tries to clone (see: https://github.com/go-git/go-git/issues/1062). I think the intermediate fix until go-git gets their shit together would be to switch back to using the gitkit lib.

icyphox commented 2 months ago

@gl-yziquel Hi, I've tagged a new release that reverts back to using the system's git upload-pack. It of course, requires git to be in PATH. Let me know if this fixes it for you, and if not I'll re-open this.