diff options
author | Érico Rolim <[email protected]> | 2020-11-10 11:22:27 -0300 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-11-14 17:20:54 -0800 |
commit | 9c4b6dbb314cabd14746527c0865d98300ea5190 (patch) | |
tree | aea1a23896b8570d9a2f0da78ad42a4f9cc58836 /man/man8 | |
parent | 4352edaafb5fba9b98b6ac4987b576bbc333f68a (diff) |
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 <[email protected]>
Reviewed-by: Georgy Yakovlev <[email protected]>
Reviewed-by: Andrew J. Hesford <[email protected]>
Signed-off-by: Érico Rolim <[email protected]>
Closes #11174
Closes #11189
Diffstat (limited to 'man/man8')
-rw-r--r-- | man/man8/zgenhostid.8 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/man/man8/zgenhostid.8 b/man/man8/zgenhostid.8 index ff198443d..14264cb8c 100644 --- a/man/man8/zgenhostid.8 +++ b/man/man8/zgenhostid.8 @@ -54,7 +54,8 @@ instead of default .It Ar hostid Specifies the value to be placed in .Pa /etc/hostid . -It must be a number with a value between 1 and 2^32-1. +It should be a number with a value between 1 and 2^32-1. +If it is 0, zgenhostid will generate a random hostid. This value .Sy must be unique among your systems. |