From: Lukas Herbolt <lukas@herbolt.com>
To: aalbersh@kernel.org
Cc: linux-xfs@vger.kernel.org, Lukas Herbolt <lukas@herbolt.com>
Subject: [PATCH] xfsprogs: mkfs.xfs replace assert on 0 size file with error and usage
Date: Mon, 25 May 2026 11:05:44 +0200 [thread overview]
Message-ID: <20260525090543.4178496-2-lukas@herbolt.com> (raw)
Running mkfs.xfs on zero size file ends up with assert() and coredump.
It would be better the print error message and usage.
Signed-off-by: Lukas Herbolt <lukas@herbolt.com>
---
mkfs/xfs_mkfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index dd8a48c3633e..3e83d336e8cf 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3851,7 +3851,9 @@ validate_datadev(
fprintf(stderr, _("can't get size of data subvolume\n"));
usage();
}
- ASSERT(cfg->dblocks);
+ fprintf(stderr,
+ _("data size must be specified for a zero-size file\n"));
+ usage();
} else if (cfg->dblocks) {
/* check the size fits into the underlying device */
if (cfg->dblocks > DTOBT(xi->data.size, cfg->blocklog)) {
--
2.54.0
next reply other threads:[~2026-05-25 9:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 9:05 Lukas Herbolt [this message]
2026-05-27 12:44 ` [PATCH] xfsprogs: mkfs.xfs replace assert on 0 size file with error and usage Christoph Hellwig
2026-05-27 18:20 ` Lukas Herbolt
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=20260525090543.4178496-2-lukas@herbolt.com \
--to=lukas@herbolt.com \
--cc=aalbersh@kernel.org \
--cc=linux-xfs@vger.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