NetBSD-Bugs archive

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

Re: bin/53634: mandoc dumps core building from linux



The following reply was made to PR bin/53634; it has been noted by GNATS.

From: Ingo Schwarze <schwarze%usta.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: Thomas Klausner <wiz%NetBSD.org@localhost>, Valery Ushakov <uwe%stderr.spb.ru@localhost>,
	coypu%sdf.org@localhost
Subject: Re: bin/53634: mandoc dumps core building from linux
Date: Fri, 28 Sep 2018 09:38:20 +0200

 Hi,
 
 Tlery Ushakovhomas Klausner NetBSD wrote on Fri, Sep 28, 2018 at 01:03:13AM +0200:
 
 Valery Ushakov wrote:
 
 >  The crash happens b/c the return value from reallocarray is truncated
 >  to 32-bit b/c the prototype is missing:
 [...]
 >  The prototype is missing b/c the code assumes that including
 >  <stdlib.h> is enough, but glibc hides reallocarray under __USE_GNU.
 
 All three of the following define _GNU_SOURCE on Linux:
 
  * the old, outdated ./configure script contained in NetBSD base;
  * the improved ./configure script contained in mandoc.bsd.lv HEAD;
  * the old, outdated include/config.h contained in NetBSD base.
 
 Is that insufficient?
 
 Do you really mean to say that (some versions of?) glibc require
 _GNU_SOURCE for getsubopt(3), strcasestr(3), strptime(3), and
 vasprintf(3) but __USE_GNU for reallocarray(3) and recallocarray(3)?
 
 If so, i have to improve the ./configure script upstream.
 
 >  test-reallocarray.c doesn't detect this.  It also gets the warning
 >  when it's compiled, but that's ignored.
 
 That was a bug in ./configure which only hit when CFLAGS was manually
 defined in configure.local.  It was fixed on Aug 15, 2018 in
 mandoc.bsd.lv HEAD, ./configure rev. 1.67, following a bug report
 from wiz@NetBSD.  Now, the test-*.c files are always compiled with
 -Werror if the compiler supports that, even if CFLAGS manually set
 in configure.local does not contain it.
 
 >  The program links ok, since
 >  the symbol is present, so it assumes reallocarray is available.
 >  
 >  Forcing the test to fail by adding #error to test-reallocarray.c makes
 >  mandoc happy.
 
 That's not the way to do it.
 
 If you want to force using the bundled replacement implementation
 of reallocarray(3), say
 
   echo 'HAVE_REALLOCARRAY=0' >> configure.local
 
 see INSTALL and configure.local.example for details.
 
 But you don't want to use the replacement if the function is actually
 available in libc.  Instead, make sure _GNU_SOURCE (or __USE_GNU?)
 is defined in config.h such that the correct #define is set before
 including the standard headers.
 
 Yours,
   Ingo
 



Home | Main Index | Thread Index | Old Index