Skip to content

Conversation

PatTheMav
Copy link
Member

Description

Moves crash sentinel files into their own subdirectory inside the application configuration directory to ensure that clean-up operations will not encounter important user data.

Motivation and Context

Putting the crash sentinel in the main "obs-studio" directory carries the risk of unwanted deletion of files in the same directory, which usually contains user configuration files like "user.ini" and "global.ini".

Even though the code will ignore any file that does not start with the crash sentinel prefix string, the code itself would allow changing the prefix to "global.ini" and thus inadvertently delete the global configuration file as well.

To further reduce the risk, this change will put the sentinels in a separate sub-directory that should only ever contain sentinel files, all of which can possibly deleted without any data loss for the user.

While the potential error case is hypothetical, application configuration data is important enough to err on the side of caution here.

How Has This Been Tested?

Tested on macOS 15 with a clean run of OBS Studio and confirmed that the non-existing subdirectory is created on launch and the sentinel file placed, as well as removed on successful shutdown only. Also checked that any prior sentinels are correctly removed on a successful shutdown.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@PatTheMav PatTheMav force-pushed the harden-crash-sentinel branch from de723ed to 1c16363 Compare August 29, 2025 15:26
@RytoEX RytoEX self-assigned this Aug 29, 2025
@RytoEX RytoEX added the Enhancement Improvement to existing functionality label Aug 29, 2025
@RytoEX RytoEX added this to the OBS Studio 32.0 milestone Aug 29, 2025
@RytoEX RytoEX requested a review from derrod August 29, 2025 17:38
Putting the crash sentinel in the main "obs-studio" directory carries
the risk of unwanted deletion of files in the same directory, which
usually contains user configuration files like "user.ini" and
"global.ini".

Even though the code will ignore any file that does not start with the
crash sentinel prefix string, the code itself would allow changing the
prefix to "global.ini" and thus inadvertently delete the global
configuration file as well.

To further reduce the risk, this change will put the sentinels in a
separate sub-directory that should only ever contain sentinel files,
all of which can possibly deleted without any data loss for the user.
@PatTheMav PatTheMav force-pushed the harden-crash-sentinel branch from 1c16363 to 12250fa Compare September 3, 2025 13:13
@RytoEX RytoEX merged commit e8d4224 into obsproject:master Sep 3, 2025
15 checks passed
@PatTheMav PatTheMav deleted the harden-crash-sentinel branch September 3, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants