gitea: Gitea's path system quirk and bug
Description
In history, Gitea’s binary was designed to use the binary directory as working directory, it tries to create/use its “data”/“custom” directories in the binary path. For example: running /usr/local/bin/gitea makes Gitea try to use /usr/local/bin/custom directory, which is improper/wrong, and it causes a lot of problems.
POSIX users please use https://github.com/go-gitea/gitea/tree/main/contrib/fhs-compliant-script , do not put Gitea binary into /usr/loca/bin directory – unless you are 100% sure about the details.
“custom” bug
A feedback from discord
Update gitea from 1.15.6 to 1.15.7 (and then 1.19.1):
Failed to include custom: open /usr/local/bin/custom/conf/app.ini: permission denied
2023/04/20 06:06:09 cmd/dump.go:150:fatal() [F] Failed to include custom: open /usr/local/bin/custom/conf/app.ini: permission denied
I’m using the script in contrib/upgrade.sh and as far as I’m concerned I have never used this “custom” folder, why is it needed? (I am using sqlite3 as well)
I don’t get why it’s trying to read/write in that particular folder and not from /var/lib/gitea/custom
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 28 (13 by maintainers)
Links to this issue
Commits related to this issue
- Refactor path & config system (#25330) # The problem There were many "path tricks": * By default, Gitea uses its program directory as its work path * Gitea tries to use the "work path" to gues... — committed to go-gitea/gitea by wxiaoguang a year ago
- Refactor path & config system (#25330) # The problem There were many "path tricks": * By default, Gitea uses its program directory as its work path * Gitea tries to use the "work path" to guess its... — committed to wxiaoguang/gitea by wxiaoguang a year ago
I was able to solve this issue by just adding the proper backupopts:
That’s true … 🤣 and it’s quite complex that’s why there are many issues which are difficult to fix before refactoring.
For me, I have done my best to optimize it, since it is really complex, I won’t say my code is bug-free, while I think it is the right way and if there is any bug in my code, I will always fix them in the first time (as usual).
#25330 stores the WORK_PATH
I see, the document is not clear either. I think zeripath has explained about this problem with backgrounds https://github.com/go-gitea/gitea/issues/24222#issuecomment-1535246772
If #25330 could be merged, I think I could also improve the documents about the “work path” topic, and at that time, we do not need to play with the “path tricks” any more.
Thank you very much for helping investigating the problem 🙏 , I guess we are near to the complete solution now. 😄