Current-Users archive

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

Re: getmntinfo compatibility question



On Thu, 13 Feb 2025, Thomas Klausner wrote:

[...]
So currently my best hunch about the problem is that there was a bug
in versioning getmntinfo, or that rust calls the wrong version of
getmntinfo, and gets the new statvfs struct where all the char fields
are moved around by 16 bytes, but parses it using the old struct
definition, and chaos ensues.


I think you're right. With the `struct statvfs' from NetBSD-9.x (which is
what Rust's copied), rust's libc would have to call `__getmntinfo13()'
on NetBSD-10+. If you compiled that crate, or your program on 10+, then
`__getmntinfo90()' is what will called, and that will expect the newer
structure.

NetBSD compat bits are to allow (older) binaries to run on newer OS versions.
It won't help in this case, where you're compiling on 10+ and a) using a
structure from 9.x in a 10.x syscall.

I suspect you won't see any issues if you compile both your code and the
libc crate on 9.x, then bring _that_ binary into -HEAD (even) and run it there.

Some Rust `#cfg[]' magic is certainly reqd...

-RVP

PS. Does `readelf -Wa rust-getmntinfo'` show `getmntinfo' or `__getmntinfo13'
or `__getmntinfo90' ? I suspect either getmntinfo() or __getmntinfo90(). (Most
likely the former, I would guess.)


Home | Main Index | Thread Index | Old Index