[Top][All Lists]

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

bash fails to compile on systems with select() but not pselect()

From: Larkin Nickle
Subject: bash fails to compile on systems with select() but not pselect()
Date: Sat, 22 May 2021 14:43:49 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2

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;
#if defined (HAVE_PSELECT)
  sigset_t set, oset;

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);

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.


reply via email to

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