Created attachment 3381[details]
patch to correct the errorhandling-errors
There are two errors in function Sys_ErrorDialog() in code/sys/sys_unix.c.
This function tries to write to ~/.q3a/baseq3/crashlog.txt.
If its directory doesn't yet exist, it tries to create it and fails.
The first error is to use the filename of the file
and not its directory-name, so it creates a directory "crashlog.txt".
The second error is that it doesn't create all the parent-directories
should these be missing.
Attached is a patch which corrects these errors.
(In reply to comment #1)
> I'm not sure what code you're working with, but this was fixed 4 years ago
> in 5079343e. Reopen if you think there's still a problem.
It looks like Thilo Schulz changed sys_unix.c on 25-Aug-2013
and (re)introduced this bug.
Ah, my apologies. I was on a different branch so hadn't got that change yet.
Anyway, it looks like your fix essentially reverts Thilo's fix:
commit daf71ca50217c21edadc511feca4d4e9cf98a51a
Author: Thilo Schulz <thilo@tjps.eu>
Date: Sun Aug 25 12:00:30 2013 +0200
Fix recursive crash when home path cannot be created
I guess he means that FS_CreatePath fatals when it fails which is obviously bad when you're already handling a crash. I guess the solution is to use Sys_Mkdir(dirpath)?
(In reply to comment #3)
> Ah, my apologies. I was on a different branch so hadn't got that change yet.
>
> Anyway, it looks like your fix essentially reverts Thilo's fix:
>
> commit daf71ca50217c21edadc511feca4d4e9cf98a51a
> Author: Thilo Schulz <thilo@tjps.eu>
> Date: Sun Aug 25 12:00:30 2013 +0200
>
> Fix recursive crash when home path cannot be created
>
> I guess he means that FS_CreatePath fatals when it fails which is obviously
> bad when you're already handling a crash. I guess the solution is to use
> Sys_Mkdir(dirpath)?
This makes sense! But Sys_Mkdir() only creates the specified directory.
It doesn't do recursion and it doesn't remove the the filename-part
of the path. But it shouldn't be to difficult to implement this
functionality with Sys_Mkdir().
Created attachment 3381 [details] patch to correct the errorhandling-errors There are two errors in function Sys_ErrorDialog() in code/sys/sys_unix.c. This function tries to write to ~/.q3a/baseq3/crashlog.txt. If its directory doesn't yet exist, it tries to create it and fails. The first error is to use the filename of the file and not its directory-name, so it creates a directory "crashlog.txt". The second error is that it doesn't create all the parent-directories should these be missing. Attached is a patch which corrects these errors.
Created attachment 3382 [details] 2nd try - now with Sys_Mkdir() instead of FS_CreatePath()