From owner-svn-ports-all@freebsd.org Mon May 11 16:52:29 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8ADA2E5718; Mon, 11 May 2020 16:52:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49LRn94VMFz3HV2; Mon, 11 May 2020 16:52:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B38321942; Mon, 11 May 2020 16:52:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04BGqTB3070410; Mon, 11 May 2020 16:52:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04BGqTTw070407; Mon, 11 May 2020 16:52:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202005111652.04BGqTTw070407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 11 May 2020 16:52:29 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r534921 - in head/www/gitea: . files X-SVN-Group: ports-head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/www/gitea: . files X-SVN-Commit-Revision: 534921 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2020 16:52:29 -0000 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: (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