> From: Gavin Smith <gavinsmith0...@gmail.com> > Date: Sun, 8 Oct 2023 16:33:22 +0100 > Cc: bug-texinfo@gnu.org > > > > Hence, I propose to initialise n to 0, rather than 120 as in the patch > > > below. > > > > No, the value must be positive, otherwise it still crashes. It's a > > bug in MinGW implementation. > > Can you refer to any discussion of this bug online anywhere?
I don't need any discussions, I simply read the code. MinGW is a Free Software, so the sources of its additions to the Microsoft runtime are part of the MinGW distribution. Once I understood that the build is using the MinGW getdelim, I simply looked at the sources. > I see on the POSIX specification: > > https://pubs.opengroup.org/onlinepubs/9699919799/functions/getdelim.html > > the wording is slightly different to the glibc manual: > > If *n is non-zero, the application shall ensure that *lineptr either > points to an object of size at least *n bytes, or is a null pointer. > > If *lineptr is a null pointer or if the object pointed to by *lineptr > is of insufficient size, an object shall be allocated... > > This implies that it is ok to have null *LINEPTR and positive *N. Yes, it is OK. It should be also OK to have *N be any garbage when *LINEPTR is NULL, but the MinGW implementation fails to support that case. > I don't like using the value 120 as this is slightly larger than a > default line length of 80, which is confusing as you might think it > was that number for a reason and that we were supporting input line > lengths up to 120 bytes, when in fact any positive number would have > done. > > I will change it to be 1 with a comment that it should be any positive > number. The value 1 works, I already tested that. > This bug sounds like something that should be worked around with gnulib. > Would you be able to send details of the bug to bug-gnu...@gnu.org as > well as any information on the versions of MinGW affected? Yes, when I have time. I'm a bit busy these days; it's sheer luck I had so much time today to work on the non-trivial problems in this pretest. (And it isn't over yet.)