https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115190
Nathaniel Shead <nshead at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2025-02-02 Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot gnu.org Ever confirmed|0 |1 CC| |nshead at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #9 from Nathaniel Shead <nshead at gcc dot gnu.org> --- Created attachment 60351 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60351&action=edit potential fix Confirmed. There's actually two separate errors here depending on whether `MAPPED_READING` is defined. When using mmap, any '\r' are treated as normal characters, and so e.g. a modmap with 'test test.gcm\r\n' would (attempt) to output to a module file 'test.gcm\r'; this would work fine on Linux (or WSL), but Windows forbids control characters in filenames. When not using mmap, since the file descriptor is opened in text mode (in module_client::open_module_client), as noted in comment #7 the size of the read may not match the size of the file. In general I'm not convinced that mmap is super appropriate for this case where we're reading a file in once, start-to-finish. So maybe the way to go is to remove the mmap case to reduce complexity and fix the assumption on file size, like the attached. But maybe it'd even be worth handling '\r' in module mapper files on Linux (e.g. if copied from Windows?)