Re: AIX and Interix also do early PID recycling.

2012-08-28 Thread Roman Rakus

On 08/01/2012 03:13 PM, Chet Ramey wrote:

On 7/30/12 10:41 AM, Roman Rakus wrote:


Hmm... I don't know much about boundaries of maximum number of user
processes. But anyway - do you think that (re)changing js.c_childmax (when
`ulimit -u' is changed) is not good?

Maybe it's ok up to some fixed upper bound.  But if you're going to have
that fixed upper bound, why not just use it as the number of job exit
statuses to remember all the time?

I prepared a patch which add configure option to enable and set the 
number of job exit statuses to remember.
I found that posix is talking about changing system configurable 
variables and values; quoting:

"""
This runtime facility is not meant to provide ever-changing values that 
applications have to check multiple times. The values are seen as 
changing no more frequently than once per system initialization, such as 
by a system administrator or operator with an automatic configuration 
program. This volume of POSIX.1-2008 specifies that they shall not 
change within the lifetime of the process.

"""
(see http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html)
So I would tell that bash does not need to check every time maxchild value.
However, when the maxchild is set to unlimited, now the bash will use 
predefined DEFAULT_CHILD_MAX which is set to 32.
The attached patch adds ability to set forced number of remembered 
statuses, easily during configure time, example:

 ./configure --enable-fixedjsmax=2048
It will force bash to remember 2048 statuses, independently on childmax 
value.

Patch should clearly apply to git master branch.
Chet, what do you think about it?

RR
>From 32701d12fc6ddf8e3289ea920423c0e55210e3a5 Mon Sep 17 00:00:00 2001
From: Roman Rakus 
Date: Thu, 23 Aug 2012 19:35:52 +0200
Subject: [PATCH] Option to use fixed number of remembered job exit statuses

Signed-off-by: Roman Rakus 
---
 config.h.in  |  3 +++
 configure.in | 13 +
 jobs.c   |  8 
 3 files changed, 24 insertions(+)

diff --git a/config.h.in b/config.h.in
index 6b1fc4a..b09b939 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1125,6 +1125,9 @@
 
 /* End additions for lib/intl */
 
+/* Define if you want to use fixed number of remembered job exit statuses */
+#undef USE_FIXEDJSMAX_NUMBER
+
 #include "config-bot.h"
 
 #endif /* _CONFIG_H_ */
diff --git a/configure.in b/configure.in
index d7e0998..dd5e0c9 100644
--- a/configure.in
+++ b/configure.in
@@ -1107,6 +1107,19 @@ case "$srcdir" in
 	;;
 esac
 
+AC_MSG_CHECKING([whether to use fixed number of remembered job exit statuses])
+AC_ARG_ENABLE([fixedjsmax],
+  [AS_HELP_STRING([--enable-fixedjsmax=number],
+ [Enable fixed number of remembered job exit statuses])],
+  [ENABLE_FIXEDJSMAX="${enableval}"], [ENABLE_FIXEDJSMAX='no'])
+AC_MSG_RESULT(${ENABLE_FIXEDJSMAX})
+if test "x${ENABLE_FIXEDJSMAX}" != xno; then
+  AS_IF([test "${ENABLE_FIXEDJSMAX}" -gt "0" 2>/dev/null],
+AC_DEFINE_UNQUOTED(USE_FIXEDJSMAX_NUMBER, [${ENABLE_FIXEDJSMAX}]),
+AC_MSG_ERROR([invalid value]))
+fi
+
+
 BUILD_DIR=`pwd`
 case "$BUILD_DIR" in
 *\ *)	BUILD_DIR=`echo "$BUILD_DIR" | sed 's: : :g'` ;;
diff --git a/jobs.c b/jobs.c
index d63c5dd..7744b5e 100644
--- a/jobs.c
+++ b/jobs.c
@@ -3723,9 +3723,13 @@ initialize_job_control (force)
 get_tty_state ();
 
   if (js.c_childmax < 0)
+#if defined (USE_FIXEDJSMAX_NUMBER)
+js.c_childmax = USE_FIXEDJSMAX_NUMBER;
+#else
 js.c_childmax = getmaxchild ();
   if (js.c_childmax < 0)
 js.c_childmax = DEFAULT_CHILD_MAX;
+#endif
 
   return job_control;
 }
@@ -4092,9 +4096,13 @@ mark_dead_jobs_as_notified (force)
 #endif
 
   if (js.c_childmax < 0)
+#if defined (USE_FIXEDJSMAX_NUMBER)
+js.c_childmax = USE_FIXEDJSMAX_NUMBER;
+#else
 js.c_childmax = getmaxchild ();
   if (js.c_childmax < 0)
 js.c_childmax = DEFAULT_CHILD_MAX;
+#endif
 
   /* Don't do anything if the number of dead processes is less than CHILD_MAX
  and we're not forcing a cleanup. */
-- 
1.7.11.4



[PATCH 1/3] build: use configure.ac, not configure.in

2012-08-28 Thread Stefano Lattarini
Support for the latter name will soon start to cause warnings in
Autoconf and Automake, and will likely be later removed altogether
in future versions of those packages.

For more reference, see:



Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini 
---
 INSTALL  | 4 ++--
 MANIFEST | 2 +-
 Makefile.in  | 4 ++--
 configure.in => configure.ac | 0
 doc/bashref.texi | 4 ++--
 support/mkconffiles  | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)
 rename configure.in => configure.ac (100%)

diff --git a/INSTALL b/INSTALL
index 16fa685..05e741c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -47,8 +47,8 @@ out how `configure' could check whether or not to do them, 
and mail
 diffs or instructions to  so they can be
 considered for the next release.
 
-The file `configure.in' is used to create `configure' by a program
-called Autoconf.  You only need `configure.in' if you want to change it
+The file `configure.ac' is used to create `configure' by a program
+called Autoconf.  You only need `configure.ac' if you want to change it
 or regenerate `configure' using a newer version of Autoconf.  If you do
 this, make sure you are using Autoconf version 2.50 or newer.
 
diff --git a/MANIFEST b/MANIFEST
index 11fd275..200e09c 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -51,7 +51,7 @@ READMEf
 RBASH  f
 AUTHORSf
 Y2Kf
-configure.in   f
+configure.ac   f
 configure  f   755
 Makefile.inf
 config-top.h   f
diff --git a/Makefile.in b/Makefile.in
index 9f9276d..04901a7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for bash-4.2, version 4.4
 #
-# Copyright (C) 1996-2010 Free Software Foundation, Inc.
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
 
 #   This program is free software: you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -710,7 +710,7 @@ pathnames.h:Makefile 
$(srcdir)/pathnames.h.in
@${RM} pathnames.tmp
 
 # comment out for distribution
-$(srcdir)/configure:   $(srcdir)/configure.in $(srcdir)/aclocal.m4 
$(srcdir)/config.h.in
+$(srcdir)/configure:   $(srcdir)/configure.ac $(srcdir)/aclocal.m4 
$(srcdir)/config.h.in
cd $(srcdir) && autoconf
 
 # for chet
diff --git a/configure.in b/configure.ac
similarity index 100%
rename from configure.in
rename to configure.ac
diff --git a/doc/bashref.texi b/doc/bashref.texi
index ae982d5..5448302 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -7232,9 +7232,9 @@ to do them, and mail diffs or instructions to
 @email{bash-maintainers@@gnu.org} so they can be
 considered for the next release.
 
-The file @file{configure.in} is used to create @code{configure}
+The file @file{configure.ac} is used to create @code{configure}
 by a program called Autoconf.  You only need
-@file{configure.in} if you want to change it or regenerate
+@file{configure.ac} if you want to change it or regenerate
 @code{configure} using a newer version of Autoconf.  If
 you do this, make sure you are using Autoconf version 2.50 or
 newer.
diff --git a/support/mkconffiles b/support/mkconffiles
index 9eb2231..59e4c0f 100755
--- a/support/mkconffiles
+++ b/support/mkconffiles
@@ -1,7 +1,7 @@
 #! /bin/sh
 #
 # mkconffiles - create _distribution and _patchlevel files in preparation
-#  for recreating `configure' from `configure.in'
+#  for recreating `configure' from `configure.ac'
 #
 # options:
 #  -s srcdir   directory where `configure' resides (defaults to `.')
-- 
1.7.12




[PATCH 3/3] docs: regenerate text documentation (but not PDF, DVI nor PostScript)

2012-08-28 Thread Stefano Lattarini
Signed-off-by: Stefano Lattarini 
---
 doc/bash.html|  54 ++---
 doc/bashref.html |  28 +++--
 doc/bashref.info | 329 ---
 3 files changed, 227 insertions(+), 184 deletions(-)

diff --git a/doc/bash.html b/doc/bash.html
index d1b6489..2f88c4e 100644
--- a/doc/bash.html
+++ b/doc/bash.html
@@ -42,7 +42,7 @@ bash - GNU Bourne-Again SHell
 COPYRIGHT
 
 
-Bash is Copyright © 1989-2010 by the Free Software Foundation, Inc.
+Bash is Copyright © 1989-2011 by the Free Software Foundation, Inc.
  
 DESCRIPTION
 
@@ -1907,7 +1907,6 @@ this instance of
 The values assigned to the array members are as follows:
 
 
-
 
 BASH_VERSINFO[0]
 
@@ -1936,7 +1935,6 @@ The value of
 MACHTYPE.
 
 
-
 
 
 BASH_VERSION
@@ -2917,6 +2915,7 @@ If this variable is not set, bash acts as if it 
had the
 value $aq\nreal\t%3lR\nuser\t%3lU\nsys  %3lSaq.
 If the value is null, no timing information is displayed.
 A trailing newline is added when the format string is displayed.
+
 TMOUT
 
 
@@ -3138,6 +3137,10 @@ option to specify an indexed array and a
 -A
 
 option to specify an associative array.
+If both options are supplied, 
+-A
+
+takes precedence.
 The
 read
 
@@ -3432,7 +3435,7 @@ a level of variable indirection is introduced.
 expanded and that value is used in the rest of the substitution, rather
 than the value of parameter itself.
 This is known as indirect expansion.
-The exceptions to this are the expansions of ${!\fPfIprefix*} and
+The exceptions to this are the expansions of ${!prefix*} 
and
 ${!name[@]} described below.
 The exclamation point must immediately follow the left brace in order to
 introduce indirection.
@@ -3741,8 +3744,6 @@ array in turn, and the expansion is the resultant list.
 
 Command substitution allows the output of a command to replace
 the command name.  There are two forms:
-
-
 
 
 
@@ -5455,7 +5456,6 @@ arguments, if any.
 
 The shell has an execution environment, which consists of the
 following:
-
 
 *
 open files inherited by the shell at invocation, as modified by
@@ -9276,12 +9276,12 @@ with the exceptions that +a
 may not be used to destroy an array variable and +r will not
 remove the readonly attribute.
 When used in a function, makes each
-name local, as with the 
+name local, as with the
 local
 
 command,
-unless the -gP option is supplied,
-If a variable name is followed by =value, the value of
+unless the -g option is supplied,
+If a variable name is followed by =value, the value of
 the variable is set to value.
 The return value is 0 unless an invalid option is encountered,
 an attempt is made to define a function using
@@ -9990,11 +9990,14 @@ Display the description of each pattern in a 
manpage-like format
 
 Display only a short usage synopsis for each pattern
 
-
+
+
 
 The return status is 0 unless no command matches
 pattern.
 
+
+
 history [n]
 
 history -c
@@ -10695,7 +10698,7 @@ times out (in which case the return code is greater 
than 128), or an
 invalid file descriptor is supplied as the argument to -u.
 
 
-readonly [-aApf] [name[=word] ...]
+readonly [-aAf] [-p] [name[=word] 
...]
 
 The given
 names are marked readonly; the values of these
@@ -10715,6 +10718,10 @@ option restricts the variables to indexed arrays; the
 -A
 
 option restricts the variables to associative arrays.
+If both options are supplied,
+-A
+
+takes precedence.
 If no
 name
 
@@ -10722,6 +10729,8 @@ arguments are given, or if the
 -p
 
 option is supplied, a list of all readonly names is printed.
+The other options may be used to restrict the output to a subset of
+the set of readonly names.
 The
 -p
 
@@ -11432,7 +11441,6 @@ and the effect of interrupting a command list.
 compat41
 
 
-@item compat41
 If set,
 bash,
 
@@ -11441,6 +11449,19 @@ parameter expansion as a special character.  The 
single quotes must match
 (an even number) and the characters between the single quotes are considered
 quoted.  This is the behavior of posix mode through version 4.1.
 The default bash behavior remains as in previous versions.
+direxpand
+
+
+If set,
+bash
+
+replaces directory names with the results of word expansion when performing
+filename completion.  This changes the contents of the readline editing
+buffer.
+If not set,
+bash
+
+attempts to preserve what the user typed.
 dirspell
 
 
@@ -11562,7 +11583,7 @@ This option is enabled by default.
 
 
 If set, the pattern ** used in a pathname expansion context will
-match a files and zero or more directories and subdirectories.
+match all files and zero or more directories and subdirectories.
 If the pattern is followed by a /, only directories and
 subdirectories match.
 gnu_errfmt
@@ -11758,6 +11779,7 @@ If set, the echo builtin expands 
backslash-escape sequences
 by default.
 
 
+
 suspend [-f]
 Suspend the execution of this shell until it receives a
 SIGCONT
@@ -12643,7 +12665,7 @@ it provides for filing a bug report.
 
 Comments and bug reports concerning
 this manual page should be dire