Repository navigation
Keep file permissions on video exports - #48
Merged
Merged
Conversation
Exports were made with g_mkstemp, which always creates 0600, and the rename carried that mode into place. Every export came out readable by us alone, unlike the recording it came from, and Replace Original dropped the original's mode too. The partial file is now made 0666 under the umask, like the recorder's. Just before the rename it takes the mode of the file it replaces: the file at the target, or the original when Replace Original writes it under another extension. That original is passed down, because the export only knew the target path. Only the rwx bits are copied. A failed chmod, as on a file system with no permissions, keeps the export as it is and doesn't fail it. The partial file is also fsync'd before the rename, as the recorder does, so a crash right after Replace Original can't leave the original's name on an empty file. Fixes #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
/video-export/permissionstest covers a new file, overwriting a file, and replacing under another extension.0600mode (384 != 420) and passes with the fix.