Hi Samuel,

I have rebuilt my libc with a patch to just increase the buffer size from 8 to 
9 to have space for the NUL and can confirm that it is enough to fix the issue.

As Alperen Erkan was faster to send a diff should they make that a proper patch 
you can apply or should I do that?

Thanks,
Y.

Nov 29, 2026, 14:25 by [email protected]:

> Hello,
>
> yelninei--- via Bug reports for the GNU Hurd, le sam. 28 nov. 2026 21:28:33 
> +0100, a ecrit:
>
>> - After a successfull sethostid () /etc/hostid has the id in hex.
>> - gethostid fails to read it back. _hurd_get_host_config fails with 
>> ENAMETOOLONG causing gethostid to return -1.
>>
>> The reason is that _hurd_get_host_config always tries to null-terminate the 
>> given buffer however gethostid passes a buffer that is just large enough to 
>> contain the contents as the id has a fixed size and a trailing null is not 
>> really neccessary.
>>
>> Should that just use a bigger buffer?
>>
>
> That should be fine yes.
>
>> I dont know if this ever worked or if the hostid was a casualty of making 
>> sure the return is null-terminated which seems reasonable for the hostname 
>> as the hostid is not really used much.
>>
>
> _hurd_get_host_config probably got modified at some point without
> checking whether gethostid is still working.
>
> Samuel
>


Reply via email to