[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#595790: [Pkg-zfsonlinux-devel] Bug#595790: hostid: useless unless fixed



On Wed, Sep 28, 2016 at 11:11:21PM +0200, Petter Reinholdtsen wrote:
[Michael Stone]
Other platforms have deprecated gethostid, that's the best way forward for
linux, IMO.

Which platforms is this?  I find FreeBSD recommend to use sysctl and
KERN_HOSTID to get the hostid integer directly from the kernel instead
of using gethostid(), which isn't really depricating the feature, only
the way to get access to it.  A quick search did not show any other
platforms depricating the function and feature, so I am curious to learn
what those are.

openbsd deprecates it, netbsd doesn't have it at all. neither of those platforms is likely to have a useful value unless you set it yourself. I'd wonder where this *is* expected to be useful value more than I'd wonder where it isn't.

My proposal is to use the DMI info which should stay the same
independent of OS installation.

Which doesn't exist on many, many platforms. If you need an ID tied to the hardware that's the one to use, but you have to know that the hardware you're deploying to actually supports that feature.

The users I am aware of is zfs-linux and the tools we wrote at work to
detect when a Linux machine was reinstalled or had its hardware changed.

For the latter case, just use the smbios values directly (assuming you're buying enterprise style hardware, it should support machine uuids.) That way you know that you're getting something tied to the hardware, instead of hoping.

The use case of zfs-linux require the ID to be unique among the machines
sharing a storage solution, and not globally unique.

I can't understand why, for that use case, zfs-linux wouldn't simply create a uuid itself. I see no obvious advantage in the program trying to fix the semantics of a fundamentally broken function that was introduced in BSD in the 80s and was removed from BSD itself back in the 90s.

A search in the source of all Debian packages[1] show this list of 148
packages mentioning the string 'gethostid': actiona alpine amanda
apcupsd aplus-fsf arpwatch ats-lang-anairiats audit bacula bareos
bluefish bsdgames burp busybox casacore cde cdrdao cdrkit
chromium-browser cl-irc clisp cmucl condor coreutils ctwm cython dc3dd
dcmtk deheader deja-dup dicom3tools dietlibc dist dmtcp dx e17
eclipse-titan edk2 emscripten erlang facter fpc frama-c freebsd-utils
freetds fs-uae ga gcc-h8300-hms gdb ghc glibc gnucash gnulib
gnustep-netclasses golang golang-1.6 golang-1.7 golang-golang-x-sys
hercules highlight hugs98 hurd iputils isdnutils ivtools kfreebsd-10
krb5 ksh latrace ldc libcanberra libconvert-binary-c-perl
libdata-uuid-perl libexplain libpam-tacplus libpcap libposix-2008-perl
linux linux-grsec ltrace lua-posix manpages manpages-de manpages-es
manpages-fr manpages-ja manpages-pl metview minc-tools mingw-w64 mono
mono-reference-assemblies musl nam ncbi-tools6 netatalk newlib nim nmap
nordugrid-arc ns2 ntirpc nwchem open-iscsi open-vm-tools openafs openmpi
otp pidgin pidgin-nateon pimd polygraph praat prayer pulseaudio
python-ptrace qemu radare2 rat roaraudio samhain sbcl silo-llnl sipxtapi
slirp smlnj sniffit spl-linux splint strace talksoup.app tau tcpdump
tcpslice tkrat topal trinity tripwire uclibc uclmmbase uhd uw-imap vde2
xfsdump yap zephyr zfs-fuse zfsutils.

I do not know what they use gethostid() for. :)

Pulling a couple at random:
libpcap -- the only occurance is in lbl/os-sunos4.h which is basically a list of function prototypes from a long obsolete OS for historic curiosity.

xfsdump -- honestly seems like a bug or at least a misunderstanding: ghdrp->gh_ipaddr = ( uint64_t )( unsigned long )gethostid( )

cdrdao -- questionable assumption in scsi-sun.c:
cpu_type = gethostid() >> 24

burp -- contains a couple of prototypes for the function, checks for it in configure, doesn't seem to actually use it

This really is a function with no current value that should just be forgotten. And certainly don't make random assumptions about the value it returns.

Mike Stone


Reply to: