git-learning-game / oh-my-git

An interactive Git learning game!
https://ohmygit.org
Other
2.04k stars 146 forks source link

Crash on Linux with non-standard XDG_DATA_HOME #83

Closed elor closed 3 years ago

elor commented 3 years ago

Related to #81, but not identical: This crash occurs regardless of the home directory.

Problem

oh-my-git crashes ~0.5 seconds after opening any scenario. Complete console output below.

Reproduction steps

  1. export XDG_DATA_HOME=/tmp/somedirectory
  2. ./oh-my-git
  3. open any scenario
  4. oh-my-git crashes with ERROR: call: Refusing to delete directory /tmp/somedirectory/Oh My Git/tmp/repos/yours/ that does not start with /home/$USER/.local/share/Oh My Git/tmp/

Note

Complete console output

Godot Engine v3.2.3.stable.official - https://godotengine.org
Godot Engine v3.2.3.stable.official - https://godotengine.org
ERROR: call: Refusing to delete directory /tmp/e.lorenz-data/Oh My Git/tmp/repos/yours/ that does not start with /home/e.lorenz/.local/share/Oh My Git/tmp/
   At: modules/gdscript/gdscript_functions.cpp:803.
ERROR: call: OS.execute failed: bash [-c, "'export HOME='"'"'/tmp/e.lorenz-data/Oh My Git/tmp/'"'"';export PATH='"'"'/tmp/e.lorenz-data/Oh My Git/tmp/:'"'"'"$PATH";cd '"'"'/tmp/e.lorenz-data/Oh My Git/tmp/'"'"' || exit 1;mkdir '"'"'/tmp/e.lorenz-data/Oh My Git/tmp/repos/yours/'"'"''"] Output: mkdir: das Verzeichnis »/tmp/e.lorenz-data/Oh My Git/tmp/repos/yours/“ kann nicht angelegt werden: Die Datei existiert bereits

Exit Code 1
   At: modules/gdscript/gdscript_functions.cpp:803.
WARNING: cleanup: ObjectDB instances leaked at exit (run with --verbose for details).
   At: core/object.cpp:2135.
ERROR: clear: Resources still in use at exit (run with --verbose for details).
   At: core/resource.cpp:477.
ERROR: cleanup: Condition "allocs_used > 0" is true.
   At: core/pool_vector.cpp:69.
Godot Engine v3.2.3.stable.official - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce GTX 1050 Ti/PCIe/SSE2

FATAL ERROR: Refusing to delete directory /tmp/e.lorenz-data/Oh My Git/tmp/repos/yours/ that does not start with /home/e.lorenz/.local/share/Oh My Git/tmp/
FATAL ERROR: OS.execute failed: bash [-c, "'export HOME='"'"'/tmp/e.lorenz-data/Oh My Git/tmp/'"'"';export PATH='"'"'/tmp/e.lorenz-data/Oh My Git/tmp/:'"'"'"$PATH";cd '"'"'/tmp/e.lorenz-data/Oh My Git/tmp/'"'"' || exit 1;mkdir '"'"'/tmp/e.lorenz-data/Oh My Git/tmp/repos/yours/'"'"''"] Output: mkdir: das Verzeichnis »/tmp/e.lorenz-data/Oh My Git/tmp/repos/yours/“ kann nicht angelegt werden: Die Datei existiert bereits

Exit Code 1
blinry commented 3 years ago

Thanks! :) Godot uses a special "user://" path internally for the user data directory, and it seems safe to just rely on that on each platform.