On 7/30/20 3:16 PM, anonymous.maar...@gmail.com wrote:
From: Anonymous Maarten <anonymous.maar...@gmail.com>
autoconf uses binary data to filter out numerics, digits, ...
When m4, built using Visual Studio, is used as preprocessor, this fails.
With this change, there is no difference in the installed files when using m4
built with mingw,
or m4 buit with Visual Studio.
This patch is used in the m4 recipe for conan, a c/c++ package manager.
The build script of m4 can be found at [1].
[1] https://github.com/conan-io/conan-center-index/tree/master/recipes/m4
---
src/path.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/path.c b/src/path.c
index f13f3289..daaaaf65 100644
--- a/src/path.c
+++ b/src/path.c
@@ -110,7 +110,7 @@ add_include_directory (const char *dir)
static FILE *
m4_fopen (const char *file)
{
- FILE *fp = fopen (file, "r");
+ FILE *fp = fopen (file, "rb");
Thanks for the patch. However, I'm of the opinion that installing it
would be a violation of POSIX, which requires that m4 operate on text
files. Since m4 can insert or remove newlines as part of macro
definitions, operating in binary mode is very prone to creating
incorrect line endings for a text file. Yes, the POSIX definition of a
text file does NOT play nicely with Windows text files, but my
interpretation of POSIX is that using "rb" instead of "r" (on platforms
where it _does_ matter, since a true POSIX platform treats them
identically) is only safe to do in programs where POSIX requires the
utility to operate on all files, not just text files.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
_______________________________________________
M4-patches mailing list
M4-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/m4-patches