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

Re: Portability issue of C code



On 29 May 2025, at 04:06, Erwan MAS <erwan@mas.nom.fr> wrote:
> 
> Hi everyone , 
> 
> So i try to understand why a package do not work on Hurd .
> 
> After a few hours , i was able to isolate  the code, so now i have a very 
> simple code that expose the bug , my code is here https://paste.debian.net/plain/1377135 .
> 
> The issue is with getline from libc , when reading from a directory instead of a file .
> 
> So on Macos,Debian Linux,Alpine,FreeBsd  i have a error ( 21 / Is a directory ) ,
> BUT on Debian/Hurd , i am able to read data , it seem to read the content of the directory inode .
> 
> What do you think ? 
> 
> If this is not a bug , where i can find more information on it ?
> 
> If this is a bug where do i need to report ?
> 
> If this mailing-list is not the right media for speaking about this , where i can find more help ?

This is classic Unix behaviour that Linux does not implement. FreeBSD
used to behave this way but changed in 2020 to be more like Linux. See
https://github.com/freebsd/freebsd-src/commit/dcef4f65ae3978c50eab745f67364db4660a9f43
for more information, which is the FreeBSD commit that switched
behaviour. If you run your code on FreeBSD 12.0 or 12.1 (not 12.2 as
the changed was “MFC”ed, i.e. backported in FreeBSD development
terminology) you should observe the same behaviour as on GNU/Hurd today.

Jess


Reply to: