Skip to content

fix(autoconfig): replace existing preset contents - #179

Merged
SuperKali merged 1 commit into
armbian:mainfrom
Guflly:fix/autoconfig-overwrite-existing-file
Aug 14, 2026
Merged

fix(autoconfig): replace existing preset contents#179
SuperKali merged 1 commit into
armbian:mainfrom
Guflly:fix/autoconfig-overwrite-existing-file

Conversation

@Guflly

@Guflly Guflly commented Aug 8, 2026

Copy link
Copy Markdown

Existing ext4 files were opened with w+, but the vendored filesystem ignored O_TRUNC. Shorter presets kept the previous tail and failed validation.

This honors truncation on open and adds a regression test for replacing a 420-byte file with 382 bytes.

Closes #178

@henla464

henla464 commented Aug 8, 2026

Copy link
Copy Markdown

Thank you, super quick solution :)

@SuperKali

Copy link
Copy Markdown
Member

Thanks @Guflly i'll check asap.

@SuperKali SuperKali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on a real mke2fs image with /root/.not_logged_in_yet already present: main reproduces #178, this branch writes 382 bytes and validates, partitioned path included. One for later: the freed block never gets cleared in the bitmap, because ext4_bmap_bits_free is called with a count where it expects an end index, so every rewrite leaks one block. resize2fs handles the result fine, we will fix that one on our side.

@SuperKali
SuperKali merged commit f4a763c into armbian:main Aug 14, 2026
7 of 8 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.

[Bug]: autoconfig: Failed to inject preset: validation failed: /root/.not_logged_in_yet content mismatch: wrote 382 bytes, read 420 bytes

3 participants