Re: XMALLOC() et al

2024-07-20 Thread Bruno Haible
Paul Eggert wrote:
> > GNU gettext uses the XMALLOC macro in more than 100 places. It's
> > just so convenient to do a memory allocation in 1 line of code:
> 
> I find it more convenient to write this:
> 
>context = xmalloc (sizeof *context);
> 
> than this (taken from GNU gettext):
> 
>context = XMALLOC (markup_parse_context_ty);

This is where our opionions differ. The first style has three drawbacks:

  * In order to understand what the statement really does, the reader
has to look up the definition of 'context', to see its type.

  * Typically, right after allocating an object, comes the initialization
of its members. To make it easy for the reader to verify that this
initialization is complete, he needs to look up the definition of the
type quickly. Again, this is harder if the type is not stated explicitly.

  * When there is a copy-and-paste mistake, the first style does not warn,
but the second style does. For example, suppose we have types
fun_context, var_context, tag_context and associated local variables, then

  fcontext = xmalloc (sizeof *fcontext);
  vcontext = xmalloc (sizeof *vcontext);
  tcontext = xmalloc (sizeof *vcontext);

will not warn, whereas

  fcontext = XMALLOC (fun_context);
  vcontext = XMALLOC (var_context);
  tcontext = XMALLOC (var_context);

will warn.

Which is why I encourage the use of XMALLOC.

Bruno






POSIX:2024 is available online

2024-07-20 Thread Bruno Haible
Here are the URLs:
  POSIX:2024 (= "Issue 8")  https://pubs.opengroup.org/onlinepubs/9799919799/
  POSIX:2018 (= "Issue 7")  https://pubs.opengroup.org/onlinepubs/9699919799/
  POSIX:2004 (= "Issue 6")  https://pubs.opengroup.org/onlinepubs/009604599/


I pushed these two documentation changes:

2024-07-20  Bruno Haible  

doc: Reference POSIX:2024 instead of POSIX:2018.
* doc/*.texi: Change URL to POSIX.
* doc/posix-headers/*.texi: Likewise.
* doc/posix-functions/*.texi: Likewise.

2024-07-20  Bruno Haible  

doc: Update status of functions that are removed from POSIX:2024.
* doc/pastposix-functions/_longjmp.texi: Moved here
fromdoc/posix-functions/.
* doc/pastposix-functions/_setjmp.texi: Likewise.
* doc/pastposix-functions/_tolower.texi: Likewise.
* doc/pastposix-functions/_toupper.texi: Likewise.
* doc/pastposix-functions/fattach.texi: Likewise.
* doc/pastposix-functions/fdetach.texi: Likewise.
* doc/pastposix-functions/ftw.texi: Likewise.
* doc/pastposix-functions/getitimer.texi: Likewise.
* doc/pastposix-functions/getmsg.texi: Likewise.
* doc/pastposix-functions/getpmsg.texi: Likewise.
* doc/pastposix-functions/gets.texi: Likewise.
* doc/pastposix-functions/gettimeofday.texi: Likewise.
* doc/pastposix-functions/ioctl.texi: Likewise.
* doc/pastposix-functions/isascii.texi: Likewise.
* doc/pastposix-functions/isastream.texi: Likewise.
* doc/pastposix-functions/posix_trace_*.texi: Likewise.
* doc/pastposix-functions/pthread_getconcurrency.texi: Likewise.
* doc/pastposix-functions/pthread_setconcurrency.texi: Likewise.
* doc/pastposix-functions/putmsg.texi: Likewise.
* doc/pastposix-functions/putpmsg.texi: Likewise.
* doc/pastposix-functions/setitimer.texi: Likewise.
* doc/pastposix-functions/setpgrp.texi: Likewise.
* doc/pastposix-functions/sighold.texi: Likewise.
* doc/pastposix-functions/sigignore.texi: Likewise.
* doc/pastposix-functions/siginterrupt.texi: Likewise.
* doc/pastposix-functions/sigpause.texi: Likewise.
* doc/pastposix-functions/sigrelse.texi: Likewise.
* doc/pastposix-functions/sigset.texi: Likewise.
* doc/pastposix-functions/tempnam.texi: Likewise.
* doc/pastposix-functions/toascii.texi: Likewise.
* doc/pastposix-functions/ulimit.texi: Likewise.
* doc/pastposix-functions/utime.texi: Likewise.
* doc/gnulib.texi (Function Substitutes): Don't include them here.
(Legacy Function Substitutes): Include them here.







TODO lists regarding POSIX:2024 work

2024-07-20 Thread Bruno Haible
Hi,

There are many changes in POSIX:2024 that can have an impact on Gnulib;
it is useful to keep track of which changes have been dealt with and which
are still open.

Also, we are several people who can contribute at any time. Therefore it
is useful to avoid duplicate work, that would only result in
  - frustration,
  - the feeling of time pressure (to complete work soon after begun).

Therefore I've committed in the maint-tools/ repository two files, to be
used as TODO lists:
  - posix-2024-doc.TODOfor documentation
  - posix-2024-impl.TODO   for implementation

*PLEASE* when you start working on one of these items, add
  WIP 
in the first column, and
  DONE
when you are done with it. This should hopefully avoid duplicate work,
without being too onerous.

(The alternative would be to send a mail to the mailing list "I am
starting to work on topic xyz", but that is, IMO, not a proper use of
a mailing list.)

Bruno






Re: POSIX:2024 is available online

2024-07-20 Thread Bruno Haible
And another documentation change:


2024-07-20  Bruno Haible  

doc: Update status of functions that are added in POSIX:2024.
* doc/posix-functions/_Fork.texi: Moved here from doc/glibc-functions/.
* doc/posix-functions/accept4.texi: Likewise.
* doc/posix-functions/asprintf.texi: Likewise.
* doc/posix-functions/bind_textdomain_codeset.texi: Likewise.
* doc/posix-functions/bindtextdomain.texi: Likewise.
* doc/posix-functions/dcgettext.texi: Likewise.
* doc/posix-functions/dcngettext.texi: Likewise.
* doc/posix-functions/dgettext.texi: Likewise.
* doc/posix-functions/dladdr.texi: Likewise.
* doc/posix-functions/dngettext.texi: Likewise.
* doc/posix-functions/dup3.texi: Likewise.
* doc/posix-functions/ffsl.texi: Likewise.
* doc/posix-functions/ffsll.texi: Likewise.
* doc/posix-functions/getentropy.texi: Likewise.
* doc/posix-functions/getresgid.texi: Likewise.
* doc/posix-functions/getresuid.texi: Likewise.
* doc/posix-functions/gettext.texi: Likewise.
* doc/posix-functions/in6addr_any.texi: Likewise.
* doc/posix-functions/in6addr_loopback.texi: Likewise.
* doc/posix-functions/memmem.texi: Likewise.
* doc/posix-functions/mkostemp.texi: Likewise.
* doc/posix-functions/ngettext.texi: Likewise.
* doc/posix-functions/pipe2.texi: Likewise.
* doc/posix-functions/ppoll.texi: Likewise.
* doc/posix-functions/pthread_cond_clockwait.texi: Likewise.
* doc/posix-functions/pthread_mutex_clocklock.texi: Likewise.
* doc/posix-functions/pthread_rwlock_clockrdlock.texi: Likewise.
* doc/posix-functions/pthread_rwlock_clockwrlock.texi: Likewise.
* doc/posix-functions/ptsname_r.texi: Likewise.
* doc/posix-functions/qsort_r.texi: Likewise.
* doc/posix-functions/secure_getenv.texi: Likewise.
* doc/posix-functions/sem_clockwait.texi: Likewise.
* doc/posix-functions/setresgid.texi: Likewise.
* doc/posix-functions/setresuid.texi: Likewise.
* doc/posix-functions/textdomain.texi: Likewise.
* doc/posix-functions/timespec_get.texi: Likewise.
* doc/posix-functions/vasprintf.texi: Likewise.
* doc/posix-functions/reallocarray.texi: Likewise. Improve text.
* doc/gnulib.texi (Function Substitutes): Include them here.
(Glibc Function Substitutes): Don't include them here.
(Glibc libintl.h): Remove section.
(Glibc poll.h): Remove section.
(Glibc semaphore.h): Remove section.







doc: structure of function substitutes chapter

2024-07-20 Thread Bruno Haible
Hi,

Currently, in the Gnulib manual [1], chapter 10 "ISO C and POSIX Function
Substitutes" lists all functions in alphabetical order. Whereas
chapter 13 "Glibc Function Substitutes" lists the function sorted by
header file, resulting in related function to sit close together.

I'm thinking that the same structure should also be applied to chapter 10.

Opinions? Objections?

Bruno

[1] https://www.gnu.org/software/gnulib/manual/html_node/index.html






Re: doc: structure of function substitutes chapter

2024-07-20 Thread Paul Eggert

On 2024-07-20 06:41, Bruno Haible wrote:

I'm thinking that the same structure should also be applied to chapter 10.


Makes sense to me too, thanks. That's what the C standard does.



Re: XMALLOC() et al

2024-07-20 Thread Paul Eggert

On 2024-07-20 03:27, Bruno Haible wrote:


This is where our opionions differ.


Yes, and I'm well aware of the advantages you listed for XMALLOC. In 
practice, for me, they don't outweigh the disadvantages. (In that sense 
they're like the advantages that C++ has over C)




getpayload?.o unnecessarily built?

2024-07-20 Thread Andreas K. Huettel
Hi, 

while testing glibc (master) against the gnulib (master) testsuite, I found new 
object files being 
built (compared to my glibc testing 6 months ago... but it's not a change in 
glibc, I checked that):

getpayload.o
getpayloadf.o
getpayloadl.o

A look into config.log uncovered this snippet:

> configure:72327: checking whether getpayloadf can be used with libm
> configure:72359: gcc -o conftest -g -O2 -Wall  conftest.c  -lm >&5
> configure:72359: $? = 0
> configure:72370: result: yes
> configure:72385: checking whether getpayloadf works
> configure:72437: gcc -o conftest -g -O2 -Wall  conftest.c  >&5
> /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/
> bin/ld: /tmp/ccaNe9gy.o: in function `main':
> /tmp/testdir/conftest.c:572:(.text.startup+0x26): undefined
> reference to `getpayloadf' collect2: error: ld returned 1 exit
> status
> configure:72437: $? = 1
> configure: program exited with status 1

This makes no sense to me. If libm is needed, shouldnt the functionality
test link it in?

Looks like a bug. More logs and debugging on request...

Best,
Andreas

-- 
Andreas K. Hüttel
dilfri...@gentoo.org
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)

signature.asc
Description: This is a digitally signed message part.


Re: POSIX:2024 is available online

2024-07-20 Thread Bruno Haible
I did:
> 2024-07-20  Bruno Haible  
> 
>   doc: Update status of functions that are added in POSIX:2024.
>   * doc/posix-functions/_Fork.texi: Moved here from doc/glibc-functions/.

Followup:


2024-07-20  Bruno Haible  

doc: Reference POSIX for functions that are added in POSIX:2024.
* doc/posix-functions/_Fork.texi etc: Reference POSIX:2024, not the LSB
and not the Austin Group tracker.

diff --git a/doc/posix-functions/_Fork.texi b/doc/posix-functions/_Fork.texi
index 4110168221..da202cea7c 100644
--- a/doc/posix-functions/_Fork.texi
+++ b/doc/posix-functions/_Fork.texi
@@ -2,6 +2,8 @@
 @section @code{_Fork}
 @findex _Fork
 
+POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/_Fork.html}
+
 Documentation:@*
 @ifinfo
 @ref{Creating a Process,,Creating a Process,libc}
diff --git a/doc/posix-functions/accept4.texi b/doc/posix-functions/accept4.texi
index ad74412517..1920c186fa 100644
--- a/doc/posix-functions/accept4.texi
+++ b/doc/posix-functions/accept4.texi
@@ -2,6 +2,8 @@
 @section @code{accept4}
 @findex accept4
 
+POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/accept4.html}
+
 Documentation:@* 
@uref{https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html,,man
 accept4}
 
 Gnulib module: accept4
diff --git a/doc/posix-functions/asprintf.texi 
b/doc/posix-functions/asprintf.texi
index a1c6b7e88c..941c62fb4a 100644
--- a/doc/posix-functions/asprintf.texi
+++ b/doc/posix-functions/asprintf.texi
@@ -2,7 +2,7 @@
 @section @code{asprintf}
 @findex asprintf
 
-LSB specification:@* 
@url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-asprintf.html}
+POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/asprintf.html}
 
 Documentation:
 @itemize
diff --git a/doc/posix-functions/bind_textdomain_codeset.texi 
b/doc/posix-functions/bind_textdomain_codeset.texi
index 2b37fe9082..645a4ae3a8 100644
--- a/doc/posix-functions/bind_textdomain_codeset.texi
+++ b/doc/posix-functions/bind_textdomain_codeset.texi
@@ -2,10 +2,7 @@
 @section @code{bind_textdomain_codeset}
 @findex bind_textdomain_codeset
 
-LSB specification:@* 
@url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-bind-textdomain-codeset.html}
-
-Specified in POSIX.1-2024.
-Draft specification:@* @url{https://www.austingroupbugs.net/view.php?id=1122}
+POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/bind_textdomain_codeset.html}
 
 Documentation:
 @itemize
diff --git a/doc/posix-functions/bindtextdomain.texi 
b/doc/posix-functions/bindtextdomain.texi
index 16cab144c7..8cfea1cb85 100644
--- a/doc/posix-functions/bindtextdomain.texi
+++ b/doc/posix-functions/bindtextdomain.texi
@@ -2,10 +2,7 @@
 @section @code{bindtextdomain}
 @findex bindtextdomain
 
-LSB specification:@* 
@url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-bindtextdomain.html}
-
-Specified in POSIX.1-2024.
-Draft specification:@* @url{https://www.austingroupbugs.net/view.php?id=1122}
+POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/bindtextdomain.html}
 
 Documentation:
 @itemize
diff --git a/doc/posix-functions/dcgettext.texi 
b/doc/posix-functions/dcgettext.texi
index 804ce9e8f9..316e325f42 100644
--- a/doc/posix-functions/dcgettext.texi
+++ b/doc/posix-functions/dcgettext.texi
@@ -2,10 +2,7 @@
 @section @code{dcgettext}
 @findex dcgettext
 
-LSB specification:@* 
@url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-dcgettext.html}
-
-Specified in POSIX.1-2024.
-Draft specification:@* @url{https://www.austingroupbugs.net/view.php?id=1122}
+POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/dcgettext.html}
 
 Documentation:
 @itemize
diff --git a/doc/posix-functions/dcngettext.texi 
b/doc/posix-functions/dcngettext.texi
index 549a40cbcb..588a3bc74a 100644
--- a/doc/posix-functions/dcngettext.texi
+++ b/doc/posix-functions/dcngettext.texi
@@ -2,10 +2,7 @@
 @section @code{dcngettext}
 @findex dcngettext
 
-LSB specification:@* 
@url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-dcngettext.html}
-
-Specified in POSIX.1-2024.
-Draft specification:@* @url{https://www.austingroupbugs.net/view.php?id=1122}
+POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/dcngettext.html}
 
 Documentation:
 @itemize
diff --git a/doc/posix-functions/dgettext.texi 
b/doc/posix-functions/dgettext.texi
index 2e3116f6ae..346d5c6aa3 100644
--- a/doc/posix-functions/dgettext.texi
+++ b/doc/posix-functions/dgettext.texi
@@ -2,10 +2,7 @@
 @section @code{dgettext}
 @findex dgettext
 
-LSB specification:@* 
@url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-dgettext.html}
-
-Specified in POSIX.1-2024.
-D

Re: getpayload?.o unnecessarily built?

2024-07-20 Thread Bruno Haible
Hi,

Andreas K. Huettel wrote:
> while testing glibc (master) against the gnulib (master) testsuite, I found 
> new object files being 
> built (compared to my glibc testing 6 months ago... but it's not a change in 
> glibc, I checked that):
> 
> getpayload.o
> getpayloadf.o
> getpayloadl.o
> 
> A look into config.log uncovered this snippet:
> 
> > configure:72327: checking whether getpayloadf can be used with libm
> > configure:72359: gcc -o conftest -g -O2 -Wall  conftest.c  -lm >&5
> > configure:72359: $? = 0
> > configure:72370: result: yes
> > configure:72385: checking whether getpayloadf works
> > configure:72437: gcc -o conftest -g -O2 -Wall  conftest.c  >&5
> > /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/
> > bin/ld: /tmp/ccaNe9gy.o: in function `main':
> > /tmp/testdir/conftest.c:572:(.text.startup+0x26): undefined
> > reference to `getpayloadf' collect2: error: ld returned 1 exit
> > status
> > configure:72437: $? = 1
> > configure: program exited with status 1
> 
> This makes no sense to me. If libm is needed, shouldnt the functionality
> test link it in?

Yes, absolutely. Thanks for the report and the investigation. Fixed as follows:


2024-07-20  Bruno Haible  

getpayload*: Do use glibc's implementation when it works.
Reported by Andreas K. Huettel  in
.
* m4/getpayload.m4 (gl_FUNC_GETPAYLOADF, gl_FUNC_GETPAYLOAD,
gl_FUNC_GETPAYLOADL): Link the test program with -lm if needed.

diff --git a/m4/getpayload.m4 b/m4/getpayload.m4
index c41f0c25d8..383004580b 100644
--- a/m4/getpayload.m4
+++ b/m4/getpayload.m4
@@ -1,5 +1,5 @@
 # getpayload.m4
-# serial 1
+# serial 2
 dnl Copyright 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,
@@ -20,7 +20,12 @@ AC_DEFUN([gl_FUNC_GETPAYLOADF]
 dnl see .
 AC_CACHE_CHECK([whether getpayloadf works],
   [gl_cv_func_getpayloadf_works],
-  [AC_RUN_IFELSE(
+  [
+   saved_LIBS="$LIBS"
+   if test $gl_cv_func_getpayloadf_no_libm != yes; then
+ LIBS="$LIBS -lm"
+   fi
+   AC_RUN_IFELSE(
  [AC_LANG_PROGRAM(
 [[#include 
 ]],
@@ -49,6 +54,7 @@ AC_DEFUN([gl_FUNC_GETPAYLOADF]
 *) gl_cv_func_getpayloadf_works="guessing yes" ;;
   esac
  ])
+   LIBS="$saved_LIBS"
   ])
 case "$gl_cv_func_getpayloadf_works" in
   *yes) ;;
@@ -76,7 +82,12 @@ AC_DEFUN_ONCE([gl_FUNC_GETPAYLOAD]
 dnl see .
 AC_CACHE_CHECK([whether getpayload works],
   [gl_cv_func_getpayload_works],
-  [AC_RUN_IFELSE(
+  [
+   saved_LIBS="$LIBS"
+   if test $gl_cv_func_getpayload_no_libm != yes; then
+ LIBS="$LIBS -lm"
+   fi
+   AC_RUN_IFELSE(
  [AC_LANG_PROGRAM(
 [[#include 
 ]],
@@ -105,6 +116,7 @@ AC_DEFUN_ONCE([gl_FUNC_GETPAYLOAD]
 *) gl_cv_func_getpayload_works="guessing yes" ;;
   esac
  ])
+   LIBS="$saved_LIBS"
   ])
 case "$gl_cv_func_getpayload_works" in
   *yes) ;;
@@ -133,7 +145,12 @@ AC_DEFUN([gl_FUNC_GETPAYLOADL]
 dnl see .
 AC_CACHE_CHECK([whether getpayloadl works],
   [gl_cv_func_getpayloadl_works],
-  [AC_RUN_IFELSE(
+  [
+   saved_LIBS="$LIBS"
+   if test $gl_cv_func_getpayloadl_no_libm != yes; then
+ LIBS="$LIBS -lm"
+   fi
+   AC_RUN_IFELSE(
  [AC_LANG_PROGRAM(
 [[#include 
 ]],
@@ -162,6 +179,7 @@ AC_DEFUN([gl_FUNC_GETPAYLOADL]
 *) gl_cv_func_getpayloadl_works="guessing yes" ;;
   esac
  ])
+   LIBS="$saved_LIBS"
   ])
 case "$gl_cv_func_getpayloadl_works" in
   *yes) ;;






Re: doc: structure of function substitutes chapter

2024-07-20 Thread Bruno Haible
Paul Eggert wrote:
> > I'm thinking that the same structure should also be applied to chapter 10.
> 
> Makes sense to me too, thanks. That's what the C standard does.

Done:


2024-07-20  Bruno Haible  

doc: Sort the ISO C and POSIX Function Substitutes by header file.
* doc/gnulib.texi (Function Substitutes): Add one section per header
file.
* doc/posix-functions/*.texi: Each of these files is now a subsection.

https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=adfbfffa415325211f6b73ce3439d31879ce0dba






Re: stack-trace: Use libasan as an alternative to libbacktrace

2024-07-20 Thread Bruno Haible
Two days ago, I did:
> 2024-07-17  Bruno Haible  
> 
>   stack-trace: Use libasan as an alternative to libbacktrace.
>   * m4/stack-trace.m4 (gl_STACK_TRACE_EARLY): As a second choice, use
>   libasan.

It turns out that this does not work well:

1) When '-lasan' is added to LIBS, many tests fail, e.g.

==103167==ASan runtime does not come first in initial library list; you should 
either link runtime to your application or manually preload it with LD_PRELOAD.
FAIL test-acos (exit status: 1)

So, '-lasan' needs to be added to CFLAGS and CXXFLAGS, not LIBS, so that it
occurs _before_ other libraries on the link command line. Recall that the
Automake rule for linking a program is essentially
  $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
and both $(AM_LDFLAGS) and $(LDFLAGS) can contain other -l options.

2) With '-lasan' added to CFLAGS, still 29 tests fail. That's because
apparently the address sanitizer gets activated, with default options.

So I set
  $ export ASAN_OPTIONS="detect_leaks=0 abort_on_error=1 
allocator_may_return_null=1"

3) Still, 5 tests fail:

FAIL: test-dprintf-posix2.sh
FAIL: test-fprintf-posix3.sh
FAIL: test-free
FAIL: test-sigsegv-catch-stackoverflow1
FAIL: test-sigsegv-catch-stackoverflow2

These are "normal" failures from the address sanitizer. But still, it's
undesired, since the user has not asked for a sanitizer in the first place.

That's too much complexity (too many unwanted side effects), when the
more reliable workaround is to just install libbacktrace. I'm therefore
reverting the change.


2024-07-20  Bruno Haible  

stack-trace: Don't use libasan by default.
* m4/stack-trace.m4 (gl_STACK_TRACE_EARLY): Remove libasan as second
choice.

diff --git a/m4/stack-trace.m4 b/m4/stack-trace.m4
index faf86eefe9..43f6ef2abf 100644
--- a/m4/stack-trace.m4
+++ b/m4/stack-trace.m4
@@ -1,5 +1,5 @@
 # stack-trace.m4
-# serial 2
+# serial 3
 dnl Copyright (C) 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,
@@ -22,7 +22,6 @@ AC_DEFUN([gl_STACK_TRACE_EARLY]
   AC_MSG_RESULT([$enable_debug])
 
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
-  AC_REQUIRE([AC_CANONICAL_HOST])
   if test $enable_debug = yes; then
 dnl The first choice is libbacktrace by Ian Lance Taylor.
 dnl Maintained at https://github.com/ianlancetaylor/libbacktrace,
@@ -49,71 +48,25 @@ AC_DEFUN([gl_STACK_TRACE_EARLY]
   CAN_PRINT_STACK_TRACE=1
   LIBS="$LIBS -lbacktrace"
 else
-  dnl The second choice is GCC's libasan, installed as part of GCC.
-  dnl It produces source file names and line numbers, if the binary
-  dnl is compiled with debug information.
-  AC_CACHE_CHECK([for libasan], [gl_cv_lib_asan], [
-gl_saved_LIBS="$LIBS"
-LIBS="$gl_saved_LIBS -lasan"
-dnl We need AC_RUN_IFELSE here, not merely AC_LINK_IFELSE, because on
-dnl NetBSD libasan exists but every program that links to it 
immediately
-dnl prints "This sanitizer is not compatible with enabled ASLR" to
-dnl standard error and exits with code 0, without even invoking main().
-AC_RUN_IFELSE(
-  [AC_LANG_PROGRAM(
- [[#include 
-   extern
-   #ifdef __cplusplus
-   "C"
-   #endif
-   void __sanitizer_print_stack_trace (void);
- ]],
- [[remove ("conftest.c");
-   __sanitizer_print_stack_trace ();
- ]])],
-  [if test -f conftest.c; then
- dnl main() was not reached. NetBSD!
- gl_cv_lib_asan=no
-   else
- gl_cv_lib_asan=yes
-   fi
-  ],
-  [gl_cv_lib_asan=no],
-  [case "$host_os" in
- netbsd*) gl_cv_lib_asan="guessing no" ;;
- *)   gl_cv_lib_asan="guessing yes" ;;
-   esac
-  ])
-LIBS="$gl_saved_LIBS"
-  ])
-  case "$gl_cv_lib_asan" in
-*yes)
-  AC_DEFINE([HAVE_LIBASAN], [1],
-[Define if you have the libasan library.])
+  dnl The second choice is libexecinfo.
+  dnl It does not produce source file names and line numbers, only 
addresses
+  dnl (which are mostly useless due to ASLR) and _sometimes_ function 
names.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+*-gnu* | gnu* | darwin* | freebsd* | dragonfly* | netbsd* | openbsd* | 
solaris*)
+  dnl execinfo might be implemented on this platform.
   CAN_PRINT_STACK_TRACE=1
-  LIBS="$LIBS -lasan"
-  ;;
-*)
-  dnl The third choice is libexecinfo.
-  dnl It does not produce source file names and line numbers, only 
addresses
-  dnl (which are mostly useless due to ASLR) and _sometimes_ function 
names.
+  dnl On *BSD system, link all programs with -lexecinfo. Cf. 
m4/execinfo

Re: [PATCH] tests: switch nap() to use file creation to gauge delay

2024-07-20 Thread Bruno Haible
Hi Jeff,

You wrote on 2024-06-28:
> There are some proposed changes [1] to track finer-grained timestamps in
> the Linux kernel that will break the assumptions that nap() uses to
> gauge the delay. In particular, writing to a file will almost always
> show a change in the timestamp now, so usually this method will settle
> on a delay of 1ns.
> ...
> test-stat-time still fails without this change.

The paperwork being complete now, I wanted to verify that the patch
indeed fixes the problem. But I can't reproduce the problem in the first
place.

Here's what I did:
  - Install Fedora Rawhide (Linux 
6.11.0-0.rc0.20240719git720261cfc732.7.fc41.x86_64).
  - Create a testdir
$ ./gnulib-tool --create-testdir --dir=../testdir1 --single-configure chown 
fchownat fdutimensat futimens lchown stat-time utime utimens utimensat
  - Build it, both on an ext4 file system and a btrfs file system.
  => No test failure is seen.

What am I missing? What do I need to change in my setup, in order to
reproduce the problem?

Bruno