[PATCH] m4/printf.m4: include when useful

2024-07-01 Thread Arsen Arsenović
* m4/printf.m4 (gl_SNPRINTF_DIRECTIVE_N): Add missing include for
unistd.h.
(gl_PRINTF_DIRECTIVE_N): Likewise.
---
Hi,

This patch addresses a missing include in configure detected by our
testing for implicit function declarations.

Tested through poke 4.1.

https://bugs.gentoo.org/935126

 ChangeLog| 6 ++
 m4/printf.m4 | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index dcfa4b80c2..0de05d4b90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-07-01  Arsen Arsenović  
+
+   * m4/printf.m4 (gl_SNPRINTF_DIRECTIVE_N): Add missing include for
+   unistd.h.
+   (gl_PRINTF_DIRECTIVE_N): Likewise.
+
 2024-06-30  Collin Funk  
 
doc: Remove references to POSIX 202x.
diff --git a/m4/printf.m4 b/m4/printf.m4
index 1363fe19e4..170ac0da39 100644
--- a/m4/printf.m4
+++ b/m4/printf.m4
@@ -899,6 +899,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
 #include 
 #include 
 #include 
+#include 
 #ifdef _MSC_VER
 #include 
 #include 
@@ -1717,6 +1718,7 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
 #include 
 #include 
 #include 
+#include 
 #if HAVE_SNPRINTF
 # define my_snprintf snprintf
 #else
-- 
2.45.2




new stable branch

2024-07-01 Thread Bruno Haible
Hi,

I've created a new stable branch 'stable-202407', scheduled to be maintained
for a year.

And updated the documentation:


2024-07-01  Bruno Haible  

doc: Update regarding stable branches.
* doc/gnulib-readme.texi (Stable Branches): Mention new branch
stable-202407. Mention that stable-202307 is no longer updated.

diff --git a/doc/gnulib-readme.texi b/doc/gnulib-readme.texi
index 11dcdf965b..25d7b54e2c 100644
--- a/doc/gnulib-readme.texi
+++ b/doc/gnulib-readme.texi
@@ -596,12 +596,15 @@
 documentation updates.
 @end itemize
 
-So far, we have five stable branches:
+So far, we have six stable branches:
 @table @code
+@item stable-202407
+A stable branch that starts at the beginning of July 2024.
 @item stable-202401
 A stable branch that starts at the beginning of January 2024.
 @item stable-202307
 A stable branch that starts at the beginning of July 2023.
+It is no longer updated.
 @item stable-202301
 A stable branch that starts at the beginning of January 2023.
 It is no longer updated.






Re: [PATCH] m4/printf.m4: include when useful

2024-07-01 Thread Bruno Haible
Hi Arsen,

Thanks for the report.

> https://bugs.gentoo.org/935126

The essential lines in the build.log attachment there seem to be:

 * QA Notice: Found the following implicit function declarations in configure 
logs:
 *   /var/tmp/portage/dev-util/poke-4.1/work/poke-4.1/config.log:6859 - _exit
 *   /var/tmp/portage/dev-util/poke-4.1/work/poke-4.1/config.log:11911 - _exit
 * Check that no features were accidentally disabled.
 * See https://wiki.gentoo.org/wiki/Modern_C_porting.

_exit() needs  on POSIX-like platforms but  on
native Windows.

> * m4/printf.m4 (gl_SNPRINTF_DIRECTIVE_N): Add missing include for
> unistd.h.
> (gl_PRINTF_DIRECTIVE_N): Likewise.

I can't take this patch, because  does not exist on MSVC.

I also considered using _Exit instead of _exit, since it is always
declared in . But it would produce portability problems on
some older platforms (Android, HP-UX, Minix).

So, I'm fixing it like this:


2024-07-01  Bruno Haible  

Avoid some possibly wrong configure test results.
Reported by Arsen Arsenović  in
.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_N): Include necessary header file
for _exit().
(gl_SNPRINTF_DIRECTIVE_N): Likewise.
* m4/memmem.m4 (gl_FUNC_MEMMEM): Update comment.
* m4/sleep.m4 (gl_FUNC_SLEEP): Likewise.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR): Likewise.
* m4/strstr.m4 (gl_FUNC_STRSTR): Likewise.
* m4/wcsstr.m4 (gl_FUNC_WCSSTR): Likewise.

diff --git a/m4/printf.m4 b/m4/printf.m4
index 1363fe19e4..a6daa1a62c 100644
--- a/m4/printf.m4
+++ b/m4/printf.m4
@@ -1,5 +1,5 @@
 # printf.m4
-# serial 94
+# serial 95
 dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -897,8 +897,12 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N]
 [AC_LANG_SOURCE([[
 #include 
 #include 
-#include 
 #include 
+#if defined _WIN32 && !defined __CYGWIN__
+# include 
+#else
+# include 
+#endif
 #ifdef _MSC_VER
 #include 
 #include 
@@ -1717,6 +1721,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N]
 #include 
 #include 
 #include 
+#if defined _WIN32 && !defined __CYGWIN__
+# include 
+#else
+# include 
+#endif
 #if HAVE_SNPRINTF
 # define my_snprintf snprintf
 #else
diff --git a/m4/memmem.m4 b/m4/memmem.m4
index a9bc277813..e6b1d91cbb 100644
--- a/m4/memmem.m4
+++ b/m4/memmem.m4
@@ -1,5 +1,5 @@
 # memmem.m4
-# serial 29
+# serial 30
 dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -102,7 +102,7 @@ AC_DEFUN([gl_FUNC_MEMMEM]
 char *haystack = (char *) malloc (2 * m + 1);
 char *needle = (char *) malloc (m + 1);
 /* Failure to compile this test due to missing alarm is okay,
-   since all such platforms (mingw) also lack memmem.  */
+   since all such platforms (mingw, MSVC) also lack memmem.  */
 signal (SIGALRM, quit);
 alarm (5);
 /* Check for quadratic performance.  */
diff --git a/m4/sleep.m4 b/m4/sleep.m4
index 06f58b2860..ec8764bd2a 100644
--- a/m4/sleep.m4
+++ b/m4/sleep.m4
@@ -1,5 +1,5 @@
 # sleep.m4
-# serial 13
+# serial 14
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,7 +33,7 @@ AC_DEFUN([gl_FUNC_SLEEP]
 }
 ]], [[
 /* Failure to compile this test due to missing alarm is okay,
-   since all such platforms (mingw) also lack sleep.  */
+   since all such platforms (mingw, MSVC) also lack sleep.  */
 unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days.  */
 unsigned int remaining;
 signal (SIGALRM, handle_alarm);
diff --git a/m4/strcasestr.m4 b/m4/strcasestr.m4
index d254871677..811e680ff5 100644
--- a/m4/strcasestr.m4
+++ b/m4/strcasestr.m4
@@ -1,5 +1,5 @@
 # strcasestr.m4
-# serial 28
+# serial 29
 dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -98,7 +98,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR]
 char *haystack = (char *) malloc (2 * m + 2);
 char *needle = (char *) malloc (m + 2);
 /* Failure to compile this test due to missing alarm is okay,
-   since all such platforms (mingw) also lack strcasestr.  */
+   since all such platforms (mingw, MSVC) also lack strcasestr.  */
 signal (SIGALRM, quit);
 alarm (5);
 /* Check for quadratic performance.  */
diff --git a/m4/strstr.m4 b/m4/strstr.m4
index 957ed2e307..d19559aa25 100644
--- a/m4/strstr.m4
+++ b/m4/strstr.m4
@@ -1,5 +1,5 @@
 # strstr.m4
-# serial 24
+# serial 25
 dnl Copyright (C) 2008-2024 Free Software Foundation, Inc.
 dnl This file is free software; th

Three spaces for error messages instead of one

2024-07-01 Thread Ileana Dumitrescu

Hi,

It was reported [1] that error messages from a libtool invocation have
additional spaces after the package name before the error message. After
looking into this, it seems that gnulib-modules/bootstrap is the cause.

Here is an example:
libtool:   error: only absolute run-paths are allowed

Here is the relevant code in bootstrap:
```
# func_error ARG...
# -
# Echo program name prefixed message to standard error.
func_error ()
{
$debug_cmd

$require_term_colors

func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
}


# func_fatal_error ARG...
# ---
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
$debug_cmd

func_error "$*"
exit $EXIT_FAILURE
}
```

Is there a reason for the extra spacing, or could this be changed?

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71595

--
Ileana Dumitrescu

GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354


OpenPGP_0x6570EA01146F7354.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: Three spaces for error messages instead of one

2024-07-01 Thread Bruno Haible
Hi Ileana,

> Here is the relevant code in bootstrap:
> ```
> # func_error ARG...
> # -
> # Echo program name prefixed message to standard error.
> func_error ()
> {
>  $debug_cmd
> 
>  $require_term_colors
> 
>  func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
> }

This code doesn't exist in gnulib's 'bootstrap'.

Note that there are several variants/forks of 'bootstrap':
  - The one created by Paul Eggert and maintained in gnulib.
  - The one by Gary Vaughan https://github.com/gvvaughan/bootstrap
  - A fork of that, by Gary Vaughan, Pavel Raiskup, Reuben Thomas
https://github.com/gnulib-modules/bootstrap
This is the one used by GNU libtool and GNU m4.

libtool's ltmain.sh includes this function. ltmain.sh is generated
from ltmain.in, funclib.sh, and options-parser; the latter two come
from https://github.com/gnulib-modules/bootstrap .

Bruno






Re: bug#71877: Three spaces for error messages instead of one

2024-07-01 Thread Ileana Dumitrescu

Hi Bruno,

On 01/07/2024 20:10, Bruno Haible wrote:

Hi Ileana,


Here is the relevant code in bootstrap:
```
# func_error ARG...
# -
# Echo program name prefixed message to standard error.
func_error ()
{
  $debug_cmd

  $require_term_colors

  func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
}


This code doesn't exist in gnulib's 'bootstrap'.

Note that there are several variants/forks of 'bootstrap':
   - The one created by Paul Eggert and maintained in gnulib.
   - The one by Gary Vaughan https://github.com/gvvaughan/bootstrap
   - A fork of that, by Gary Vaughan, Pavel Raiskup, Reuben Thomas
 https://github.com/gnulib-modules/bootstrap
 This is the one used by GNU libtool and GNU m4.

libtool's ltmain.sh includes this function. ltmain.sh is generated
from ltmain.in, funclib.sh, and options-parser; the latter two come
from https://github.com/gnulib-modules/bootstrap .

Bruno



I am following Karl's advice to contact gnulib regarding this. Thank you
for the explanation. I know the bootstrap used by libtool is maintained
on Github. I referenced gnulib-modules/bootstrap [1] in the bug report,
but I should have added in the link for clarity.

I also assumed gnulib would be the correct place to contact for
understanding some design decisions with bootstrap, since it is under
the 'gnulib-modules' namespace. It seems this is wrong though. I will
close this here for now and ask about this issue on Github.

[1] https://github.com/gnulib-modules/bootstrap

--
Ileana Dumitrescu

GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354


OpenPGP_0x6570EA01146F7354.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [PATCH] m4/printf.m4: include when useful

2024-07-01 Thread Arsen Arsenović
Hi Bruno,

Bruno Haible  writes:

> Hi Arsen,
>
> Thanks for the report.
>
>> https://bugs.gentoo.org/935126
>
> The essential lines in the build.log attachment there seem to be:
>
>  * QA Notice: Found the following implicit function declarations in configure 
> logs:
>  *   /var/tmp/portage/dev-util/poke-4.1/work/poke-4.1/config.log:6859 - _exit
>  *   /var/tmp/portage/dev-util/poke-4.1/work/poke-4.1/config.log:11911 - _exit
>  * Check that no features were accidentally disabled.
>  * See https://wiki.gentoo.org/wiki/Modern_C_porting.
>
> _exit() needs  on POSIX-like platforms but  on
> native Windows.

Indeed.

>> * m4/printf.m4 (gl_SNPRINTF_DIRECTIVE_N): Add missing include for
>> unistd.h.
>> (gl_PRINTF_DIRECTIVE_N): Likewise.
>
> I can't take this patch, because  does not exist on MSVC.

Oh!  I did not know that.

> I also considered using _Exit instead of _exit, since it is always
> declared in . But it would produce portability problems on
> some older platforms (Android, HP-UX, Minix).
>
> So, I'm fixing it like this:
>

Ah!  Even better!  Thank you very much :-)

Have a lovely day!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


What is xreadline?

2024-07-01 Thread Reuben Thomas
readtokens.c has a comment saying "This almost supersedes xreadline stuff",
but I can't find out what xreadline is.

-- 
https://rrt.sc3d.org


Re: What is xreadline?

2024-07-01 Thread Gary V. Vaughan


> On Jul 1, 2024, at 12:46 PM, Reuben Thomas  wrote:
> 
> readtokens.c has a comment saying "This almost supersedes xreadline stuff", 
> but I can't find out what xreadline is.
> 
> -- 
> https://rrt.sc3d.org 
IIUC it’s the xreadline.c from gnupg.

Cheers,
Gary

Re: Integer overflows in memchr

2024-07-01 Thread Paul Eggert

On 7/1/24 02:16, Po Lu wrote:


but Gnulib (and by extension Emacs) does not invoke the Autoconf
test:

AC_DEFUN([gl_FUNC_STRNLEN],
[
   AC_REQUIRE([gl_STRING_H_DEFAULTS])

   dnl Persuade glibc  to declare strnlen().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])

   AC_CHECK_DECLS_ONCE([strnlen]) <
   if test $ac_cv_have_decl_strnlen = no; then
 HAVE_DECL_STRNLEN=0
   else
 m4_pushdef([AC_LIBOBJ], [:])
 dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]).



The line immediately after the last line you quoted is:

AC_FUNC_STRNLEN

and that invokes the Autoconf test.