From: Yifan Zhao <stopire@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: xiang@kernel.org, Yifan Zhao <stopire@gmail.com>
Subject: [PATCH 1/4] erofs-utils: fsck: fix hole handling during extraction
Date: Thu, 17 Sep 2026 11:53:46 +0800 [thread overview]
Message-ID: <20260917035349.1339521-1-stopire@gmail.com> (raw)
Fix the following two issues in fsck.erofs --extract:
- Trailing holes leave extracted files too short.
- With --xattr-inode-digest, holes are hashed without advancing the
output offset, so subsequent data is written at an earlier offset.
Assisted-by: Codex:gpt-6-astra
Signed-off-by: Yifan Zhao <stopire@gmail.com>
---
fsck/main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fsck/main.c b/fsck/main.c
index b2d8f1a..55da9ea 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -569,7 +569,8 @@ static int erofs_verify_inode_data(struct erofs_inode *inode, int outfd,
(const u8 *)zeros, chunk);
remain -= chunk;
}
- } else if (outfd >= 0) {
+ }
+ if (outfd >= 0) {
ret = lseek(outfd, map.m_llen, SEEK_CUR);
if (ret < 0) {
ret = -errno;
@@ -855,6 +856,11 @@ again:
}
ret = erofsfsck_calc_inode_data(inode, fd);
+ if (!ret && ftruncate(fd, inode->i_size)) {
+ ret = -errno;
+ erofs_err("failed to set file size: %s (%s)",
+ fsckcfg.extract_path, strerror(-ret));
+ }
close(fd);
return ret;
}
--
2.55.0
next reply other threads:[~2026-09-17 3:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 3:53 Yifan Zhao [this message]
2026-09-17 3:53 ` [PATCH 2/4] erofs-utils: mkfs: validate chunksize before computing chunkbits Yifan Zhao
2026-09-17 3:53 ` [PATCH 3/4] erofs-utils: lib: fix rebuilding empty chunk-based files Yifan Zhao
2026-09-17 3:53 ` [PATCH 4/4] erofs-utils: fsck: avoid truncating lseek() return values Yifan Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260917035349.1339521-1-stopire@gmail.com \
--to=stopire@gmail.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox