Skip to content

Preserve target file metadata when updating managed sections #7

Description

@codeforester

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

  • ./tests/validate.sh

Suggested Branch

bug/<issue>-20260618-preserve-file-metadata

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions