File readline82-011 of Package readline
READLINE PATCH REPORT
=====================
Readline-Release: 8.2
Patch-ID: readline82-011
Bug-Reported-by: Grisha Levit <grishalevit@gmail.com>
Bug-Reference-ID: <CAMu=BrqWa_iNkiEwchpFmtrUhFrAanOO8pjy7VCKqRKUvqdsbw@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2024-02/msg00075.html
Bug-Description:
Patch (apply with `patch -p0'):
Some systems (e.g., macOS) send signals early on in interactive initialization,
so readline should retry a failed open of the init file.
*** ../readline-8.2-patched/bind.c Wed Feb 9 11:02:22 2022
--- bind.c Tue Apr 23 15:07:13 2024
***************
*** 979,987 ****
int i, file;
! file = -1;
! if (((file = open (filename, O_RDONLY, 0666)) < 0) || (fstat (file, &finfo) < 0))
{
if (file >= 0)
close (file);
return ((char *)NULL);
}
--- 969,986 ----
int i, file;
! file = open (filename, O_RDONLY, 0666);
! /* If the open is interrupted, retry once */
! if (file < 0 && errno == EINTR)
{
+ RL_CHECK_SIGNALS ();
+ file = open (filename, O_RDONLY, 0666);
+ }
+
+ if ((file < 0) || (fstat (file, &finfo) < 0))
+ {
+ i = errno;
if (file >= 0)
close (file);
+ errno = i;
return ((char *)NULL);
}
***************
*** 992,999 ****
--- 991,1001 ----
if (file_size != finfo.st_size || file_size + 1 < file_size)
{
+ i = errno;
if (file >= 0)
close (file);
#if defined (EFBIG)
errno = EFBIG;
+ #else
+ errno = i;
#endif
return ((char *)NULL);
*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500
--- patchlevel 2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
# Do not edit -- exists only for use by patch
! 10
--- 1,3 ----
# Do not edit -- exists only for use by patch
! 11