Skip to content

CurrentUsername is not always reliable #1640

Closed
@IzzySoft

Description

@IzzySoft
  • Gitea version (or commit ref): 1.1.0
  • Git version: 2.1.4
  • Operating system: Bananian (based on Debian Jessie)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

This is an issue existing with Gogs as well (but not considered an issue by Unknwon):

When starting Gitea via e.g. init.d using start-stop-daemon (defining the correct user/group), I get the following error:

[...s/setting/setting.go:801 NewContext()] [E] Expect user 'git' but current user is: root

Took me a while to figure (and only the linked Gogs issue brought me on the right path): the environment variable $USER still points to root, though id -un as well as whoami indicate the script is running under the correct user (i.e. git:git). I've worked around that using a shell script, prefixing the gitea web command by a line stating USER=$(id -un) – but shouldn't Gitea figure that itself? Some other users might give up before figuring :)

And while on it: is there a way to tell Gitea it should run in "daemon mode" instead of "in foreground" – other than using &?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/questionIssue needs no code to be fixed, only a description on how to fix it yourself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions