Context
update_file_section writes changes through a mktemp replacement and mv -f. That makes the replacement file's mode win. A normal 0644 target can become 0600 after an otherwise successful update.
This is surprising for shell profile files, shared config files, and any tracked file whose executable bit or permissions matter.
Scope
- Preserve target file permissions when replacing a file in
lib/bash/file/lib_file.sh.
- Preserve executable bits for scripts and other executable targets.
- Avoid weakening atomicity or rollback behavior.
- Add tests for at least one normal file mode and one executable file mode.
Acceptance Criteria
- Updating a
0644 file leaves it 0644.
- Updating an executable file leaves it executable.
- Existing idempotency and temp-file cleanup behavior remains intact.
Validation
Suggested Branch
bug/<issue>-20260618-preserve-file-metadata
Context
update_file_sectionwrites changes through amktempreplacement andmv -f. That makes the replacement file's mode win. A normal0644target can become0600after an otherwise successful update.This is surprising for shell profile files, shared config files, and any tracked file whose executable bit or permissions matter.
Scope
lib/bash/file/lib_file.sh.Acceptance Criteria
0644file leaves it0644.Validation
./tests/validate.shSuggested Branch
bug/<issue>-20260618-preserve-file-metadata