WebUI only works when `git bug` executed by a root user
Labels: area/ui/webkind/bug
Timeline
Taylan Dogan (kondanta) opened
Hi,
I've downloaded the pre-compiled linux binary git-bug_linux_amd64. When I try to serve webui, it was nothing but 404 error.
Detailed Explanation
I am using Arch distribution and using pre-compiled linux binary as I already mentioned. My first attempt was failure and I only had 404. Then I switched back to Windows and try serving webui from there, nothing was wrong. So I switched back to the linux and try to run webui as a root user. Checked the page, it was working.
I also did check the netstat results
# when git-bug executed using `sudo`
netstat -tulnp | grep 3
tcp 0 0 127.0.0.1:37019 0.0.0.0:* LISTEN 101685/./git-bug
# when git-bug executed by normal user
# port was `38313`
netstat -tulnp | grep 38
# Nothing
I also able to serve without adding sudo in front of the git-bug couple of times but the rest of my attempts were just failures. So I highly doubt that binary is trying to use some /tmp/ folders but somewhat cannot create/read it. I don't know if it is relevant though.
Expected Behaviour
When git bug webui executed in a project that uses git, web page should return 200 and should be visible.
Actual Behaviour
When git bug webui executed by a normal user, serving web page went wrong. It couldn't get enough permissions (guessing here) to listen a port. However, using sudo git bug webui was working perfectly fine. Thus speculation about the permissions.
I also can dump more information if you guys tell me what else might be necessary.
Taylan Dogan (kondanta) changed the title from WebUI only works when `git bug` executed by a root user to WebUI only works when `git bug` executed by a root user
Michael Muré (MichaelMure) commented
That's quite weird.
Does the other commands work ? Does git work in this repo ? Is there an error reported in the console when running as a normal user ?
Can you try by choosing a port yourself with git bug webui -p 1234 ?
Michael Muré (MichaelMure)
added label
kind/bug
Michael Muré (MichaelMure)
added label
area/ui/web
Michael Muré (MichaelMure)
added label
Core
Taylan Dogan (kondanta) commented
Does the other commands work ?
Apparently, they don't. I can add new bug, but cannot use termui as well as the webui. Termui works without having any bugs by the way. When I tried to add new bug, it shuts the CLI down, so cannot see the error log.
Does git work in this repo ?
It does.
Is there an error reported in the console when running as a normal user ?
Normally there is none. But as I mentioned above, when I add a new bug, every git-bug command started to fail. Even ls. Even with the sudo. Though there is an exception here, when I use webui with sudo, it does not crash and I can see the bug that I've created.
Can you try by choosing a port yourself with git bug webui -p 1234 ?
Same as above. Unless I am root, it does not listen the port.
Michael Muré (MichaelMure) commented
Can you make sure that every file in your repo has normal permission and can be read/write by your user instead of just root ? Something like chown -R <user>:<user> ..
Otherwise I don't see any reason why git-bug would require root access. Ignoring some cache files written directly in .git/git-bug/, all interaction with the repo are done through git itself. If git woks, git-bug should work as well.
Taylan Dogan (kondanta) commented
I did make sure all of the folders are belong to my $USER. I'll try to compile the source code and use that binary to check there is something related with that.
I think this issue can be closed since I am the only one having this and there is no actual steps to reproduce this issue on another machine. If I find something, I'll send a PR request.
Michael Muré (MichaelMure) commented
Alright, let's do that.
If you manage to run a debugger and see in more detail where it fails, it would be useful.