svn commit: r534921 - in head/www/gitea: . files
Kyle Evans
kevans at FreeBSD.org
Mon May 11 16:52:29 UTC 2020
Author: kevans
Date: Mon May 11 16:52:28 2020
New Revision: 534921
URL: https://svnweb.freebsd.org/changeset/ports/534921
Log:
www/gitea: Fix viewing of branches with a slash in the name
An issue[0] was filed upstream in January that branches with a slash in
their name (e.g. stable/11) result in a 500 error when attempting to view
them.
I tracked down the issue to the fact that read(2) on a directory fd in
FreeBSD will actually succeed, while it will not on Linux/other OS. I have
filed a PR[1] with go-git to remedy the problem there, and then we
(hopefully) convince gitea maintainers to accept the patch as well once it's
upstreamed.
The attached patch brings it into the ports tree as well, so that FreeBSD
users can more immediately get the fix. It should still apply to the version
in 2020Q2, more or less, with version numbers changed to protect the
innocent.
[0] https://github.com/go-gitea/gitea/issues/9938
[1] https://github.com/go-git/go-git/pull/39
PR: 245863
Approved by: <stb lassitu de> (maintainer)
Aoorived by: koobs (mentor, ports)
MFH: 2020Q2 (minor bugfix patch)
Added:
head/www/gitea/files/patch-vendor_github.com_go-git_go-git_v5_storage_filesystem_dotgit_dotgit.go (contents, props changed)
Modified:
head/www/gitea/Makefile
Modified: head/www/gitea/Makefile
==============================================================================
--- head/www/gitea/Makefile Mon May 11 16:00:53 2020 (r534920)
+++ head/www/gitea/Makefile Mon May 11 16:52:28 2020 (r534921)
@@ -3,6 +3,7 @@
PORTNAME= gitea
DISTVERSIONPREFIX= v
DISTVERSION= 1.11.5
+PORTREVISION= 1
CATEGORIES= www
MASTER_SITES= https://github.com/go-gitea/gitea/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/
DISTNAME= gitea-src-${DISTVERSION}
Added: head/www/gitea/files/patch-vendor_github.com_go-git_go-git_v5_storage_filesystem_dotgit_dotgit.go
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/www/gitea/files/patch-vendor_github.com_go-git_go-git_v5_storage_filesystem_dotgit_dotgit.go Mon May 11 16:52:28 2020 (r534921)
@@ -0,0 +1,38 @@
+# This patch fixes a bug where attempting to view branches with a / in the name
+# would return an HTTP 500 Internal Server Error. The underlying issue ended up
+# being that go-git implicitly relied on read() of a dirfd to succeed, so for a
+# branch named "stable/11" it would stop and assume "stable" was the ref, but it
+# was really just a directory.
+
+# This patch was accepted upstream here:
+# https://github.com/go-git/go-git/pull/39
+# go-gitea is expected to merge it when go-git creates a new release for them to
+# import, and this patch can silently go away as soon as it conflicts.
+
+--- vendor/github.com/go-git/go-git/v5/storage/filesystem/dotgit/dotgit.go.orig 2020-04-01 17:02:04 UTC
++++ vendor/github.com/go-git/go-git/v5/storage/filesystem/dotgit/dotgit.go
+@@ -57,6 +57,9 @@ var (
+ // targeting a non-existing object. This usually means the repository
+ // is corrupt.
+ ErrSymRefTargetNotFound = errors.New("symbolic reference target not found")
++ // ErrIsDir is returned when a reference file is attempting to be read,
++ // but the path specified is a directory.
++ ErrIsDir = errors.New("reference path is a directory")
+ )
+
+ // Options holds configuration for the storage.
+@@ -926,6 +929,14 @@ func (d *DotGit) addRefFromHEAD(refs *[]*plumbing.Refe
+
+ func (d *DotGit) readReferenceFile(path, name string) (ref *plumbing.Reference, err error) {
+ path = d.fs.Join(path, d.fs.Join(strings.Split(name, "/")...))
++ st, err := d.fs.Stat(path)
++ if err != nil {
++ return nil, err
++ }
++ if st.IsDir() {
++ return nil, ErrIsDir
++ }
++
+ f, err := d.fs.Open(path)
+ if err != nil {
+ return nil, err
More information about the svn-ports-all
mailing list