OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 04-Nov-2004 12:51:34 Branch: OPENPKG_2_2_SOLID Handle: 2004110411513300 Modified files: (Branch: OPENPKG_2_2_SOLID) openpkg-src/bash bash.patch bash.spec Log: MFC: On brain-dead Linux platforms somewhere between glibc 2.3.3 (20040405) and glibc 2.3.3 (20040917) (e.g. between SuSE 9.1 and SuSE 9.2 or between Gentoo 1.4.x and 1.5.x) the system headers provide the waitpid(2) option WCONTINUED although the underlying Linux kernels 2.4 and 2.6 still do not support this option and return EINVAL on waitpid(2) using WCONTINUED. As a side-effect the GNU Bash goes into an endless loop with waitpid(3) calls after the first executed command terminated. The following patch is derived from Gentoo Portage and workarounds this problems by gracefully and efficiently degrading the options on waitpid(2) calls. Well, it's just another great example of how good Linux provides standardized APIs -- actually they are nothing more than Potemkin villages. Ggrrrrr! Summary: Revision Changes Path 1.11.2.1 +50 -0 openpkg-src/bash/bash.patch 1.55.2.3 +1 -1 openpkg-src/bash/bash.spec ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/bash/bash.patch ============================================================================ $ cvs diff -u -r1.11 -r1.11.2.1 bash.patch --- openpkg-src/bash/bash.patch 9 Sep 2004 07:18:58 -0000 1.11 +++ openpkg-src/bash/bash.patch 4 Nov 2004 11:51:33 -0000 1.11.2.1 @@ -175,3 +175,53 @@ off = -zone.tz_minuteswest; #endif /* !HAVE_TZNAME */ +----------------------------------------------------------------------------- + +On brain-dead Linux platforms somewhere between glibc 2.3.3 (20040405) +and glibc 2.3.3 (20040917) (e.g. between SuSE 9.1 and SuSE 9.2 or +between Gentoo 1.4.x and 1.5.x) the system headers provide the +waitpid(2) option WCONTINUED although the underlying Linux kernels 2.4 +and 2.6 still do not support this option and return EINVAL on waitpid(2) +using WCONTINUED. + +As a side-effect the GNU Bash goes into an endless loop with waitpid(3) +calls after the first executed command terminated. The following +patch is derived from Gentoo Portage and workarounds this problems by +gracefully and efficiently degrading the options on waitpid(2) calls. + +Well, it's just another great example of how good Linux provides +standardized APIs -- actually they are nothing more than Potemkin +villages. Ggrrrrr! + +Index: jobs.c +--- jobs.c.orig 2004-11-04 10:29:23 +0100 ++++ jobs.c 2004-11-04 10:32:47 +0100 +@@ -2476,6 +2476,9 @@ + PROCESS *child; + pid_t pid; + int call_set_current, last_stopped_job, job, children_exited, waitpid_flags; ++#ifdef __linux__ ++ static int wcontinued_not_supported = 0; ++#endif + + call_set_current = children_exited = 0; + last_stopped_job = NO_JOB; +@@ -2489,7 +2492,18 @@ + : 0; + if (sigchld || block == 0) + waitpid_flags |= WNOHANG; ++#ifdef __linux__ ++ retry: ++ if (wcontinued_not_supported) ++ waitpid_flags &= ~WCONTINUED; ++#endif + pid = WAITPID (-1, &status, waitpid_flags); ++#ifdef __linux__ ++ if (pid == -1 && errno == EINVAL) { ++ wcontinued_not_supported = 1; ++ goto retry; ++ } ++#endif + + /* The check for WNOHANG is to make sure we decrement sigchld only + if it was non-zero before we called waitpid. */ @@ . patch -p0 <<'@@ .' Index: openpkg-src/bash/bash.spec ============================================================================ $ cvs diff -u -r1.55.2.2 -r1.55.2.3 bash.spec --- openpkg-src/bash/bash.spec 23 Oct 2004 10:49:12 -0000 1.55.2.2 +++ openpkg-src/bash/bash.spec 4 Nov 2004 11:51:33 -0000 1.55.2.3 @@ -40,7 +40,7 @@ Group: Shell License: GPL Version: %{V_base_real}.%{V_plvl_raw} -Release: 2.2.1 +Release: 2.2.2 # list of sources Source0: ftp://ftp.cwru.edu/pub/bash/bash-%{V_base_real}.tar.gz @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]