mirror_zfs/cmd
Érico Rolim 9c4b6dbb31 zgenhostid: accept hostid arguments equal to zero.
A common usage pattern for zgenhostid, including in the ZFS dracut
module, is running it as:

  zgenhostid $(hostid)

However, zgenhostid only accepted hostid arguments greater than 0, which
meant that, when the output of hostid(1) was "00000000", zgenhostid
would error out, even though 0 is a possible return value for the
gethostid(3) function used by hostid(1):

- On current musl libc, gethostid(3) is a stub that always returns 0.
- On glibc, gethostid(3) will return 0 if /etc/hostid exists but is
  smaller than 4 bytes.

In these cases, it makes more sense for zgenhostid to treat a value of 0
as other parts of the zfs codebase do, meaning that a hostid value
couldn't be determined; therefore, it should attempt to generate a
random value to write into /etc/hostid.

The manpage and usage output have been updated to reflect this.

Whitespace has also been fixed in the usage output.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Reviewed-by: Andrew J. Hesford <ajh@sideband.org>
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
Closes #11174
Closes #11189
2020-11-14 17:20:54 -08:00
..
arc_summary Remove UIO_ZEROCOPY functions structures 2020-10-30 10:00:33 -07:00
arcstat arcstat: Add -a and -p options from FreeNAS 2020-10-21 14:09:14 -07:00
dbufstat Make dbufstat work on FreeBSD 2020-10-08 09:40:23 -07:00
fsck_zfs Fix typos in cmd/ 2019-08-30 09:43:30 -07:00
mount_zfs Fix memleak in cmd/mount_zfs.c 2020-11-10 15:50:44 -08:00
raidz_test Distributed Spare (dRAID) Feature 2020-11-13 13:51:51 -08:00
vdev_id Silence 'make checkbashisms' 2020-08-20 13:45:47 -07:00
zdb Distributed Spare (dRAID) Feature 2020-11-13 13:51:51 -08:00
zed Distributed Spare (dRAID) Feature 2020-11-13 13:51:51 -08:00
zfs Distributed Spare (dRAID) Feature 2020-11-13 13:51:51 -08:00
zfs_ids_to_path Use abs_top_builddir when referencing libraries 2020-07-10 14:26:32 -07:00
zgenhostid zgenhostid: accept hostid arguments equal to zero. 2020-11-14 17:20:54 -08:00
zhack Unconditionally enable debugging for libzpool 2020-07-10 15:30:31 -07:00
zinject Use abs_top_builddir when referencing libraries 2020-07-10 14:26:32 -07:00
zpool Assertion failure when logging large output of channel program 2020-11-14 10:17:16 -08:00
zpool_influxdb Ignore zpool_influxdb binary 2020-10-16 13:21:28 -07:00
zstream Add support to decode a resume token 2020-07-23 17:44:03 -07:00
zstreamdump Minor zstream redup command fixes 2020-04-10 21:10:09 -07:00
ztest Distributed Spare (dRAID) Feature 2020-11-13 13:51:51 -08:00
zvol_id Replace ZFS on Linux references with OpenZFS 2020-10-08 20:10:13 -07:00
zvol_wait zvol_wait should ignore redacted zvols 2019-11-06 10:51:19 -08:00
Makefile.am Add zpool_influxdb command 2020-10-09 09:29:21 -07:00