HomeFreeBSD

libzutil: zfs_isnumber(): return false if input empty

Description

libzutil: zfs_isnumber(): return false if input empty

zpool list, which is the only user, would mistakenly try to parse the
empty string as the interval in this case:

$ zpool list "a"

cannot open 'a': no such pool

$ zpool list ""

interval cannot be zero

usage: <usage string follows>

which is now symmetric with zpool get:

  $ zpool list ""
  cannot open '': name must begin with a letter

Avoid breaking the "interval cannot be zero" string.
There simply isn't a need for this, and it's user-facing.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11841
Closes #11843

Details

Provenance
наб <nabijaczleweli@nabijaczleweli.xyz>Authored on Apr 6 2021, 7:25 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Apr 7 2021, 8:27 PM
Parents
rGe2f5074c0f63: ZTS: pool_checkpoint improvements
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGd09e1c134307: libzutil: zfs_isnumber(): return false if input empty (authored by наб <nabijaczleweli@nabijaczleweli.xyz>).Apr 7 2021, 8:27 PM