]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_db: improve error message when unknown btree type given to btheight
authorDarrick J. Wong <djwong@kernel.org>
Thu, 16 Jan 2025 21:22:04 +0000 (13:22 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 16 Jan 2025 21:27:27 +0000 (13:27 -0800)
commitc414a08700c550b1d4071e2d19325f004df4a5da
tree82204f45f0a19b6135a279640b9febbef9f89f54
parentfe9efcb37d1f07530c6fe59a9c2ab7a1182a3fac
xfs_db: improve error message when unknown btree type given to btheight

I found accidentally that if you do this (note 'rmap', not 'rmapbt'):

xfs_db /dev/sda -c 'btheight -n 100 rmap'

The program spits back "Numerical result out of range".  That's the
result of it failing to match "rmap" against a known btree type, and
falling back to parsing the string as if it were a btree geometry
description.

Improve this a little by checking that there's at least one semicolon in
the string so that the error message improves to:

"rmap: expected a btree geometry specification"

Fixes: cb1e69c564c1e0 ("xfs_db: add a function to compute btree geometry")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
db/btheight.c