godotengine / godotengine/godot
Engine fails silently when the debug log path contains a nonexistent directory
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Reproducable in
- Godot Engine v4.3.rc3.mono.official (03afb92efa18874da19f7fc185a32c005d20aa1d),
- Godot Engine v4.2.2.stable.mono.official.(15073afe3),
- Godot Engine v4.2.1.stable.mono.official.(b09f793f5),
- Godot Engine v4.0.stable.mono.official.(92bee43ad),
- v4.1.stable and v3.5.stable
### System information
Godot v4.3.rc3 - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1050 Ti (NVIDIA; 31.0.15.5123) - Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 Threads)
### Issue description
## About the issue:
When a project setting: debug/file_logging/log_path is set to a relative path with a directory that doesn't exist, the engine will crash. This is not an issue if the directory exists and not an issue if it's an absolute path with directories that don't exist.
The values I tried:
./logs/godot.log - Crashes
/logs/godot.log - Creates the logs directory and file in the root of disk C:
logs/godot.log - Crashes
In all of those cases the logs directory don't exist. Tried variations with `//` , `\\` and `\` still crashing
All of my tests were on new projects, the crash is not .NET/Mono dependent
The engine silently crashes for 4.2.2 version and below, it wont display information in the console.
The newest rc version on the website (Godot Engine v4.3.rc3.mono.official (03afb92efa18874da19f7fc185a32c005d20aa1d)) will output a message in an console when using the console version. (See below)
```
================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.3.rc3.mono.official (03afb92efa18874da19f7fc185a32c005d20aa1d)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================
```
## What I expected:
I expected it to try to create the missing directories when a relative path is used or if it fails then an error to be displayed in the console and debugger or a popup to be used if it's impossible to display it on the debugger, or default log position to be used so that error can be visible in the editor debugger or output.
I would understand if this is not supposed to contain a relative path and instead is supposed to operate on user://, although the possibility of relative paths would be best.
### Steps to reproduce
1. Create a new godot project.
2. Create a node so you can run the project.
3. Change the debug/file_logging/log_path value to a relative path with a nonexistent directory in it.
And that's it
### Minimal reproduction project (MRP)
N/A
Contributor guide
Research direction
Start by reproducing the crash in a new Godot project using debug/file_logging/log_path with a relative path containing a nonexistent directory, comparing it with an absolute path. Trace the debug file-logging path handling and verify that missing directories no longer crash silently and that an error or fallback is visible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100