xfsprogs: mkfs.xfs replace assert on 0 size file with error and usage
PATCH 1/1 xfsprogs: mkfs.xfs replace assert on 0 size file with error and usage
Running mkfs.xfs on zero size file ends up with assert() and coredump. It would be better the print error message and usage.
--- mkfs/xfs_mkfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mkfs/xfs_mkfs.c +3 -1
@@ -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)) {
Signature · 1 line
2.54.0
Quoted 2 lines · Lukas Herbolt
Running mkfs.xfs on zero size file ends up with
assert()and coredump. It would be better the print error message and usage.
Looks good:
It would be nice to add a generic xfstests case to try mkfs on zero size files, and maybe also weird things like character devices and sockets to test the error handling in case you're looking for another little project in this area.
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Lukas Herbolt
Running mkfs.xfs on zero size file ends up with
assert()and coredump. It would be better the print error message and usage.
Quoted 8 lines
Looks good:
Reviewed-by Christoph Hellwig <[email protected]>It would be nice to add a generic xfstests case to try mkfs on zero size files, and maybe also weird things like character devices and sockets to test the error handling in case you're looking for another little project in this area.
Hmm, I thought about the test. Thanks for the suggestion for the "weird" files. I will look into it.
Signature · 1 line
-lhe