Skip to content

Keep file permissions on video exports - #48

Merged
faetalize merged 1 commit into
masterfrom
fix/export-permissions
Oct 30, 2026
Merged

faetalize merged 1 commit into
masterfrom
fix/export-permissions

Conversation

@faetalize

Copy link
Copy Markdown
Owner

Summary

  • New video exports are readable by others like recordings, not only by us.
  • Replace Original keeps the original file's permissions, whether the new file has the same name or a different extension.
  • Only the read, write and execute bits are copied.
  • If permissions can't be set, for example on a FAT drive, the export still succeeds.
  • Finished exports are flushed to disk before they are renamed into place, so a crash can't leave the original's name on an empty file.
  • Fixes Video exports are always created with mode 0600 (and "Replace Original" drops the original's permissions) #47

Testing

  • Full meson suite: 13 of 13 pass.
  • New /video-export/permissions test covers a new file, overwriting a file, and replacing under another extension.
  • The new test fails with the old 0600 mode (384 != 420) and passes with the fix.

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
@faetalize
faetalize merged commit e770838 into master Oct 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Video exports are always created with mode 0600 (and "Replace Original" drops the original's permissions)

1 participant