Ulf,

My only other suggestion for avoiding manually specifying O_BINARY and O_TEXT 
would be to override the open call on Windows and use O_BINARY as the default 
and switch to O_TEXT on a condition. Maybe that condition could be based on the 
file signature or some other analysis of the file contents. Probably not the 
most efficient or deterministic solution, but it's the only alternative I can 
think of. Specifying O_BINARY and O_TEXT is probably the better option. Gnulib 
states that O_BINARY and O_TEXT are "essential for portability to native 
Windows platforms" 
https://www.gnu.org/software/gnulib/manual/html_node/fcntl_002eh.html

Best,
Colin
________________________________
From: Ulf Hermann <ulf.herm...@qt.io>
Sent: Friday, September 15, 2023 01:57
To: McAllister, Colin <colin.mcallis...@garmin.com>; 
elfutils-devel@sourceware.org <elfutils-devel@sourceware.org>
Subject: Re: Building Elfutils with Mingw32

CAUTION - EXTERNAL EMAIL: Do not click any links or open any attachments unless 
you trust the sender and know the content is safe.


Indeed I have noticed the other patches, but I don't think they are the
same as mine. So, now we have a three way merge.

I guess some more of the changes could be merged if properly cleaned up
and made to benefit other obscure platforms, too. However, there are a
few I got a definite "no" for. In particular the windows dance around
text/binary mode when opening files was not welcome. I couldn't come up
with a better solution than adding an O_BINARY or O_TEXT to every single
open() call. We actually need the distinction as some files need to be
opened in text mode for the tests to pass. If you can come up with
anything better here, please let me know.

best regards,
Ulf

Reply via email to