nextcloud / docker

⛴ Docker image of Nextcloud
https://hub.docker.com/_/nextcloud/
GNU Affero General Public License v3.0
6.1k stars 1.83k forks source link

fix(entrypoint): set non-bogus `$HOME` when using `su` to avoid 3rd-party issues #2318

Open joshtrichards opened 1 month ago

joshtrichards commented 1 month ago

Fixes #2317 Fixes #2053 Fixes #1288

We preserve the environment - because we need it - when executing commands:

https://github.com/nextcloud/docker/blob/d03da64ac80d534c1b0ec69da3e6ddcc6af282a6/30/apache/entrypoint.sh#L14-L20

This doesn't cause issues typically, but since $HOME is carried over from root it can cause issues like #2317 / #2053 / #1288 that are challenging to diagnose.

It is kind of ugly that we carry over a bogus $HOME value. Since the path is also inaccessible, it's also pointless.

We might consider instead one of the following approaches:

This PR takes the second approach.

This should cut down on problems people encounter when running up against third-party tools that query $HOME. Since the value was already problematic, I can't think of any problems this will cause. It should not be a breaking change.