bug-bison
[Top][All Lists]
Advanced

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

Re: Bison submit patches


From: Bruno Haible
Subject: Re: Bison submit patches
Date: Tue, 23 Aug 2022 22:53:07 +0200

Paul Eggert wrote:
> On 8/22/22 05:19, Andrei Malashkin wrote:please consider adding these 
> patches to the next bison release
> > https://github.com/conan-io/conan-center-index/pull/12439/commits/c3e05b98ba2c96c5b46b06d67eacac3d0d86a58e#diff-78354ca740cc9e125c777be4e3f9ec375c7d7d7c5368a3d4ab0c01357f42b58b
> > https://github.com/conan-io/conan-center-index/blob/master/recipes/bison/all/patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch
> > https://github.com/conan-io/conan-center-index/blob/master/recipes/bison/all/patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch
> These are all patches against Gnulib not Bison proper, so I am adding 
> bug-gnulib@gnu.org to the cc list.

The second patch is against Bison proper, and can be simplified like this:

diff --git a/src/location.c b/src/location.c
index 5edce82c..86e7c39d 100644
--- a/src/location.c
+++ b/src/location.c
@@ -268,7 +268,7 @@ caret_set_file (const char *file)
   if (!caret_info.pos.file)
     {
       caret_info.pos.file = file;
-      if ((caret_info.file = fopen (caret_info.pos.file, "r")))
+      if ((caret_info.file = fopen (caret_info.pos.file, "rb")))
         {
           /* If the file is not regular (imagine #line 1 "/dev/stdin"
              in the input file for instance), don't try to quote the

It rationale is that caret_getc_internal already handles the CR/LF
newlines from Windows, and therefore opening the file in binary mode
avoids the horrible kludges of the Microsoft stdio runtime for O_TEXT
files.

The first patch, to use O_TEXT instead of O_BINARY, is to be rejected.
Programs need to be taught to accept CR/LF instead of LF on input;
that is the recommendation from the Unicode consortium. Maybe the
effect was that there were testsuite failure due to CR/LF instead of LF?
In this case, you'll better modify the unit test to pipe the result
through "tr -d '\r'".

The third patch, to use 8192 instead of 65536 as the upper limit for
getdtablesize() is also better not upstreamed. Rationale: This
upper limit was 2048 in Windows XP and apparently is 8192 in Windows 10.
Therefore it is likely to be increased in the future. As far as I understand
from [1], the effect was a debugger interaction when in a build with
build_type=Debug. But we need the exception handling in general. You could,
though, find out if there is a way to avoid the debugger interaction when
the program adds an invalid parameter handler. Maybe the way is simply
to not use the "Debug" mode when building?

Bruno

[1] 
https://github.com/conan-io/conan-center-index/pull/2334#issuecomment-668028180





reply via email to

[Prev in Thread] Current Thread [Next in Thread]