Skip to content

direct: keep the state file's mode when saving - #6364

Open
denik wants to merge 2 commits into
mainfrom
denik/dstate-save-preserve-mode
Open

direct: keep the state file's mode when saving#6364
denik wants to merge 2 commits into
mainfrom
denik/dstate-save-preserve-mode

Conversation

@denik

@denik denik commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Since v1.13.0 the state file is written as a temp file and renamed into place. A temp file always starts at 0o600, so an existing state file that was deliberately readable to a group or to CI narrowed on every save — writing in place used to leave the mode alone.

Carry the replaced file's mode over to the temp file before the rename.

Saving writes a temp file and renames it into place, and a temp file always
starts at 0o600, so an existing state file that was deliberately readable to
a group or to CI narrowed on every save. Writing in place, before v1.13.0,
left the mode alone.

Carry the replaced file's mode over to the temp file before the rename.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown
Contributor

Approval status: pending

/bundle/ - needs approval

Files: bundle/direct/dstate/state.go, bundle/direct/dstate/state_test.go
Suggested: @janniklasrose
Also eligible: @shreyas-goenka, @andrewnester, @pietern, @lennartkats-db, @anton-107

General files (require maintainer)

Files: .nextchanges/bundles/state-save-preserve-mode.md
Based on git history:

  • @janniklasrose -- recent work in .nextchanges/bundles/, bundle/direct/dstate/

Any maintainer (@andrewnester, @anton-107, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db, @rugpanov, @rclarey) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: a99ea12

Run: 32731804449

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 1 4 274 1167 9:38
🔄​ aws windows 1 1 4 275 1165 8:34
💚​ azure linux 1 4 273 1167 11:55
💚​ azure windows 1 4 275 1165 7:21
💚​ gcp linux 1 4 274 1167 9:15
💚​ gcp windows 1 4 276 1165 7:11
6 interesting tests: 4 SKIP, 1 RECOVERED, 1 flaky
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestSyncFullFileSync ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p
Top 13 slowest tests (at least 2 minutes):
duration env testname
4:14 gcp windows TestAccept
4:10 aws windows TestAccept
3:49 gcp windows TestFilerWorkspaceFilesExtensionsReadDir
3:10 azure windows TestAccept
3:02 azure windows TestFilerWorkspaceFilesExtensionsDelete
2:54 aws linux TestFilerRecursiveDelete/workspace_files_extensions
2:45 gcp windows TestSyncIncrementalFileSync
2:36 azure linux TestWorkspaceFilesExtensions_ExportFormatIsPreserved/jupyter_r
2:33 aws linux TestFilerWorkspaceFilesExtensionsDelete
2:25 gcp windows TestFilerWorkspaceFilesExtensionsDelete
2:12 aws windows TestFilerWorkspaceFilesExtensionsStat
2:11 azure windows TestFilerWorkspaceFilesExtensionsReadDir
2:10 aws windows TestFilerWorkspaceFilesExtensionsReadDir

…kept

Persisting the state matters more than its mode, so neither the stat nor the
chmod should abort the save.

Co-authored-by: Isaac
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.

2 participants