bug-gnulib
[Top][All Lists]
Advanced

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

aligned-malloc, rmdir-errno: Sanitize configuration test result


From: Bruno Haible
Subject: aligned-malloc, rmdir-errno: Sanitize configuration test result
Date: Thu, 15 Jun 2023 08:46:36 +0200

On native Windows, in a build's config.cache file, I see literal CRs:

gl_cv_malloc_alignment=${gl_cv_malloc_alignment=8^M}
gl_cv_func_rmdir_errno_not_empty=${gl_cv_func_rmdir_errno_not_empty=41^M}

These CRs occur also in the 'configure' output.

The cause is that a shell backquote `cat conftest.out` eliminates the
final LF from the output, but not the CR that precedes it.

The fix is trivial:


2023-06-15  Bruno Haible  <bruno@clisp.org>

        aligned-malloc, rmdir-errno: Sanitize configuration test result.
        * m4/malloc-align.m4 (gl_MALLOC_ALIGNMENT): Don't put a newline at the
        end of the conftest.out file.
        * m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Don't put a newline at the
        end of the confdir2/errno file.

diff --git a/m4/malloc-align.m4 b/m4/malloc-align.m4
index 11682da01a..0bbe1d95be 100644
--- a/m4/malloc-align.m4
+++ b/m4/malloc-align.m4
@@ -1,4 +1,4 @@
-# malloc-align.m4 serial 1
+# malloc-align.m4 serial 2
 dnl Copyright (C) 2020-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -71,7 +71,7 @@ AC_DEFUN([gl_MALLOC_ALIGNMENT]
               bits |= (uintptr_t) malloc (17027);
               bits |= (uintptr_t) malloc (81231);
               bits |= (uintptr_t) malloc (81231);
-              fprintf (fp, "%u\n", (unsigned int) (((bits ^ (bits - 1)) + 1) 
>> 1));
+              fprintf (fp, "%u", (unsigned int) (((bits ^ (bits - 1)) + 1) >> 
1));
             }
             if (fclose (fp) != 0)
               return 2;
diff --git a/m4/rmdir-errno.m4 b/m4/rmdir-errno.m4
index 5f703f15fd..b1c38f10db 100644
--- a/m4/rmdir-errno.m4
+++ b/m4/rmdir-errno.m4
@@ -1,4 +1,4 @@
-# serial 14
+# serial 15
 
 # Copyright (C) 2000-2001, 2005-2006, 2009-2023 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -34,7 +34,7 @@ AC_DEFUN([gl_FUNC_RMDIR_NOTEMPTY]
           rmdir ("confdir2");
           val = errno;
           s = fopen ("confdir2/errno", "w");
-          fprintf (s, "%d\n", val);
+          fprintf (s, "%d", val);
           fclose (s);
           return 0;
         }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]