From 13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 26 Mar 2026 12:53:53 +0100 Subject: Update/gnulib 2026 03 (#2247) * Sync with the 202601-stable Gnulib code (4a3650d887) * Ignore more deps stuff in gnulib * Remove autogenerated gnulib files * Ignore more gnulib generated headers --- gl/m4/getdelim.m4 | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'gl/m4/getdelim.m4') diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 63d88306..8b6eff47 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 @@ -1,7 +1,7 @@ # getdelim.m4 -# serial 19 +# serial 21 -dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -37,6 +37,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], gl_cv_func_working_getdelim=no ;; *) echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + touch conftest.empty AC_RUN_IFELSE([AC_LANG_SOURCE([[ # include # include @@ -44,6 +45,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], int main () { FILE *in = fopen ("./conftest.data", "r"); + int result = 0; if (!in) return 1; { @@ -53,7 +55,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], size_t siz = 0; int len = getdelim (&line, &siz, '\n', in); if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) - { free (line); fclose (in); return 2; } + result |= 2; free (line); } { @@ -62,35 +64,40 @@ AC_DEFUN([gl_FUNC_GETDELIM], char *line = NULL; size_t siz = (size_t)(~0) / 4; if (getdelim (&line, &siz, '\n', in) == -1) - { fclose (in); return 3; } + result |= 4; free (line); } fclose (in); - return 0; + { + /* Test that reading EOF as the first character sets the first byte + in the buffer to NUL. This fails on glibc 2.42 and earlier. */ + in = fopen ("./conftest.empty", "r"); + if (!in) + return 1; + char *line = malloc (1); + line[0] = 'A'; + size_t siz = 1; + if (getdelim (&line, &siz, '\n', in) != -1 || line[0] != '\0') + result |= 8; + free (line); + } + fclose (in); + return result; } ]])], [gl_cv_func_working_getdelim=yes], [gl_cv_func_working_getdelim=no], - [dnl We're cross compiling. - dnl Guess it works on glibc2 systems and musl systems. - AC_EGREP_CPP([Lucky GNU user], - [ -#include -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) && !defined __UCLIBC__ - Lucky GNU user - #endif -#endif - ], - [gl_cv_func_working_getdelim="guessing yes"], - [case "$host_os" in - *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; - *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; - esac - ]) + [case "$host_os" in + # Guess yes on musl. + *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; + # Guess no on glibc. + *-gnu* | gnu*) gl_cv_func_working_getdelim="guessing no" ;; + *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; + esac ]) ;; esac + rm -f conftest.data conftest.empty ]) case "$gl_cv_func_working_getdelim" in *yes) ;; -- cgit v1.2.3-74-g34f1