			     BASH PATCH REPORT
			     =================

Bash-Release:	5.2
Patch-ID:	bash52-035

Bug-Reported-by:	Henry Bent <henry.r.bent@gmail.com>
Bug-Reference-ID:	<CAEdTPBdD0WOW2n0-y-XyZ_VwhbiG-oS3bXfGkOPPG617rGH-Ww@mail.gmail.com>
Bug-Reference-URL:	https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00044.html

Bug-Description:

There are systems that supply one of select or pselect, but not both.

Patch (apply with `patch -p0'):

https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00058.html

*** ../bash/bash-5.2-patched/lib/readline/input.c	2022-04-08 15:43:24.000000000 -0400
--- lib/readline/input.c	2022-11-16 09:10:41.000000000 -0500
***************
*** 152,156 ****
--- 152,158 ----
  int _rl_timeout_init (void);
  int _rl_timeout_sigalrm_handler (void);
+ #if defined (RL_TIMEOUT_USE_SELECT)
  int _rl_timeout_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *, const sigset_t *);
+ #endif
  
  static void _rl_timeout_handle (void);
***************
*** 249,253 ****
    int chars_avail, k;
    char input;
! #if defined(HAVE_SELECT)
    fd_set readfds, exceptfds;
    struct timeval timeout;
--- 251,255 ----
    int chars_avail, k;
    char input;
! #if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
    fd_set readfds, exceptfds;
    struct timeval timeout;
***************
*** 806,810 ****
    unsigned char c;
    int fd;
! #if defined (HAVE_PSELECT)
    sigset_t empty_set;
    fd_set readfds;
--- 808,812 ----
    unsigned char c;
    int fd;
! #if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
    sigset_t empty_set;
    fd_set readfds;
*** ../bash-5.2-patched/lib/sh/input_avail.c	2021-05-24 11:16:33.000000000 -0400
--- lib/sh/input_avail.c	2022-11-16 09:12:48.000000000 -0500
***************
*** 34,40 ****
  #endif /* HAVE_SYS_FILE_H */
  
! #if defined (HAVE_PSELECT)
! #  include <signal.h>
! #endif
  
  #if defined (HAVE_UNISTD_H)
--- 34,38 ----
  #endif /* HAVE_SYS_FILE_H */
  
! #include <signal.h>
  
  #if defined (HAVE_UNISTD_H)
***************
*** 108,115 ****
  {
    int result, chars_avail;
- #if defined(HAVE_SELECT)
-   fd_set readfds, exceptfds;
- #endif
  #if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
    sigset_t set, oset;
  #endif
--- 106,111 ----
  {
    int result, chars_avail;
  #if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
+   fd_set readfds, exceptfds;
    sigset_t set, oset;
  #endif
***************
*** 122,132 ****
    chars_avail = 0;
  
! #if defined (HAVE_SELECT)
    FD_ZERO (&readfds);
    FD_ZERO (&exceptfds);
    FD_SET (fd, &readfds);
    FD_SET (fd, &exceptfds);
- #endif
- #if defined (HAVE_SELECT) || defined (HAVE_PSELECT)
    sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
  #  ifdef SIGCHLD
--- 115,123 ----
    chars_avail = 0;
  
! #if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
    FD_ZERO (&readfds);
    FD_ZERO (&exceptfds);
    FD_SET (fd, &readfds);
    FD_SET (fd, &exceptfds);
    sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
  #  ifdef SIGCHLD

*** ../bash-5.2/patchlevel.h	2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 34
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 35
  
  #endif /* _PATCHLEVEL_H_ */
