On systems with select() but without pselect(), bash fails to compile
due to what is possibly a bug in `lib/sh/input_avail.c`. This was tested
on Tru64 with the bash 5.1 source being built with GCC 4.7.4 on an
AlphaServer 1000A.
gcc -c -I. -I../.. -I../.. -I../../lib -I../../include -I.
-DHAVE_CONFIG_H -DSHELL -g -O2 -Wno-parentheses -Wno-format-security
input_avail.c
input_avail.c: In function 'nchars_avail':
input_avail.c:131:46: error: 'set' undeclared (first use in this function)
input_avail.c:131:46: note: each undeclared identifier is reported only
once for each function it appears in
input_avail.c:135:17: error: 'oset' undeclared (first use in this function)
Around line 110:
#if defined(HAVE_SELECT)
fd_set readfds, exceptfds;
#endif
#if defined (HAVE_PSELECT)
sigset_t set, oset;
#endif
Notice that `set` is only defined if HAVE_PSELECT is defined.
Later, around line 130:
#if defined (HAVE_SELECT) || defined (HAVE_PSELECT)
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
# ifdef SIGCHLD
sigaddset (&set, SIGCHLD);
# endif
sigemptyset (&oset);
#endif
You can see that `sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);` will
be reached even if HAVE_PSELECT isn't defined due to HAVE_SELECT being
defined, which is an issue on systems without a pselect() implementation
as `set` is never declared.
I believe that this isn't an issue on other platforms that have no
pselect() out of the box as gnulib has pselect() implementations for
them, which is not the case on Tru64.
Larkin