https://sourceware.org/bugzilla/show_bug.cgi?id=29292
--- Comment #3 from Nick Alcock <nick.alcock at oracle dot com> --- Thank you for the report! The advantage of the mmap dance is purely that it makes writing out the header simpler: we can jump around in it and just treat it like a data structure rather than messing about with serialization and writes and seeks. However... the entire archive format is being rewritten right now for CTFv4 into something very much simpler, based on concatenated CTFv4/BTF with an extra link header chaining them together: so the existing archive-creation code is in any case not long for this world, and the new one is going to be a much thinner wrapper around dict serialization, with no mmap in the picture. (The current archive format will still be read, but not written.) Mixed mmap() and read() from the same fd is absolutely nonportable (or at the very least delicate and breaks frequently, as seen here) and we should not be doing it. Unfortunately with a temporary file this is hard to avoid... I had hoped the msync() would fix this, and until now it seemed to. I wonder if dupping the fd would help, but I suspect not. I'll see if I can thrash about and find some way to do this without rewriting all the header-writing code I'm in the middle of literally deleting on another branch anyway! -- You are receiving this mail because: You are on the CC list for the bug.