website/blog/atom.xml

782 lines
105 KiB
XML
Raw Normal View History

2022-09-06 13:34:25 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title> - Posts</title>
<link href="https://gna.org/blog/atom.xml" rel="self" type="application/atom+xml"/>
<link href="https://gna.org/blog/"/>
<generator uri="https://www.getzola.org/">Zola</generator>
2022-10-17 07:34:40 +00:00
<updated>2022-10-17T00:00:00+00:00</updated>
2022-09-06 13:34:25 +00:00
<id>https://gna.org/blog/atom.xml</id>
2022-10-17 07:34:40 +00:00
<entry xml:lang="en">
<title>[security] Gitea &lt; 1.17.3 git option injection explained</title>
<published>2022-10-17T00:00:00+00:00</published>
<updated>2022-10-17T00:00:00+00:00</updated>
<link href="https://gna.org/blog/1-17-3-git-security/" type="text/html"/>
<id>https://gna.org/blog/1-17-3-git-security/</id>
<content type="html">&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;pouet.chapril.org&#x2F;@gna&#x2F;109176306611564720&quot;&gt;Gitea 1.17.3&lt;&#x2F;a&gt; includes a &lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;forgefriends&#x2F;forgefriends&#x2F;-&#x2F;commit&#x2F;d98c5db58fdeded983bf5c0fe781fd7b77a1235f&quot;&gt;security patch&lt;&#x2F;a&gt; that prevents the injection of arguments to the git command run by Gitea.&lt;&#x2F;p&gt;
&lt;p&gt;When displaying the commit graph &lt;a href=&quot;https:&#x2F;&#x2F;gitea.gna.org&#x2F;Gna&#x2F;organization&#x2F;graph?branch=refs%2Fheads%2Fmaster&quot;&gt;for the master branch&lt;&#x2F;a&gt;, the URL contains the argument &lt;strong&gt;refs%2Fheads%2Fmaster&lt;&#x2F;strong&gt; that is passed to the &lt;code&gt;git&lt;&#x2F;code&gt; command with something like:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;shell&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-shell &quot;&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;git log --graph refs&#x2F;head&#x2F;master
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If, by accident or maliciously, the branch name with a dash, it would be mistaken to be a &lt;code&gt;git&lt;&#x2F;code&gt; argument instead of a branch name. For instance &lt;strong&gt;-h&lt;&#x2F;strong&gt; could be passed to the &lt;code&gt;git&lt;&#x2F;code&gt; command as:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;shell&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-shell &quot;&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;git log --graph -h
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In reality the &lt;code&gt;rev-list&lt;&#x2F;code&gt; command is called before &lt;code&gt;log&lt;&#x2F;code&gt; and in Gitea 1.17.2 the debug output will show something like:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;2022&#x2F;10&#x2F;17 07:17:17 ...s&#x2F;web&#x2F;repo&#x2F;commit.go:124:Graph() [W] [634d017d] GetCommitGraphsCount error for generate graph exclude prs: false branches: [-h] in 1:root&#x2F;test, Will Ignore branches and try again. Underlying Error: exit status 129 - usage: git rev-list [&amp;lt;options&amp;gt;] &amp;lt;commit-id&amp;gt;... [-- &amp;lt;path&amp;gt;...]
&lt;&#x2F;span&gt;&lt;span&gt;...
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In Gitea 1.17.3 when the same command is run, the option is discarded and the debug output shows something like:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;2022&#x2F;10&#x2F;17 07:25:05 ...dules&#x2F;git&#x2F;command.go:166:Run() [E] [634d0351] git command is broken: &#x2F;usr&#x2F;bin&#x2F;git -c protocol.version=2 -c uploadpack.allowfilter=true -c uploadpack.allowAnySHA1InWant=true -c credential.helper= rev-list --count, broken args: -h
&lt;&#x2F;span&gt;&lt;span&gt;2022&#x2F;10&#x2F;17 07:25:05 ...s&#x2F;web&#x2F;repo&#x2F;commit.go:124:Graph() [W] [634d0351] GetCommitGraphsCount error for generate graph exclude prs: false branches: [-h] in 1:root&#x2F;test, Will Ignore branches and try again. Underlying Error: git command is broken
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</content>
</entry>
2022-09-06 13:34:25 +00:00
<entry xml:lang="en">
<title>1.17 breaking changes episode 2: preserving a custom gitconfig</title>
<published>2022-07-20T00:00:00+00:00</published>
<updated>2022-07-20T00:00:00+00:00</updated>
<link href="https://gna.org/blog/1-17-breaking-episode-2/" type="text/html"/>
<id>https://gna.org/blog/1-17-breaking-episode-2/</id>
<content type="html">&lt;p&gt;On June 21st, 2022 1.17.0-rc1 was published and the location of the gitconfig file moved to a new location, &lt;a href=&quot;2022-06-23-1.17-breaking-episode-1&quot;&gt;which required manual intervention&lt;&#x2F;a&gt;. This change impacted a large number of Gitea installations because the docker image tag &lt;strong&gt;latest&lt;&#x2F;strong&gt; &lt;a href=&quot;https:&#x2F;&#x2F;mastodon.online&#x2F;@hostea&#x2F;108514134565401798&quot;&gt;was set to 1.17.0-rc1&lt;&#x2F;a&gt; by accident. As a result, about 10,000 pulls per hour from the docker hub got the release candidate instead of the expected stable version.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately moving the git home directory in 1.17.0-rc1 was implemented in way that created a security problem. The &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;20114&quot;&gt;fix that was merged in Gitea&lt;&#x2F;a&gt; to fix it requires moving the gitconfig file and was released July 19th, 2022 in 1.17.0-rc2.&lt;&#x2F;p&gt;
&lt;p&gt;This would have been a minor inconvenience if it only has an impact on adventurous people trying the release candidate in a test environment. But since all Gitea production installations based on the &lt;strong&gt;latest&lt;&#x2F;strong&gt; tag were inadvertently upgraded to 1.17.0-rc1, the admins who moved their custom .gitconfig will need to move it one more time when upgrading to 1.17.0-rc2.&lt;&#x2F;p&gt;
&lt;p&gt;In 1.17.0-rc2, a custom .gitconfig must be moved manually to the &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;config-cheat-sheet&#x2F;#git-git&quot;&gt;new git home directory&lt;&#x2F;a&gt; as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Figure out the directory where &lt;code&gt;$HOME&#x2F;.gitconfig&lt;&#x2F;code&gt; must be moved by &lt;a href=&quot;https:&#x2F;&#x2F;gna.org&#x2F;blog&#x2F;gentle-introduction-to-the-doctor&#x2F;&quot;&gt;running the doctor&lt;&#x2F;a&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;shell&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-shell &quot;&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;$ gitea --work-path &#x2F;app&#x2F;gitea -c &#x2F;data&#x2F;gitea&#x2F;conf&#x2F;app.ini doctor
&lt;&#x2F;span&gt;&lt;span&gt;[1] Check paths and basic configuration
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Configuration File Path: &amp;quot;&#x2F;data&#x2F;gitea&#x2F;conf&#x2F;app.ini&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Repository Root Path: &amp;quot;&#x2F;data&#x2F;git&#x2F;repositories&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Data Root Path: &amp;quot;&#x2F;data&#x2F;gitea&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Custom File Root Path: &amp;quot;&#x2F;data&#x2F;gitea&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Work directory: &amp;quot;&#x2F;app&#x2F;gitea&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Log Root Path: &amp;quot;&#x2F;data&#x2F;gitea&#x2F;log&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;OK
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Copy the &lt;code&gt;$HOME&#x2F;.gitconfig&lt;&#x2F;code&gt; file to the &lt;strong&gt;Data Root Path&lt;&#x2F;strong&gt;&#x2F;home (which is &lt;code&gt;&#x2F;data&#x2F;gitea&#x2F;home&lt;&#x2F;code&gt; in the example above).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
</entry>
<entry xml:lang="en">
<title>Get a Gitea instance with CI at Gna!</title>
<published>2022-07-10T00:00:00+00:00</published>
<updated>2022-07-10T00:00:00+00:00</updated>
<link href="https://gna.org/blog/experimental/" type="text/html"/>
<id>https://gna.org/blog/experimental/</id>
<content type="html">&lt;p&gt;Hosting a Gitea instance on Gna! is now possible (but still experimental). It is meant to be a minimum viable product: anyone can &lt;a href=&quot;https:&#x2F;&#x2F;hosteadashboard.gna.org&quot;&gt;create a new dedicated Gitea instance&lt;&#x2F;a&gt; within minutes and pay for it on a monthly basis with a credit card. It includes a dedicated CI based on &lt;a href=&quot;https:&#x2F;&#x2F;woodpecker-ci.org&#x2F;&quot;&gt;Woodpecker&lt;&#x2F;a&gt;. The smallest instance costs 10€ per month (2GB RAM, 10GB disk, 1CPU) and will be a good fit for a freelance up to a team of five people but bigger instances are also available if more RAM, CPU or disk is required.&lt;&#x2F;p&gt;
&lt;video width=&quot;600&quot; controls&gt;
&lt;source src=&quot;https:&#x2F;&#x2F;cloud.forgefriends.org&#x2F;s&#x2F;xXLcYpsE469tJEj&#x2F;download?path=&amp;files=hostea-screencast-vm-create.mp4&quot; type=&quot;video&#x2F;mp4&quot; &#x2F;&gt;
&lt;&#x2F;video&gt;
&lt;p&gt;The service is 100% infrastructure as code, published as &lt;a href=&quot;https:&#x2F;&#x2F;lab.enough.community&#x2F;main&#x2F;infrastructure&#x2F;-&#x2F;tree&#x2F;9e18ebbf675c8a65d1585d20b4cf6295af6e52ed&#x2F;playbooks&#x2F;hosteadashboard&quot;&gt;Ansible playbooks within Enough&lt;&#x2F;a&gt;. It can be self-hosted on bare metal (with &lt;a href=&quot;https:&#x2F;&#x2F;libvirt.org&#x2F;&quot;&gt;libvirt&lt;&#x2F;a&gt;) or in the cloud (with &lt;a href=&quot;https:&#x2F;&#x2F;www.openstack.org&#x2F;&quot;&gt;OpenStack&lt;&#x2F;a&gt;): follow the &lt;a href=&quot;https:&#x2F;&#x2F;enough-community.readthedocs.io&#x2F;en&#x2F;latest&#x2F;introduction.html#quick-start&quot;&gt;quick start&lt;&#x2F;a&gt;, configure playbooks for &lt;a href=&quot;https:&#x2F;&#x2F;enough-community.readthedocs.io&#x2F;en&#x2F;latest&#x2F;services&#x2F;hostea.html&quot;&gt;hostea&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;enough-community.readthedocs.io&#x2F;en&#x2F;latest&#x2F;services&#x2F;hosteadashboard.html&quot;&gt;the dashboard&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
2022-09-06 15:18:20 +00:00
&lt;p&gt;The organization supporting Gna! is a &lt;a href=&quot;https:&#x2F;&#x2F;forum.gna.org&#x2F;c&#x2F;governance-and-decisions&#x2F;7&quot;&gt;horizontal collective&lt;&#x2F;a&gt; of individuals and organizations. The &lt;a href=&quot;https:&#x2F;&#x2F;forum.gna.org&#x2F;t&#x2F;decision-revenue-sharing-model&#x2F;92&quot;&gt;revenue sharing model&lt;&#x2F;a&gt; is set to dedicate 25% of the income (more than the profits) to help the Free Software projects Hostea depends on such as Gitea, Enough, Django etc.&lt;&#x2F;p&gt;
2022-09-06 13:34:25 +00:00
&lt;h3 id=&quot;the-origin&quot;&gt;The origin&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-origin&quot; aria-label=&quot;Anchor link for: the-origin&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;In February 2022 the project of running a dedicated Gitea hosting service was &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;a-gitea-hosting-service-under-the-umbrella-of-the-gitea-project&#x2F;4692&quot;&gt;proposed to the Gitea project&lt;&#x2F;a&gt; and other organizations and &lt;a href=&quot;https:&#x2F;&#x2F;blog.dachary.org&#x2F;2022&#x2F;02&#x2F;16&#x2F;project-plans-for-a-hosted-gitea-online-service&#x2F;&quot;&gt;plans were drafted&lt;&#x2F;a&gt;. After a month of discussions it turned out to not be a &lt;a href=&quot;https:&#x2F;&#x2F;blog.dachary.org&#x2F;2022&#x2F;03&#x2F;11&#x2F;the-inconclusive-story-of-four-failed-project-offers&#x2F;&quot;&gt;good match for any of them&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It was suggested to create a new project from scratch instead of joining an existing organization. However, in order to be sustainable, a hosting service needs customers willing to pay for the service. And nobody had that kind of skill. It was therefore decided that to terminate the project: there is no point is creating a technical stack that&#x27;s not going to be used by anyone.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-technical-stack-with-no-users&quot;&gt;A technical stack with no users&lt;a class=&quot;zola-anchor&quot; href=&quot;#a-technical-stack-with-no-users&quot; aria-label=&quot;Anchor link for: a-technical-stack-with-no-users&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;The most common mistake technical people do when creating a new piece of software is to overlook the fact that they have absolutely no idea how to let their intended user base know about it. Maybe the reason it happens so often is because it is very difficult to resist the urge of creating something. Because that&#x27;s what technical people love to do: create things, even when they have no clue if it can be used.&lt;&#x2F;p&gt;
&lt;p&gt;It took no longer than two weeks for the people involved in Gna! to decide to build the technical stack to run hostea instead of being reasonable and give up. It was just too tempting.&lt;&#x2F;p&gt;
&lt;p&gt;To keep the madness contained and enjoyable, it was decided to set a deadline to July 1st and to &lt;a href=&quot;https:&#x2F;&#x2F;gitea.gna.org&#x2F;Hostea&#x2F;july-mvp&#x2F;issues&quot;&gt;define precise and realistic technical goals&lt;&#x2F;a&gt;. It turned out to be an enjoyable experience: everyone learned a lot in the process and the outcome is something that can be reproduced. Most MVPs are a brittle pile of hacks designed to last a few weeks and be thrown away. But since a primary goal of the project was to create something self-hostable, it had to implement that feature and therefore be reproducible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-horizontal-collective-with-a-revenue-sharing-model&quot;&gt;A horizontal collective with a revenue sharing model&lt;a class=&quot;zola-anchor&quot; href=&quot;#a-horizontal-collective-with-a-revenue-sharing-model&quot; aria-label=&quot;Anchor link for: a-horizontal-collective-with-a-revenue-sharing-model&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
2022-09-06 15:18:20 +00:00
&lt;p&gt;Another goal of Gna! is to deploy federated forges, even at an experimental stage. Instead of creating a centralized organization to support Gna!, it was decided to create &lt;a href=&quot;https:&#x2F;&#x2F;forum.gna.org&#x2F;c&#x2F;governance-and-decisions&#x2F;7&quot;&gt;horizontal collective&lt;&#x2F;a&gt;. It feels like a contradiction for a project committed to decentralization to be governed by a centralized organization.&lt;&#x2F;p&gt;
2022-09-06 13:34:25 +00:00
&lt;p&gt;The collective is composed of individuals and organizations but, unlike exclusively volunteer based Free Software projects, it is for profit. Customers rent Gitea instances by the month and the income is used to pay for expenses. There is however a difficulty: by nature a horizontal collective cannot be incorporated as it would create a level of hierarchy. The &lt;a href=&quot;https:&#x2F;&#x2F;forum.gna.org&#x2F;t&#x2F;decision-revenue-sharing-model&#x2F;92&quot;&gt;revenue sharing model&lt;&#x2F;a&gt; had to be set as an informal agreement between members where one of them receives the income and distributes it to the others, depending on their Gna! related expenses.&lt;&#x2F;p&gt;
&lt;p&gt;It also requires that 25% of the income (not the profits) is dedicated to help the Free Software projects that Gna! depends on such as Gitea, Enough, Django etc. It can be via a donation, by upstreaming a bug fix or any kind of work that is beneficial to the dependency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dedicated-to-forge-federation&quot;&gt;Dedicated to forge federation&lt;a class=&quot;zola-anchor&quot; href=&quot;#dedicated-to-forge-federation&quot; aria-label=&quot;Anchor link for: dedicated-to-forge-federation&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;In the spirit of dogfooding, the people who created the technical stack of Gna! will use it for themselves on a daily basis. Since the focus of the authors is on &lt;a href=&quot;https:&#x2F;&#x2F;forgefriends.org&#x2F;blog&#x2F;2022&#x2F;06&#x2F;30&#x2F;2022-06-state-forge-federation&#x2F;&quot;&gt;forge federation&lt;&#x2F;a&gt;, they will add federation support in Hostea. This will be their primary motivation to improve and maintain Hostea: it is the only hosting platform where this can happen.&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>1.17 breaking changes episode 1: preserving a custom gitconfig</title>
<published>2022-06-22T00:00:00+00:00</published>
<updated>2022-06-22T00:00:00+00:00</updated>
<link href="https://gna.org/blog/1-17-breaking-episode-1/" type="text/html"/>
<id>https://gna.org/blog/1-17-breaking-episode-1/</id>
<content type="html">&lt;p&gt;Before version 1.17, when Gitea needed to change the &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-config&quot;&gt;git configuration&lt;&#x2F;a&gt;, it modified the &lt;code&gt;$HOME&#x2F;.gitconfig&lt;&#x2F;code&gt; file. For instance it would &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;release&#x2F;v1.16&#x2F;modules&#x2F;git&#x2F;git.go#L174-L177&quot;&gt;set core.quotePath to false&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;ini&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-ini &quot;&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[core]
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;quotePath &lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#d08770;&quot;&gt;false
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When installing Gitea &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-with-docker&#x2F;&quot;&gt;from docker&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-with-docker-rootless&#x2F;&quot;&gt;rootless&lt;&#x2F;a&gt; or even &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-from-binary&#x2F;&quot;&gt;from binary&lt;&#x2F;a&gt; this &lt;code&gt;$HOME&#x2F;.gitconfig&lt;&#x2F;code&gt; file belongs to a user that is &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-from-binary&#x2F;#prepare-environment&quot;&gt;dedicated to Gitea&lt;&#x2F;a&gt; and not used by anyone else.&lt;&#x2F;p&gt;
&lt;p&gt;However, if an Gitea installation was done differently and &lt;code&gt;$HOME&#x2F;.gitconfig&lt;&#x2F;code&gt; has been customized because it is shared by a user or another application, there is a good chance that manual modifications were done such as:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;ini&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-ini &quot;&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[user]
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;name &lt;&#x2F;span&gt;&lt;span&gt;= Jane Doe
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;email &lt;&#x2F;span&gt;&lt;span&gt;= jane&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;@doe&lt;&#x2F;span&gt;&lt;span&gt;.com
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It is also possible that the file was modified manually by the Gitea admin for other reasons. In both there is a &lt;strong&gt;potential for breakage when upgrading to Gitea &amp;gt;= 1.17 because the location of the file changed&lt;&#x2F;strong&gt;. It must be moved manually to the new location as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Figure out the directory where &lt;code&gt;$HOME&#x2F;.gitconfig&lt;&#x2F;code&gt; must be moved by &lt;a href=&quot;https:&#x2F;&#x2F;gna.org&#x2F;blog&#x2F;gentle-introduction-to-the-doctor&#x2F;&quot;&gt;running the doctor&lt;&#x2F;a&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;shell&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-shell &quot;&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;$ gitea --work-path &#x2F;app&#x2F;gitea -c &#x2F;data&#x2F;gitea&#x2F;conf&#x2F;app.ini doctor
&lt;&#x2F;span&gt;&lt;span&gt;[1] Check paths and basic configuration
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Configuration File Path: &amp;quot;&#x2F;data&#x2F;gitea&#x2F;conf&#x2F;app.ini&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Repository Root Path: &amp;quot;&#x2F;data&#x2F;git&#x2F;repositories&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Data Root Path: &amp;quot;&#x2F;data&#x2F;gitea&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Custom File Root Path: &amp;quot;&#x2F;data&#x2F;gitea&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Work directory: &amp;quot;&#x2F;app&#x2F;gitea&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; - [I] Log Root Path: &amp;quot;&#x2F;data&#x2F;gitea&#x2F;log&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;OK
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Copy the &lt;code&gt;$HOME&#x2F;.gitconfig&lt;&#x2F;code&gt; file to the &lt;strong&gt;Repository Root Path&lt;&#x2F;strong&gt; (which is &lt;code&gt;&#x2F;data&#x2F;git&#x2F;repositories&lt;&#x2F;code&gt; in the example above).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The reason why this breaking change was introduced is to workaround &lt;a href=&quot;https:&#x2F;&#x2F;gna.org&#x2F;blog&#x2F;unsafe-repository-is-owned-by-someone-else&#x2F;&quot;&gt;a rare problem&lt;&#x2F;a&gt; impacting Gitea installations relying on networked volumes.&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>[tutorial] A gentle introduction to the gitea doctor</title>
<published>2022-06-14T00:00:00+00:00</published>
<updated>2022-06-14T00:00:00+00:00</updated>
<link href="https://gna.org/blog/gentle-introduction-to-the-doctor/" type="text/html"/>
<id>https://gna.org/blog/gentle-introduction-to-the-doctor/</id>
<content type="html">&lt;p&gt;While helping people with their upgrades &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;migration-from-1-2-to-1-16-8&#x2F;5309&quot;&gt;in the Gitea forum&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;forum.gna.org&#x2F;t&#x2F;gitea-upgrade-from-1-14-1-to-1-16-8&#x2F;90&quot;&gt;at the Gna! clinic&lt;&#x2F;a&gt;, I realized that few Gitea admins know about the &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;command-line&#x2F;#doctor&quot;&gt;&lt;code&gt;gitea doctor&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; command and decided to write this blog post as a gentle introduction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;an-apple-a-day-keeps-the-doctor-away&quot;&gt;An apple a day keeps the doctor away&lt;a class=&quot;zola-anchor&quot; href=&quot;#an-apple-a-day-keeps-the-doctor-away&quot; aria-label=&quot;Anchor link for: an-apple-a-day-keeps-the-doctor-away&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;Or in our case, Gitea versions &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;v1.11.5&#x2F;cmd&#x2F;doctor.go&quot;&gt;below 1.11.5&lt;&#x2F;a&gt;. Since then, the &lt;code&gt;gitea doctor&lt;&#x2F;code&gt; is available and is designed to run against a specific Gitea version. It would not be a good idea to try to run the doctor from Gitea 1.16 to verify the sanity of a Gitea 1.2 instance: it will be confused by how the database is organized and a number of other details. Historical fun fact: the &lt;code&gt;gitea doctor&lt;&#x2F;code&gt; was backported to &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;v1.10.5&#x2F;cmd&#x2F;doctor.go&quot;&gt;Gitea 1.10.5&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;v1.10.6&#x2F;cmd&#x2F;doctor.go&quot;&gt;Gitea 1.10.6&lt;&#x2F;a&gt; and may be of help if you run this particular version and are facing the problem that motivated the backport.&lt;&#x2F;p&gt;
&lt;p&gt;With each version &lt;code&gt;gitea doctor&lt;&#x2F;code&gt; improves and gains new capabilities. For instance, in Gitea 1.17 it becomes aware of &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19731&quot;&gt;orphaned pull requests&lt;&#x2F;a&gt; and is able to fix them. If such a problem exists in Gitea 1.16, it does not know about it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calling-the-doctor&quot;&gt;Calling the doctor&lt;a class=&quot;zola-anchor&quot; href=&quot;#calling-the-doctor&quot; aria-label=&quot;Anchor link for: calling-the-doctor&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;In the following, examples are based on a Gitea 1.16.8 instance you can run as follows:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker run&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --name&lt;&#x2F;span&gt;&lt;span&gt; gitea&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -p&lt;&#x2F;span&gt;&lt;span&gt; 3000:3000&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -e&lt;&#x2F;span&gt;&lt;span&gt; GITEA__security__INSTALL_LOCK=true&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -d&lt;&#x2F;span&gt;&lt;span&gt; gitea&#x2F;gitea:1.16.8-rootless
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea gitea admin user create&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --admin --username&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --password&lt;&#x2F;span&gt;&lt;span&gt; admin1234&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --email&lt;&#x2F;span&gt;&lt;span&gt; root@example.com
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea mkdir &#x2F;var&#x2F;lib&#x2F;gitea&#x2F;data&#x2F;log
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And then you can go to the &lt;a href=&quot;https:&#x2F;&#x2F;127.0.0.1:3000&#x2F;&quot;&gt;web interface&lt;&#x2F;a&gt; to create a &lt;code&gt;test&lt;&#x2F;code&gt; repository, with an initial &lt;code&gt;README.md&lt;&#x2F;code&gt; file. When this is done the doctor can be called as follows:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea gitea doctor&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --all
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[1]&lt;&#x2F;span&gt;&lt;span&gt; Check paths and basic configuration
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Configuration File Path: &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;&#x2F;etc&#x2F;gitea&#x2F;app.ini&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Repository Root Path: &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;&#x2F;var&#x2F;lib&#x2F;gitea&#x2F;git&#x2F;repositories&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Data Root Path: &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;&#x2F;var&#x2F;lib&#x2F;gitea&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Custom File Root Path: &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;&#x2F;var&#x2F;lib&#x2F;gitea&#x2F;custom&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Work directory: &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;&#x2F;var&#x2F;lib&#x2F;gitea&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Log Root Path: &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#a3be8c;&quot;&gt;&#x2F;var&#x2F;lib&#x2F;gitea&#x2F;data&#x2F;log&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[2]&lt;&#x2F;span&gt;&lt;span&gt; Check if there is garbage storage files
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[3]&lt;&#x2F;span&gt;&lt;span&gt; Check Database Version
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[4]&lt;&#x2F;span&gt;&lt;span&gt; Check consistency of database
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[5]&lt;&#x2F;span&gt;&lt;span&gt; Check if user with wrong type exist
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[6]&lt;&#x2F;span&gt;&lt;span&gt; Check if OpenSSH authorized_keys file is up-to-date
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[7]&lt;&#x2F;span&gt;&lt;span&gt; Check if SCRIPT_TYPE is available
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; ScriptType bash is on the current PATH at &#x2F;bin&#x2F;bash
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[8]&lt;&#x2F;span&gt;&lt;span&gt; Check if hook files are up-to-date and executable
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[9]&lt;&#x2F;span&gt;&lt;span&gt; Recalculate Stars number for all user
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[10]&lt;&#x2F;span&gt;&lt;span&gt; Check old archives
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; 0 old archives in repository need to be deleted
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[11]&lt;&#x2F;span&gt;&lt;span&gt; Enable push options
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Checked 1 repositories, 0 need updates.
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[12]&lt;&#x2F;span&gt;&lt;span&gt; Check for incorrectly dumped repo_units (See &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;#16961)
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;W&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Found 0 broken repo_units
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[13]&lt;&#x2F;span&gt;&lt;span&gt; Recalculate merge bases
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;W&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; 0 PRs with incorrect mergebases of 0 PRs total in 1 repos
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[14]&lt;&#x2F;span&gt;&lt;span&gt; Check git-daemon-export-ok files
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;I&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Checked 1 repositories, 0 need updates.
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;what-does-the-doctor-know&quot;&gt;What does the doctor know?&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-does-the-doctor-know&quot; aria-label=&quot;Anchor link for: what-does-the-doctor-know&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;Although the &lt;code&gt;doctor&lt;&#x2F;code&gt; can be compared to &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fsck&quot;&gt;fsck(8)&lt;&#x2F;a&gt;, it does not know everything. It took decades for &lt;code&gt;fsck&lt;&#x2F;code&gt; to become the ultimate authority on finding problems on file systems and reliably fixing them without losing data. Nowadays, only a handful of people in the world are brave enough to manually attempt a file system recovery when &lt;code&gt;fsck&lt;&#x2F;code&gt; cannot recover from a data loss.&lt;&#x2F;p&gt;
&lt;p&gt;The first &lt;code&gt;doctor&lt;&#x2F;code&gt; version is two years old and Gitea admins are still routinely running SQL queries against the database or moving files around when trying to figure out why a Gitea instance is not behaving as it should. It is however worth checking if the doctor does not already have a solution by listing all it can do:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea gitea doctor&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --list
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;Default&lt;&#x2F;span&gt;&lt;span&gt; Name Title
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; paths Check paths and basic configuration
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;storages&lt;&#x2F;span&gt;&lt;span&gt; Check if there is garbage storage files
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; check-db-version Check Database Version
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;check-db-consistency&lt;&#x2F;span&gt;&lt;span&gt; Check consistency of database
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; check-user-type Check if user with wrong type exist
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; authorized-keys Check if OpenSSH authorized_keys file is up-to-date
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;script-type&lt;&#x2F;span&gt;&lt;span&gt; Check if SCRIPT_TYPE is available
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;hooks&lt;&#x2F;span&gt;&lt;span&gt; Check if hook files are up-to-date and executable
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;recalculate-stars-number&lt;&#x2F;span&gt;&lt;span&gt; Recalculate Stars number for all user
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;check-old-archives&lt;&#x2F;span&gt;&lt;span&gt; Check old archives
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;enable-push-options&lt;&#x2F;span&gt;&lt;span&gt; Enable push options
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;fix-broken-repo-units&lt;&#x2F;span&gt;&lt;span&gt; Check for incorrectly dumped repo_units (See &lt;&#x2F;span&gt;&lt;span style=&quot;color:#65737e;&quot;&gt;#16961)
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;recalculate-merge-bases&lt;&#x2F;span&gt;&lt;span&gt; Recalculate merge bases
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;check-git-daemon-export-ok&lt;&#x2F;span&gt;&lt;span&gt; Check git-daemon-export-ok files
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And then call the &lt;code&gt;check&lt;&#x2F;code&gt; that looks interesting:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea gitea doctor&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --run&lt;&#x2F;span&gt;&lt;span&gt; authorized-keys
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[1]&lt;&#x2F;span&gt;&lt;span&gt; Check if OpenSSH authorized_keys file is up-to-date
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The challenge is to figure out which &lt;code&gt;check&lt;&#x2F;code&gt; does what and at the moment the best source of information is ... &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;tree&#x2F;v1.16.8&quot;&gt;the sources&lt;&#x2F;a&gt; themselves. The &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;v1.16.8&#x2F;cmd&#x2F;doctor.go&quot;&gt;doctor.go&lt;&#x2F;a&gt; command is the entry point and &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;tree&#x2F;v1.16.8&#x2F;modules&#x2F;doctor&quot;&gt;the doctor directory&lt;&#x2F;a&gt; contains the rest.&lt;&#x2F;p&gt;
&lt;p&gt;Some &lt;code&gt;checks&lt;&#x2F;code&gt; are straightforward to understand, even if you do not know Go, such as &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;v1.16.8&#x2F;modules&#x2F;doctor&#x2F;authorizedkeys.go&quot;&gt;the authorized-keys check&lt;&#x2F;a&gt;. Others are much more involved and your best chance is to &lt;a href=&quot;https:&#x2F;&#x2F;matrix.to&#x2F;#&#x2F;#gitea:matrix.org&quot;&gt;ask the Gitea chatroom&lt;&#x2F;a&gt; for help.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;is-it-going-to-hurt&quot;&gt;Is it going to hurt?&lt;a class=&quot;zola-anchor&quot; href=&quot;#is-it-going-to-hurt&quot; aria-label=&quot;Anchor link for: is-it-going-to-hurt&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;By default the doctor (very much like &lt;code&gt;fsck -N&lt;&#x2F;code&gt;) only performs non destructive checks and displays diagnostics, with an indication of how serious the problem is. In the example above, there only are lines with &lt;strong&gt;[I]&lt;&#x2F;strong&gt; (which indicates an information) and &lt;strong&gt;[W]&lt;&#x2F;strong&gt; which indicates a warning that can be ignored but may be worth looking into. Those two warnings are actually just informational and should be labelled as &lt;strong&gt;[I]&lt;&#x2F;strong&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19836&quot;&gt;which has been fixed&lt;&#x2F;a&gt; in a more recent version of the doctor.&lt;&#x2F;p&gt;
&lt;p&gt;Now let&#x27;s do something bad: remove the permissions from a hook in our repository:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea chmod&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; -x&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;var&#x2F;lib&#x2F;gitea&#x2F;git&#x2F;repositories&#x2F;root&#x2F;test.git&#x2F;hooks&#x2F;post-receive
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Run the doctor with the &lt;code&gt;check&lt;&#x2F;code&gt; supposed to find that out:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea gitea doctor&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --run&lt;&#x2F;span&gt;&lt;span&gt; hooks
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[1]&lt;&#x2F;span&gt;&lt;span&gt; Check if hook files are up-to-date and executable
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;W&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; old hook file &#x2F;var&#x2F;lib&#x2F;gitea&#x2F;git&#x2F;repositories&#x2F;root&#x2F;test.git&#x2F;hooks&#x2F;post-receive is not executable
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Ask it to fix this with the &lt;code&gt;--fix&lt;&#x2F;code&gt; flag:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea gitea doctor&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --run&lt;&#x2F;span&gt;&lt;span&gt; hooks&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --fix
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[1]&lt;&#x2F;span&gt;&lt;span&gt; Check if hook files are up-to-date and executable
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;W&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; Regenerated hooks for root&#x2F;test
&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;W&lt;&#x2F;span&gt;&lt;span style=&quot;color:#b48ead;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span&gt; old hook file &#x2F;var&#x2F;lib&#x2F;gitea&#x2F;git&#x2F;repositories&#x2F;root&#x2F;test.git&#x2F;hooks&#x2F;post-receive is not executable
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And run it one last time to check all is well:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#2b303b;color:#c0c5ce;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt; docker exec gitea gitea doctor&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt; --run&lt;&#x2F;span&gt;&lt;span&gt; hooks
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;[1]&lt;&#x2F;span&gt;&lt;span&gt; Check if hook files are up-to-date and executable
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#bf616a;&quot;&gt;OK
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Even when the doctor is unable to fix a problem, it can help by showing extensive debug output which can be found, by default, in the &lt;code&gt;doctor.log&lt;&#x2F;code&gt; file in the directory from which it runs. Or it can be displayed on the standard output with &lt;code&gt;--log-file -&lt;&#x2F;code&gt;, which is most convenient when running in docker.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;going-further&quot;&gt;Going further&lt;a class=&quot;zola-anchor&quot; href=&quot;#going-further&quot; aria-label=&quot;Anchor link for: going-further&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;If that was helpful to you, I would very much appreciate if you &lt;a href=&quot;https:&#x2F;&#x2F;mastodon.online&#x2F;@dachary&quot;&gt;send me a message on Mastodon&lt;&#x2F;a&gt;. It will encourage me to write more blog posts to share what I learn about Gitea. Even better: you could &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pulls&quot;&gt;send a pull request&lt;&#x2F;a&gt; to improve the doctor and help it mature.&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>[solved] Zombies created by Gitea</title>
<published>2022-06-04T00:00:00+00:00</published>
<updated>2022-06-04T00:00:00+00:00</updated>
<link href="https://gna.org/blog/zombies-part-2/" type="text/html"/>
<id>https://gna.org/blog/zombies-part-2/</id>
<content type="html">&lt;p&gt;Gitea can &lt;a href=&quot;&#x2F;blog&#x2F;zombies&quot;&gt;create zombies&lt;&#x2F;a&gt;, for instance if a Git mirror takes too long. When updating a mirror, Gitea relies on the &lt;code&gt;git remote update&lt;&#x2F;code&gt; command which creates a child process, &lt;code&gt;git-remote-https&lt;&#x2F;code&gt;, to fetch data from the remote repository. Gitea has an internal timeout that will kill the child process (e.g. &lt;code&gt;git remote update&lt;&#x2F;code&gt;) when it takes too long but will not kill the grandchild. This grandchild will become an orphan and run forever or until its own timeout expires, which is about two minutes on git version 2.25.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;$ time git clone https:&#x2F;&#x2F;4.4.4.4
&lt;&#x2F;span&gt;&lt;span&gt;Clonage dans &amp;#39;4.4.4.4&amp;#39;...
&lt;&#x2F;span&gt;&lt;span&gt;fatal: impossible d&amp;#39;accéder à &amp;#39;https:&#x2F;&#x2F;4.4.4.4&#x2F;&amp;#39;: Failed to connect to 4.4.4.4 port 443: Connexion terminée par expiration du délai d&amp;#39;attente
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;real 2m9,753s
&lt;&#x2F;span&gt;&lt;span&gt;user 0m0,001s
&lt;&#x2F;span&gt;&lt;span&gt;sys 0m0,009s
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As explained in the &lt;a href=&quot;&#x2F;blog&#x2F;zombies&#x2F;#killing-a-child-process-and-all-its-children&quot;&gt;diagnostic blog post regarding Gitea zombies&lt;&#x2F;a&gt; there fortunately is a very simple way to avoid this by making sure each Gitea child is a &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Process_group&quot;&gt;process group leader&lt;&#x2F;a&gt;. That first step was &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19865&quot;&gt;introduced in Gitea 1.17&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19865&quot;&gt;backported to Gitea 1.16.9&lt;&#x2F;a&gt;. The actual bug fix can now be implemented.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-negative-process-id-to-kill-children&quot;&gt;Using negative process id to kill children&lt;a class=&quot;zola-anchor&quot; href=&quot;#using-negative-process-id-to-kill-children&quot; aria-label=&quot;Anchor link for: using-negative-process-id-to-kill-children&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;When Gitea timeout on a child, it relies on &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;blob&#x2F;f8a53df314e4af8cd350eedb0dae77d4c4fc30d0&#x2F;src&#x2F;os&#x2F;exec&#x2F;exec.go#L650&quot;&gt;os.Process.Kill&lt;&#x2F;a&gt; which translates into a using the kill(2) system call to send a SIGKILL signal to unconditionally terminate it: &lt;code&gt;kill(pid, SIGKILL)&lt;&#x2F;code&gt;. Using a negative pid with &lt;code&gt;kill(-pid, SIGKILL)&lt;&#x2F;code&gt; will also terminate all processes created by Gitea&#x27;s child, without Gitea knowing when or why they were created. From the kill(2) manual page:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;If pid is less than -1, then sig is sent to every process in the process group whose ID is -pid.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Which is implemented as follows in the &lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;friendlyforgeformat&#x2F;gofff&#x2F;-&#x2F;blob&#x2F;a9603c7cc934fccd4382b7f4309b75c852742480&#x2F;util&#x2F;exec.go#L130&quot;&gt;Friendly Forge Format library&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;not-using-the-default-go-commandcontext&quot;&gt;Not using the default Go CommandContext&lt;a class=&quot;zola-anchor&quot; href=&quot;#not-using-the-default-go-commandcontext&quot; aria-label=&quot;Anchor link for: not-using-the-default-go-commandcontext&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;Since &lt;a href=&quot;https:&#x2F;&#x2F;pkg.go.dev&#x2F;os&#x2F;exec#CommandContext&quot;&gt;CommandContext&lt;&#x2F;a&gt; does not allow to send a signal to the negative pid of the child process, it has to be implemented by Gitea itself, in a way that is similar to how the &lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;friendlyforgeformat&#x2F;gofff&#x2F;-&#x2F;blob&#x2F;a9603c7cc934fccd4382b7f4309b75c852742480&#x2F;util&#x2F;exec.go#L75-82&quot;&gt;Friendly Forge Format library&lt;&#x2F;a&gt; does it:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt; ctxErr := watchCtx(ctx, cmd.Process.Pid)
&lt;&#x2F;span&gt;&lt;span&gt; err = cmd.Wait()
&lt;&#x2F;span&gt;&lt;span&gt; interruptErr := &amp;lt;-ctxErr
&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;&#x2F; If cmd.Wait returned an error, prefer that.
&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;&#x2F; Otherwise, report any error from the interrupt goroutine.
&lt;&#x2F;span&gt;&lt;span&gt; if interruptErr != nil &amp;amp;&amp;amp; err == nil {
&lt;&#x2F;span&gt;&lt;span&gt; err = interruptErr
&lt;&#x2F;span&gt;&lt;span&gt; }
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;testing-the-bug-is-fixed-and-stays-fixed&quot;&gt;Testing the bug is fixed and stays fixed&lt;a class=&quot;zola-anchor&quot; href=&quot;#testing-the-bug-is-fixed-and-stays-fixed&quot; aria-label=&quot;Anchor link for: testing-the-bug-is-fixed-and-stays-fixed&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;Long standing bugs that are difficult to reproduce manually such as this one require robust testing to ensure that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the diagnostic identifying the root cause is correct&lt;&#x2F;li&gt;
&lt;li&gt;the bug fix works&lt;&#x2F;li&gt;
&lt;li&gt;it does not resurface insidiously because of a subtle regression introduce years later&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is easy to implement as can be seen in the &lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;friendlyforgeformat&#x2F;gofff&#x2F;-&#x2F;blob&#x2F;a9603c7cc934fccd4382b7f4309b75c852742480&#x2F;util&#x2F;exec_test.go#L44-76&quot;&gt;Friendly Forge Format library&lt;&#x2F;a&gt;. In a nutshell:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;friendlyforgeformat&#x2F;gofff&#x2F;-&#x2F;blob&#x2F;a9603c7cc934fccd4382b7f4309b75c852742480&#x2F;util&#x2F;exec_test.go#L53&quot;&gt;git clone https:&#x2F;&#x2F;4.4.4.4&lt;&#x2F;a&gt; which will hang because of firewall rules&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;friendlyforgeformat&#x2F;gofff&#x2F;-&#x2F;blob&#x2F;a9603c7cc934fccd4382b7f4309b75c852742480&#x2F;util&#x2F;exec_test.go#L60-65&quot;&gt;wait for the git-remote-https&lt;&#x2F;a&gt; grandchild process to be spawned&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;friendlyforgeformat&#x2F;gofff&#x2F;-&#x2F;blob&#x2F;a9603c7cc934fccd4382b7f4309b75c852742480&#x2F;util&#x2F;exec_test.go#L67-68&quot;&gt;cancel the context and wait for the goroutine to terminate&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;friendlyforgeformat&#x2F;gofff&#x2F;-&#x2F;blob&#x2F;a9603c7cc934fccd4382b7f4309b75c852742480&#x2F;util&#x2F;exec_test.go#L70-75&quot;&gt;verify the git-remote-https is killed&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;And with that... no more zombies!&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>[diagnostic] Zombies created by Gitea</title>
<published>2022-06-02T00:00:00+00:00</published>
<updated>2022-06-02T00:00:00+00:00</updated>
<link href="https://gna.org/blog/zombies/" type="text/html"/>
<id>https://gna.org/blog/zombies/</id>
<content type="html">&lt;p&gt;The first &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;issues&#x2F;3242&quot;&gt;issue about zombie processes&lt;&#x2F;a&gt; created by Gitea was reported in 2017 and &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;issues&#x2F;13987&quot;&gt;resurfaced&lt;&#x2F;a&gt; on a &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;issues&#x2F;19077&quot;&gt;regular basis&lt;&#x2F;a&gt;. Although it does not look pretty, zombie processes are leftovers that do not consume resources and never caused any kind of harm. Here is one scenario that will create a zombie:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Gitea updates a mirror by spawning the process &lt;code&gt;git remote update&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;git remote update&lt;&#x2F;code&gt; spawns yet another process, &lt;code&gt;git fetch&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;git fetch&lt;&#x2F;code&gt; is stuck, for instance because of network problems, and Gitea eventually times out&lt;&#x2F;li&gt;
&lt;li&gt;Gitea kill the process &lt;code&gt;git remote update&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When killed &lt;code&gt;git remote update&lt;&#x2F;code&gt; does not kill its own child and &lt;code&gt;git fetch&lt;&#x2F;code&gt; becomes an orphaned process which keeps running&lt;&#x2F;li&gt;
&lt;li&gt;When &lt;code&gt;git fetch&lt;&#x2F;code&gt; eventually completes it becomes a zombie because its original parent is no longer around to wait on it&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;pid-1-process-and-waiting-on-orphans&quot;&gt;PID 1 process and waiting on orphans&lt;a class=&quot;zola-anchor&quot; href=&quot;#pid-1-process-and-waiting-on-orphans&quot; aria-label=&quot;Anchor link for: pid-1-process-and-waiting-on-orphans&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;This scenario is not unique to Gitea and it is such a common pattern that safeguards have been implemented to mitigate the proliferation of zombies. Orphaned process are automatically attached to the process with PID 1, which is expected to wait on every process, whether it created them or not. When Gitea is installed from binary on GNU&#x2F;Linux this is &lt;code&gt;&#x2F;bin&#x2F;init&lt;&#x2F;code&gt; and when Gitea runs from the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;6171ea7d318c0ca8714bc6efd6a97ea4b495eb6d&#x2F;Dockerfile&quot;&gt;default docker image&lt;&#x2F;a&gt; this is &lt;code&gt;s6&lt;&#x2F;code&gt;: they will both wait on orphaned processes and there won&#x27;t be any zombies.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-if-gitea-is-the-only-running-process&quot;&gt;What if Gitea is the only running process?&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-if-gitea-is-the-only-running-process&quot; aria-label=&quot;Anchor link for: what-if-gitea-is-the-only-running-process&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;But when Gitea runs from the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;6171ea7d318c0ca8714bc6efd6a97ea4b495eb6d&#x2F;Dockerfile.rootless&quot;&gt;rootless docker image&lt;&#x2F;a&gt;, Gitea is the only process running in the container. Orphaned processes will have Gitea as a parent but will not wait on them and they will stay in a zombie state forever. To reproduce this problem in a minimal way:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;$ docker run --name gitea -p 8080:3000 -e GITEA__security__INSTALL_LOCK=true -d gitea&#x2F;gitea:1.16.8-rootless
&lt;&#x2F;span&gt;&lt;span&gt;$ docker exec --user 1000 gitea gitea admin user create --admin --username root --password admin1234 --email root@example.com
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;git&lt;&#x2F;code&gt; command can then be replaced with a script that waits forever:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;$ ( echo -e &amp;#39;#!&#x2F;bin&#x2F;bash\nsleep infinity&amp;#39; ) | docker exec -i --user root gitea tee &#x2F;usr&#x2F;bin&#x2F;git
&lt;&#x2F;span&gt;&lt;span&gt;$ docker exec --user root gitea chmod +x &#x2F;usr&#x2F;bin&#x2F;git
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Trying to create a repository from the web interface will create the conditions for a zombie to show:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;$ docker exec gitea ps -o ppid,pid,comm,args
&lt;&#x2F;span&gt;&lt;span&gt;PPID PID COMMAND COMMAND
&lt;&#x2F;span&gt;&lt;span&gt; 0 1 gitea &#x2F;usr&#x2F;local&#x2F;bin&#x2F;gitea -c &#x2F;etc&#x2F;gitea&#x2F;app.ini web
&lt;&#x2F;span&gt;&lt;span&gt; 1 94 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 99 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 111 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 164 git {git} &#x2F;bin&#x2F;bash &#x2F;usr&#x2F;bin&#x2F;git -c credential.helper= -c protocol.version=2 -c uploadpack.allowfilter=true -c uploadpack.allowAnySHA1InWant=true init --bare
&lt;&#x2F;span&gt;&lt;span&gt; 164 165 sleep sleep infinity
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When the &lt;code&gt;git&lt;&#x2F;code&gt; process is killed by Gitea, the &lt;code&gt;sleep&lt;&#x2F;code&gt; child will be orphaned:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;$ docker exec gitea ps -o ppid,pid,comm,args
&lt;&#x2F;span&gt;&lt;span&gt;PPID PID COMMAND COMMAND
&lt;&#x2F;span&gt;&lt;span&gt; 0 1 gitea &#x2F;usr&#x2F;local&#x2F;bin&#x2F;gitea -c &#x2F;etc&#x2F;gitea&#x2F;app.ini web
&lt;&#x2F;span&gt;&lt;span&gt; 1 94 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 99 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 111 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 165 sleep sleep infinity
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Killing it will turn it into a zombie:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;$ docker exec gitea kill 165
&lt;&#x2F;span&gt;&lt;span&gt;$ docker exec gitea ps -o ppid,pid,comm,args
&lt;&#x2F;span&gt;&lt;span&gt;PPID PID COMMAND COMMAND
&lt;&#x2F;span&gt;&lt;span&gt; 0 1 gitea &#x2F;usr&#x2F;local&#x2F;bin&#x2F;gitea -c &#x2F;etc&#x2F;gitea&#x2F;app.ini web
&lt;&#x2F;span&gt;&lt;span&gt; 1 94 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 99 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 111 sleep [sleep]
&lt;&#x2F;span&gt;&lt;span&gt; 1 165 sleep [sleep]
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;killing-a-child-process-and-all-its-children&quot;&gt;Killing a child process and all its children&lt;a class=&quot;zola-anchor&quot; href=&quot;#killing-a-child-process-and-all-its-children&quot; aria-label=&quot;Anchor link for: killing-a-child-process-and-all-its-children&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;There should be no need for an admin running Gitea to worry about those gory details, it should be taken care of regardless of the environment Gitea runs in. Fortunately there is a very simple way to avoid the creation of zombies by ensuring that all Gitea child process are &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Process_group&quot;&gt;process group leaders&lt;&#x2F;a&gt;. In a nutshell it means that when the child is killed all its children and grand children are also killed.&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>[solved] Gitea 1.15 and up: path not found or permission denied</title>
<published>2022-05-28T00:00:00+00:00</published>
<updated>2022-05-28T00:00:00+00:00</updated>
<link href="https://gna.org/blog/path-not-found/" type="text/html"/>
<id>https://gna.org/blog/path-not-found/</id>
<content type="html">&lt;p&gt;In Gitea 1.15 the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;cfb4c23a5009b9c236d48ac0bc156577c7d70741&#x2F;custom&#x2F;conf&#x2F;app.example.ini&quot;&gt;app.example.ini&lt;&#x2F;a&gt; file was changed to &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;commit&#x2F;4a84022d2559ccfc99960c7c654ee8b9b38664f7&quot;&gt;comment out most of the values&lt;&#x2F;a&gt;. The assumption was that all values exactly matched the defaults &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;main&#x2F;modules&#x2F;setting&#x2F;setting.go&quot;&gt;in the source code&lt;&#x2F;a&gt;. However, there are differences, for instance for &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;cfb4c23a5009b9c236d48ac0bc156577c7d70741&#x2F;modules&#x2F;setting&#x2F;setting.go#L771&quot;&gt;APP_DATA_PATH&lt;&#x2F;a&gt;. Before Gitea 1.15, &lt;code&gt;app.example.ini&lt;&#x2F;code&gt; contained:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;APP_DATA_PATH = data
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and the path was relative to the &lt;strong&gt;directory from which the Gitea server was running&lt;&#x2F;strong&gt;. In Gitea 1.15 up to 1.16, it was commented out:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;; APP_DATA_PATH = data
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and the path was relative to the &lt;strong&gt;work path directory&lt;&#x2F;strong&gt;, as provided either via the --work-path argument or the &lt;code&gt;GITEA_WORK_DIR&lt;&#x2F;code&gt; environment variable. &lt;&#x2F;p&gt;
&lt;p&gt;When a distribution such as voidlinux &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;void-linux&#x2F;void-packages&#x2F;blob&#x2F;master&#x2F;srcpkgs&#x2F;gitea&#x2F;patches&#x2F;config.patch&quot;&gt;uses app.example.ini&lt;&#x2F;a&gt; as a base for the Gitea package, this change indirectly creates a regression and an upgrade of Gitea &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;issues&#x2F;19367&quot;&gt;fails with errors&lt;&#x2F;a&gt; such as &lt;code&gt;unable to open level db at data&#x2F;data&#x2F;queues&#x2F;common: mkdir data: permission denied&lt;&#x2F;code&gt;. The regression did not show as soon as Gitea 1.15 became available in voidlinux because the package &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;void-linux&#x2F;void-packages&#x2F;blob&#x2F;7fc9190f0e0d557dd5031e68df4e183892d4315b&#x2F;srcpkgs&#x2F;gitea&#x2F;patches&#x2F;config.patch#L62&quot;&gt;explicitly set &lt;code&gt;APP_DATA_PATH&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. But this &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;void-linux&#x2F;void-packages&#x2F;commit&#x2F;19d986a2cae9ce73d32552ddb62443b5e7fa13e2&quot;&gt;changed when Gitea 1.15.6 was packaged&lt;&#x2F;a&gt; and once the value was commented out, upgrading triggered the problem. This was worked around six month later with the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;void-linux&#x2F;void-packages&#x2F;commit&#x2F;44b6c96fa12ce9d993c7a2ac9486d892735b7e3a&quot;&gt;Gitea 1.16.8&lt;&#x2F;a&gt; package.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;APP_DATA_PATH&lt;&#x2F;code&gt; directory is not the only one, the &lt;code&gt;[log] ROOT_PATH&lt;&#x2F;code&gt; is another example. There is an &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19815&quot;&gt;ongoing effort&lt;&#x2F;a&gt; to improve the situation in Gitea 1.17. With the downside of introducing breaking changes that will have an impact on all Gitea installations because the content of the &lt;code&gt;app.ini&lt;&#x2F;code&gt; file will be interpreted differently. In the case of &lt;code&gt;APP_DATA_PATH&lt;&#x2F;code&gt;, both:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;APP_DATA_PATH = data
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;; APP_DATA_PATH = data
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;will be interpreted to be relative to the &lt;strong&gt;work path directory&lt;&#x2F;strong&gt;, as provided either via the --work-path argument or the &lt;code&gt;GITEA_WORK_DIR&lt;&#x2F;code&gt; environment variable. Every Gitea installation using &lt;strong&gt;APP_DATA_PATH = data&lt;&#x2F;strong&gt; will need to update the value to be an absolute path such as &lt;strong&gt;&#x2F;var&#x2F;lib&#x2F;gitea&#x2F;data&lt;&#x2F;strong&gt; so that it keeps pointing to the expected directory.&lt;&#x2F;p&gt;
&lt;p&gt;In order to prepare for the change or ensure the consistency of all path, there fortunately is a very simple &lt;strong&gt;solution: always use absolute paths in the &lt;code&gt;app.ini&lt;&#x2F;code&gt; configuration file&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>[solved] Gitea 1.16.[678] error: fatal: unsafe repository is owned by someone else</title>
<published>2022-05-15T00:00:00+00:00</published>
<updated>2022-05-15T00:00:00+00:00</updated>
<link href="https://gna.org/blog/unsafe-repository-is-owned-by-someone-else/" type="text/html"/>
<id>https://gna.org/blog/unsafe-repository-is-owned-by-someone-else/</id>
<content type="html">&lt;p&gt;April 12, 2022 version &lt;a href=&quot;https:&#x2F;&#x2F;lore.kernel.org&#x2F;git&#x2F;xmqqv8veb5i6.fsf@gitster.g&#x2F;&quot;&gt;git v2.35.2&lt;&#x2F;a&gt; was released and addresses a security issue &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;git-for-windows&#x2F;git&#x2F;security&#x2F;advisories&#x2F;GHSA-vw2c-22j4-2fh2&quot;&gt;CVE-2022-24765&lt;&#x2F;a&gt;. It was backported to 2.30.3, v2.31.2, v2.32.1, v2.33.2, and v2.34.2 and published by distributions such as &lt;a href=&quot;https:&#x2F;&#x2F;security-tracker.debian.org&#x2F;tracker&#x2F;CVE-2022-24765&quot;&gt;Debian GNU&#x2F;Linux&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;www.alpinelinux.org&#x2F;releases&#x2F;&quot;&gt;Alpine&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;If Gitea runs as user &lt;code&gt;foo&lt;&#x2F;code&gt;, calls a patched Git version and a parent directory of the git repositories is owned by a user other than &lt;code&gt;foo&lt;&#x2F;code&gt;, it will fail&lt;&#x2F;strong&gt; with a message such as:&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#2b303b;color:#c0c5ce;&quot;&gt;&lt;code&gt;&lt;span&gt;Failed to open repository: Git&#x2F;Data Error: exit status 128 - fatal: unsafe repository (&amp;#39;&#x2F;data&#x2F;git&#x2F;repositories&#x2F;git&#x2F;data.git&amp;#39; is owned by someone else)
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This started to show in the past few weeks to &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;issues&#x2F;19455&quot;&gt;users running the Gitea binary on Windows&lt;&#x2F;a&gt; who also independently installed git v2.36. And then to people running &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;issues&#x2F;19455#issuecomment-1106331149&quot;&gt;Gitea from snap&lt;&#x2F;a&gt;, on &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;issues&#x2F;19455#issuecomment-1106312061&quot;&gt;a Synology NAS&lt;&#x2F;a&gt; and then people running from &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;main&#x2F;Dockerfile#L2&quot;&gt;Gitea docker images&lt;&#x2F;a&gt; which is based on &lt;a href=&quot;https:&#x2F;&#x2F;www.alpinelinux.org&#x2F;releases&#x2F;&quot;&gt;Alpine&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;workarounds&quot;&gt;Workarounds&lt;a class=&quot;zola-anchor&quot; href=&quot;#workarounds&quot; aria-label=&quot;Anchor link for: workarounds&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;If using &lt;a href=&quot;https:&#x2F;&#x2F;hub.docker.com&#x2F;r&#x2F;gitea&#x2F;gitea&quot;&gt;Gitea docker images&lt;&#x2F;a&gt;:
&lt;ul&gt;
&lt;li&gt;upgrade to &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19876&quot;&gt;Gitea &amp;gt;=1.16.9&lt;&#x2F;a&gt; or 1.17, both have git &amp;gt;=2.36&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;git config --global --replace-all safe.directory &#x27;*&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the Gitea binary was installed independently of git, upgrade git to a version that is &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-config#Documentation&#x2F;git-config.txt-safedirectory&quot;&gt;greater or equal to 2.36&lt;&#x2F;a&gt; and disable the security check entirely with:
&lt;ul&gt;
&lt;li&gt;impersonate the &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-from-binary&#x2F;#recommended-server-configuration&quot;&gt;user dedicated to Gitea&lt;&#x2F;a&gt; (usually git)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;git config --global --replace-all safe.directory &#x27;*&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;bug-fix&quot;&gt;Bug fix&lt;a class=&quot;zola-anchor&quot; href=&quot;#bug-fix&quot; aria-label=&quot;Anchor link for: bug-fix&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19870&quot;&gt;bug fix&lt;&#x2F;a&gt; is for Gitea to ensure &lt;code&gt;git config --global --replace-all safe.directory &#x27;*&#x27;&lt;&#x2F;code&gt; is set on its &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-from-binary&#x2F;#recommended-server-configuration&quot;&gt;dedicated user&lt;&#x2F;a&gt; when it initializes. It is effective on the condition that the git CLI version is &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-config#Documentation&#x2F;git-config.txt-safedirectory&quot;&gt;greater or equal to 2.36&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bug-fix-rationale&quot;&gt;Bug fix rationale&lt;a class=&quot;zola-anchor&quot; href=&quot;#bug-fix-rationale&quot; aria-label=&quot;Anchor link for: bug-fix-rationale&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;It is safe to &lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;forgefriends&#x2F;forgefriends&#x2F;-&#x2F;merge_requests&#x2F;50&#x2F;diffs&quot;&gt;disable the security check in Gitea&lt;&#x2F;a&gt;. It is not vulnerable to &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;git-for-windows&#x2F;git&#x2F;security&#x2F;advisories&#x2F;GHSA-vw2c-22j4-2fh2&quot;&gt;CVE-2022-24765&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt; because it calls the git CLI &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;main&#x2F;modules&#x2F;git&#x2F;command.go#L160&quot;&gt;after changing its working directory&lt;&#x2F;a&gt; to be the git repository targeted by the command (for instance &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;main&#x2F;modules&#x2F;git&#x2F;diff.go#L38-L45&quot;&gt;diff&lt;&#x2F;a&gt;) or a temporary directory. Therefore &lt;strong&gt;it will not explore the parent directories looking for a git configuration file&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The security check is triggered because the repository is owned by an unexpected user (root instead of git typically) and &lt;strong&gt;not because a parent directory is owned by an unexpected user&lt;&#x2F;strong&gt;. This, in itself, is a problem worth investigating but it is unrelated and was revealed by the newer security check of git even though it does not match the threat described in &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;git-for-windows&#x2F;git&#x2F;security&#x2F;advisories&#x2F;GHSA-vw2c-22j4-2fh2&quot;&gt;CVE-2022-24765&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It appears non trivial to enforce a consistent ownership of files and directories, either within docker or outside docker when networked file systems are involved. The Gitea server was not troubled by this inconsistency so far because the permissions allow it to write and read where expected, regardless of the owner. It is not worth looking into but it is ancient and unrelated.&lt;&#x2F;p&gt;
&lt;p&gt;Gitea runs under a dedicated user, either when installed &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-from-binary&#x2F;#recommended-server-configuration&quot;&gt;from binary&lt;&#x2F;a&gt; or from &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;install-with-docker&#x2F;&quot;&gt;docker&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;blob&#x2F;main&#x2F;modules&#x2F;git&#x2F;git.go#L196-L207&quot;&gt;modifies the global git configuration&lt;&#x2F;a&gt; depending on the git version at initialization time. Fixing the problem can therefore be done by &lt;a href=&quot;https:&#x2F;&#x2F;lab.forgefriends.org&#x2F;forgefriends&#x2F;forgefriends&#x2F;-&#x2F;merge_requests&#x2F;50&#x2F;diffs#bcd72ff867cbd1ddd5b6518c3a05b5f1a6021286_209_209&quot;&gt;disabling the security check in the global git config file at initialization time&lt;&#x2F;a&gt;. It also requires a minimum version of git 2.36 to be installed, which is the case for Gitea docker images with &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19876&quot;&gt;versions &amp;gt;= 1.16.9&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>[solved] blank or error 500 page after login</title>
<published>2022-05-08T00:00:00+00:00</published>
<updated>2022-05-08T00:00:00+00:00</updated>
<link href="https://gna.org/blog/blank-or-error-500-page-after-login/" type="text/html"/>
<id>https://gna.org/blog/blank-or-error-500-page-after-login/</id>
<content type="html">&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;docs.gitea.io&#x2F;en-us&#x2F;upgrade-from-gitea&#x2F;#upgrade-from-binary&quot;&gt;instructions to upgrade a Gitea instance&lt;&#x2F;a&gt; only require three to four steps. They work fine most of the time but the documentation is lacking a &amp;quot;Troubleshooting&amp;quot; section to help out when something goes wrong. Maintaining instructions on how to diagnose and fix upgrade problems is an ambitious undertaking and requires updates every time a new case is discovered.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;a href=&quot;https:&#x2F;&#x2F;forum.gna.org&#x2F;t&#x2F;things-to-know-about-gitea-upgrades&#x2F;39&quot;&gt;inventory of the known upgrade issues&lt;&#x2F;a&gt; was started to figure out how to structure such a section in the documentation. The &lt;a href=&quot;https:&#x2F;&#x2F;blog.gitea.io&#x2F;&quot;&gt;release notes&lt;&#x2F;a&gt; were analyzed all the way back to &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;releases&#x2F;tag&#x2F;v1.9.6&quot;&gt;Gitea 1.9.6&lt;&#x2F;a&gt; and the work is still in progress. Here is a sample of the tips that will be included:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Upgrade directly to the latest Gitea version, there is no need to upgrade to intermediate versions.&lt;&#x2F;li&gt;
&lt;li&gt;If the upgrade from version x.y to version x.y+2 fails and there is a need to narrow down the problem, try upgrading to the latest minor version of each major version and verify it works.&lt;&#x2F;li&gt;
&lt;li&gt;etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However, even with the best documentation, someone will eventually &lt;strong&gt;run into an new problem&lt;&#x2F;strong&gt; and fixing it without compromising the integrity of the data will be challenging. This is best demonstrated by a real world example that was concluded a few days ago.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;getting-help-from-the-community&quot;&gt;Getting help from the community&lt;a class=&quot;zola-anchor&quot; href=&quot;#getting-help-from-the-community&quot; aria-label=&quot;Anchor link for: getting-help-from-the-community&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;After &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&quot;&gt;upgrading a Gitea intsance from 1.9.6 to 1.16.5&lt;&#x2F;a&gt; the tests conducted manually did not uncover any problem. However, after going to production, some users saw a blank page after login and had to manually type the URL of the project they wanted to see in the browser. The person in charge of the upgrade never had to diagnose Gitea problem and &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&quot;&gt;reached out in the Gitea forum&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip: explain the problem in a public forum as early as possible to get help from the community&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;In their post in the forum they explained how they attempted to diagnose the problem and how why they thought that only users created a few years ago were impacted. It was a detailed analysis that was concluded with a partial copy of the logs. It was unfortunately missing &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;12&quot;&gt;key information&lt;&#x2F;a&gt; that was provided only three days later. In the meantime, as they could not figure out the source of the problem, they were on the &lt;strong&gt;verge of &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;11&quot;&gt;accepting the loss of all the Gitea database&lt;&#x2F;a&gt; and start over from the repositories&lt;&#x2F;strong&gt;. However, once all the details were available, &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;13&quot;&gt;a workaround&lt;&#x2F;a&gt; was suggested in the forum.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip: focus more on providing detailed facts than exposing the attempted diagnostic&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;There was hope to fix Gitea and in the following days they applied the workaround. They also tried to improve it but without success and eventually accepted a &lt;strong&gt;partial data loss&lt;&#x2F;strong&gt; as inevitable and &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;14&quot;&gt;reported their success back to the forum&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip: when getting support from the community, providing feedback is the best token of appreciation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h1 id=&quot;getting-professional-help&quot;&gt;Getting professional help&lt;a class=&quot;zola-anchor&quot; href=&quot;#getting-professional-help&quot; aria-label=&quot;Anchor link for: getting-professional-help&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;gna.org&#x2F;gitea-clinic&#x2F;&quot;&gt;Gna! Clinic&lt;&#x2F;a&gt; is a collective of individual and companies that provides professional services to Gitea admins. They are active members of the Gitea community who &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;u&#x2F;dachary&#x2F;activity&quot;&gt;help out&lt;&#x2F;a&gt; as volunteers. They can also be hired to resolve the more complicated cases.&lt;&#x2F;p&gt;
&lt;p&gt;The Gitea instance that was in trouble required more than a few minutes of work and access to the database content for a proper diagnostic. They &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;13&quot;&gt;proposed their assistance&lt;&#x2F;a&gt; but although &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;user-research-about-gitea-upgrade-experiences-call-for-volunteers&#x2F;5063&#x2F;2&quot;&gt;well received&lt;&#x2F;a&gt;, it was not accepted.&lt;&#x2F;p&gt;
&lt;p&gt;When the Gitea admin explained how they chose to resolve the problem &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;14&quot;&gt;on the forum&lt;&#x2F;a&gt;, it confirmed the workaround was viable and the root problem was identified. That was enough to figure out a fix for the underlying bug with &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;17&quot;&gt;a rather simple patch&lt;&#x2F;a&gt; that was merged &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19629&quot;&gt;and backported&lt;&#x2F;a&gt; in the following days. But it happened too late to avoid the data loss.&lt;&#x2F;p&gt;
&lt;p&gt;To summarize with a timeline, here is what happened:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;J+1: The &lt;strong&gt;problem is discovered&lt;&#x2F;strong&gt; by users who see a blank page after login and a the Gitea admin tries to diagnose the problem&lt;&#x2F;li&gt;
&lt;li&gt;J+2: A message is sent &lt;strong&gt;to ask for help in the community&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;J+2 to J+6: Three people in the community suggest ideas but &lt;strong&gt;the Gitea admin cannot figure out the root cause and is on the verge of accepting the loss of all Gitea data&lt;&#x2F;strong&gt; and restart from the git repositories&lt;&#x2F;li&gt;
&lt;li&gt;J+6: A &lt;strong&gt;workaround is suggested by the community&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;J+7 to J+17: The Gitea admin applies the &lt;strong&gt;workaround and only looses part of the Gitea data&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;And in retrospect, here is what could have happened instead:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;J+1: The &lt;strong&gt;problem is discovered&lt;&#x2F;strong&gt; by users who see a blank page after login&lt;&#x2F;li&gt;
&lt;li&gt;J+1: The Gitea admin &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;gna.org&#x2F;gitea-clinic&#x2F;&quot;&gt;reaches out to someone at the Gna! Clinic&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;J+2: The &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;12&quot;&gt;logs of the Gitea instance&lt;&#x2F;a&gt; are analyzed, &lt;strong&gt;the root cause diagnosed&lt;&#x2F;strong&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;discourse.gitea.io&#x2F;t&#x2F;blank-page-after-login&#x2F;5051&#x2F;17&quot;&gt;a patch&lt;&#x2F;a&gt; is created to fix it.&lt;&#x2F;li&gt;
&lt;li&gt;J+3: If necessary a Gitea binary is created with the patch and used as a temporary replacement until the next point release is published with &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;go-gitea&#x2F;gitea&#x2F;pull&#x2F;19629&quot;&gt;the backport&lt;&#x2F;a&gt;. The Gitea admin runs the patched Gitea binary in the meantime. &lt;strong&gt;There is no data loss&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It does not mean all upgrade problems can be resolved so easily. But it shows, with an example, that in some cases it makes sense to get professional help.&lt;&#x2F;p&gt;
</content>
</entry>
<entry xml:lang="en">
<title>Introducing Gna!</title>
<published>2022-04-22T00:00:00+00:00</published>
<updated>2022-04-22T00:00:00+00:00</updated>
<link href="https://gna.org/blog/22-04-2022-hostea-introducing-hostea-forgefriends-monthly-meet/" type="text/html"/>
<id>https://gna.org/blog/22-04-2022-hostea-introducing-hostea-forgefriends-monthly-meet/</id>
<content type="html">&lt;p&gt;Introducing &lt;a href=&quot;https:&#x2F;&#x2F;gna.org&quot;&gt;Hostea&lt;&#x2F;a&gt;, a project &lt;a href=&quot;https:&#x2F;&#x2F;dachary.org&quot;&gt;Loïc
Dachary&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;batsense.net&quot;&gt;Aravinth
Manivannan&lt;&#x2F;a&gt; are working on to create a full Free
software development suite based on
&lt;a href=&quot;https:&#x2F;&#x2F;gitea.io&quot;&gt;Gitea&lt;&#x2F;a&gt; for the forge, &lt;a href=&quot;https:&#x2F;&#x2F;woodpecker-ci.org&quot;&gt;Woodpecker
CI&lt;&#x2F;a&gt; for CI&#x2F;CD,
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;realaravinth&#x2F;pages&quot;&gt;Pages&lt;&#x2F;a&gt; for static sites and
&lt;a href=&quot;https:&#x2F;&#x2F;gitpad.org&quot;&gt;GitPad&lt;&#x2F;a&gt; for gists.&lt;&#x2F;p&gt;
&lt;p&gt;This talk introduces the projects goals and philosophy behind the
project.&lt;&#x2F;p&gt;
&lt;p&gt;Please see
&lt;a href=&quot;https:&#x2F;&#x2F;forum.forgefriends.org&#x2F;t&#x2F;forgefriends-monthly-update-april-22st-2022-5pm-6pm-utc-2&#x2F;673&quot;&gt;here&lt;&#x2F;a&gt;
to learn more about the event.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;details&quot;&gt;Details&lt;a class=&quot;zola-anchor&quot; href=&quot;#details&quot; aria-label=&quot;Anchor link for: details&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;organised by:&lt;&#x2F;strong&gt; &lt;a href=&quot;https:&#x2F;&#x2F;forgefriends.org&quot;&gt;forgefriends.org&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;date:&lt;&#x2F;strong&gt; 2022&lt;sup&gt;th&lt;&#x2F;sup&gt; April, 2022&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;venue:&lt;&#x2F;strong&gt; Online&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources&lt;a class=&quot;zola-anchor&quot; href=&quot;#resources&quot; aria-label=&quot;Anchor link for: resources&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;.&#x2F;slides&#x2F;2022-04-22-forgefriends-introducing-hostea.odp&quot;&gt;slides(ODP)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;.&#x2F;slides&#x2F;2022-04-22-forgefriends-introducing-hostea.pdf&quot;&gt;slides(PDF)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
</entry>
<entry xml:lang="en">
<title>Project plans for a hosted Gitea online service</title>
<published>2022-04-18T00:00:00+00:00</published>
<updated>2022-04-18T00:00:00+00:00</updated>
<link href="https://gna.org/blog/project-plans-for-hosted-gitea-online-service/" type="text/html"/>
<id>https://gna.org/blog/project-plans-for-hosted-gitea-online-service/</id>
<content type="html">&lt;p&gt;&lt;em&gt;This post was originally published on &lt;a href=&quot;https:&#x2F;&#x2F;blog.dachary.org&#x2F;2022&#x2F;02&#x2F;16&#x2F;project-plans-for-a-hosted-gitea-online-service&#x2F;&quot;&gt;Loïc Dachary&#x27;s
blog&lt;&#x2F;a&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;When an organization asks me about Gitea, I would like to direct them to
a provider where they can rent an instance and just use it, in the same
way they can go to https:&#x2F;&#x2F;discourse.org for a forum, or
https:&#x2F;&#x2F;nextcloud.com for storage. Instead of waiting for that to
happen, &lt;a href=&quot;https:&#x2F;&#x2F;batsense.net&#x2F;about&#x2F;&quot;&gt;Aravinth&lt;&#x2F;a&gt; and
&lt;a href=&quot;https:&#x2F;&#x2F;dachary.org&#x2F;&quot;&gt;myself&lt;&#x2F;a&gt; decided to do something about it, in a
way that is in line with our shared values: transparency and Free
Software.&lt;&#x2F;p&gt;
&lt;p&gt;After doing some research we found counter examples that showed the
pitfalls to avoid. GitLab because its business model heavily relies on
selling proprietary licenses. CiviCRM because setting it up is complex
and requires training: users can&#x27;t figure it out on their own. Gitea
images provided by Digital Ocean because they do not include security
upgrades. MySQL configured and run by AWS because of the vendor lock-in
that makes it impossible to self-host.&lt;&#x2F;p&gt;
&lt;p&gt;We concluded that an online service such as Gitea can be hosted in a
sustainable way as long as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is well maintained and upgrades itself&lt;&#x2F;li&gt;
&lt;li&gt;It can be self-hosted&lt;&#x2F;li&gt;
&lt;li&gt;The service can automatically be restored from backups when the
underlying resources fail&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;GitHub and GitLab make it look like there is a market around software
forges. It is however impossible to figure out if this market exists
only because it is based on proprietary software. How many of these
customers would pay for a Free Software hosted Gitea instance?&lt;&#x2F;p&gt;
&lt;p&gt;Even if these customers do exist, a new service provider would have to
figure out how to convince them to subscribe. The technical development
of the service can be done within weeks but building a sustainable
business takes much longer. Again, there were examples of what can go
wrong, for instance ElasticSearch. After years of work developing a
successful online service and a customer base, AWS entered the
competition and started to take it away from them.&lt;&#x2F;p&gt;
&lt;p&gt;The sustainability of the Free Software ecosystem is a new and very
difficult problem to solve. It is discussed more than it ever was in the
wake of security breaches originating from widely used and yet abandoned
library or disillusioned Free Software authors self-sabotaging their
next release, and everyone has diverging opinions. It falls on each Free
Software author to spend time to think about their own projects because
there are no handbook or good examples to follow. That is what Aravinth
and myself did to find a semblance of clarity and decide how to go about
this hosted Gitea service idea.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;sustaining-free-software-online-services&quot;&gt;Sustaining Free Software online services&lt;a class=&quot;zola-anchor&quot; href=&quot;#sustaining-free-software-online-services&quot; aria-label=&quot;Anchor link for: sustaining-free-software-online-services&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;more-mature-online-services-mean-less-opportunities-to-sell-services&quot;&gt;More mature online services mean less opportunities to sell services&lt;a class=&quot;zola-anchor&quot; href=&quot;#more-mature-online-services-mean-less-opportunities-to-sell-services&quot; aria-label=&quot;Anchor link for: more-mature-online-services-mean-less-opportunities-to-sell-services&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Ideally the software running an online service is rock solid and bugs
are so rare that it can run unattended. This is true of
https:&#x2F;&#x2F;wordpress.org and it is not uncommon for an instance to run for
years while upgrading themselves to get security patches. The cost of
maintaining such a service is negligible and hosting companies can offer
it for free to their customers. They make their profit by renting the
machines on which the service runs.&lt;&#x2F;p&gt;
&lt;p&gt;When the software is not as mature, it is more expensive to run. Bugs
need fixing, upgrades require manual intervention, users must be trained
to overcome the complexity of the user experience, etc. Well known
examples are Discourse or CiviCRM for which companies sell services to
overcome these issues.&lt;&#x2F;p&gt;
&lt;p&gt;But when an organization is both the author of the software and the
provider of paid services to compensate for its lack of maturity, it
creates a conflict of interest. Should they focus their effort on making
the software more mature, they would harm a business model that is based
on this very lack of maturity. For instance, if the author of a software
also sells training courses, they are not motivated to solve user
experience issues. If they did, it would lower the need for training
courses and reduce their income.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;free-software-online-services-in-the-wake-of-the-sustainability&quot;&gt;Free Software online services in the wake of the sustainability&lt;a class=&quot;zola-anchor&quot; href=&quot;#free-software-online-services-in-the-wake-of-the-sustainability&quot; aria-label=&quot;Anchor link for: free-software-online-services-in-the-wake-of-the-sustainability&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;crisis&lt;&#x2F;p&gt;
&lt;p&gt;Nowadays all Free Software authors struggle to get enough resources to
produce a steady stream of releases, even when the project is very
popular. This sustainability problem is getting more and more attention
as the number of Free Software projects in use world wide keeps growing.
Even the simplest online service relies on thousands of Free Software
projects, each of which needs work to keep going. Accidents caused by
poorly maintained Free Software projects become more frequent.&lt;&#x2F;p&gt;
&lt;p&gt;This Free Software sustainability crisis is barely emerging and very
much resembles ecological problems such as climate change. In both cases
it is very difficult to figure out how to properly care for the
resources that are consumed. After decades of advocacy, it is generally
accepted that fossil energy won&#x27;t last forever but there still is a long
way to go. It will also take a long time for the Free Software community
to answer this simple question: how to sustain an ever growing library
of Free Software?&lt;&#x2F;p&gt;
&lt;p&gt;Luckily, it is relatively simpler to solve that problem for an online
service because it has users. They can be reminded that their assistance
is needed to keep the project afloat, for instance by a donation. A
proposition that would be much more difficult to make for the author of
a cryptographic library. Convincing users to pay for an online service
has the best chance of success when the author of the software is also
the service provider. This is the business model of Discourse and
Weblate, but it is relatively fragile because nothing stands in the way
of the competition.&lt;&#x2F;p&gt;
&lt;p&gt;A few years ago ElasticSearch successfully developed an online service
offering. But when AWS entered the competition and was better at
marketing it, ElasticSearch quickly realized they would likely go out of
business. They tried to fight back by &lt;a href=&quot;https:&#x2F;&#x2F;www.elastic.co&#x2F;blog&#x2F;licensing-change&quot;&gt;changing their
license&lt;&#x2F;a&gt;, which was the
wrong answer to a real problem. Discourse or Weblate are also likely to
face competition from hosting companies in the future and they may not
survive it.&lt;&#x2F;p&gt;
&lt;p&gt;In the end, the durable source of income for a Free Software online
service is to rent the resources (CPU&#x2F;RAM&#x2F;network&#x2F;disk) it needs to run.
In other words only hosting companies can make a profit when running
such an online service. And for that reason they also need to share part
of the profits to ensure the sustainability of the Free Software service
their customers need.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;online-services-vendor-lock-in-is-cured-by-free-software&quot;&gt;Online services vendor lock-in is cured by Free Software&lt;a class=&quot;zola-anchor&quot; href=&quot;#online-services-vendor-lock-in-is-cured-by-free-software&quot; aria-label=&quot;Anchor link for: online-services-vendor-lock-in-is-cured-by-free-software&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;When hosting companies offer online services they also provide upgrades
and transparent recovery when the hardware fails. But none of them allow
the service to be self-hosted. When their price policy change, or when
the term of services ban users from a given country, migrating the
service elsewhere it costly and difficult. For instance when AWS runs
MySQL for their customers, they allow to download the data but not the
software that runs the proprietary AWS interface used to configure and
control the server. Another example is GitHub where the content of the
git repository can be downloaded but the code that runs GitHub itself is
not Free Software.&lt;&#x2F;p&gt;
&lt;p&gt;If a customer cannot run the same software as their service provider,
they are locked-in, even if they can download their data. It is a common
misconception to think that there is no vendor lock-in as long as it is
possible to download the data in an standard format. Migrating the data
from one software to another is, more often than not, time consuming and
costly to a point that it is effectively a blocker. A GitHub salesperson
would argue that it is possible for people to run GitHub Enterprise on
their own hardware. But the vendor lock-in is still present via the
proprietary license contract. The user experience, maintenance and
upgrades are still exclusively controlled by GitHub.&lt;&#x2F;p&gt;
&lt;p&gt;To guarantee their independence, the customers of an online service need
to be able to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Download their data&lt;&#x2F;li&gt;
&lt;li&gt;Run the exact same Free Software as their service provider&lt;&#x2F;li&gt;
&lt;li&gt;Run the exact same Free Software infrastructure as code as their
service provider&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The requirement regarding Free Software infrastructure as code refers
to, for instance, the AWS control panel and all that is behind it when
creating a new MySQL service. It includes whatever a competitor would
need to run the same online service. An example would be
https:&#x2F;&#x2F;enough.community, an infrastructure as code dedicated to
creating the services needed by whistleblowers and human rights
defenders. It consumes resources rented by hosting providers, assembles
disks and machines, setup monitoring and intrusion detection, installs
various online services and upgrades them.&lt;&#x2F;p&gt;
&lt;p&gt;The availability of the software that creates the infrastructure is not
only useful to the competitors of a service provider. It also benefits a
non-profit that wants to provide (for instance) Wordpress instances to
its members. Without it they would need to create something from scratch
using building blocks such as CiviCRM. Even though such building blocks
exist, this is a significant undertaking and effectively a blocker.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;federated-online-services-and-durability&quot;&gt;Federated online services and durability&lt;a class=&quot;zola-anchor&quot; href=&quot;#federated-online-services-and-durability&quot; aria-label=&quot;Anchor link for: federated-online-services-and-durability&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;All self-hosted services are in danger of losing the data they contain.
When a Wordpress service is hosted in a home and the machine dies, it
must be restored from backups... when there are backups. Hosting
companies ensure the durability of the data with their own backup
system. It creates a dilemma for people who are looking into self
hosting: independence is desirable, but is it worth taking the risk of
data loss?&lt;&#x2F;p&gt;
&lt;p&gt;Federated online services do not suffer from this problem, because they
can mirror each other. A Gitea instance that is federated with another
will mirror copies of software projects found on its peers. Should one
instance be destroyed, mirrored projects can be resurrected from the
federated instance. Not only is it a practical way to ensure the (rare)
failure of an entire datacenter, it also helps with the (more frequent)
destruction of self-hosted machines. Contrary to backups that require
special attention, the replication involved in federated online service
is built in and works continuously. There is no need for an extra backup
service that is very rarely used and therefore likely to fail when
needed.&lt;&#x2F;p&gt;
&lt;p&gt;Federated services are not yet mainstream and Gitea is one of the rare
services that started to implement the concept. In the interim,
customers of an online hosting service will need to worry about backups
to ensure the durability of their data. But the ultimate solution for
them won&#x27;t be the emergence of an ideal backup infrastructure, it will
be replication (via federated services) that will continuously ensure
the durability of their data.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;paths-forward&quot;&gt;Paths forward&lt;a class=&quot;zola-anchor&quot; href=&quot;#paths-forward&quot; aria-label=&quot;Anchor link for: paths-forward&quot;
&gt;&lt;span class=&quot;anchor-icon&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;a
&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;The Gitea project itself, following the footsteps of Discourse or
Weblate, could provide a hosting service. Part of its current user base
may become customers and there does not seem to be any blocker to make
that happen. As with most successful Free Software project, people
working on Gitea daily are already very busy and cannot engage in such a
long term project. But Aravinth and myself can, if they will have us.&lt;&#x2F;p&gt;
&lt;p&gt;Another path forward would be to wrap Gitea into a bundle that existing
hosting companies could easily use to provide such a service to their
customers. The biggest hosting companies are unlikely to be interested:
if Digital Ocean was to provide upgrades on top of their existing Gitea
image, they are more likely to rely on their internal staff to implement
that from scratch, as proprietary software integrated into their
existing infrastructure. But smaller hosting companies such as
https:&#x2F;&#x2F;Octopuce.fr or https:&#x2F;&#x2F;Easter-Eggs.com, who already deploy Gitea
instances for their customers, would use it if, for instance, it helped
with the upgrades. They would then kindly be reminded to give back a
share of their profits in order to sustain the development of the
service they deploy.&lt;&#x2F;p&gt;
&lt;p&gt;Finally it would also be possible to follow the example of GitLab in the
early days (before it turned to proprietary software) or Codeberg and
offer a free shared forge hosting service to build a user base. After a
few years, a percentage of the user base would convert to being paid
customers or donors to sustain the activity and part of the income would
be used to sustain the development of the service.&lt;&#x2F;p&gt;
</content>
</entry>
</feed>