A few man page fixes from RHEL-5

2008-02-04 Thread Tomas Janousek
Hello,

these three patches have been accepted into RHEL-5.2 and I think they may be
worth including in bash upstream.

More info at ,
 and
.

Regards,
-- 
TJ. (Brno, CZ), BaseOS, Red Hat
--- bash-3.1/doc/bash.1.253673  2007-08-14 19:03:29.0 +0900
+++ bash-3.1/doc/bash.1 2007-08-14 19:03:45.0 +0900
@@ -5978,6 +5978,11 @@
 is supplied, the name and value of the alias is printed.
 \fBAlias\fP returns true unless a \fIname\fP is given for which
 no alias has been defined.
+.sp 1
+Note aliases are not expanded by default in non-interactive shell, and it can 
be enabled by setting the
+.B expand_aliases
+shell option using
+.BR shopt .
 .TP
 \fBbg\fP [\fIjobspec\fP ...]
 Resume each suspended job \fIjobspec\fP in the background, as if it
--- bash-3.2/builtins/ulimit.def.ulimit-m   2006-03-23 20:51:51.0 
+
+++ bash-3.2/builtins/ulimit.def2007-07-04 16:42:12.0 +0100
@@ -38,7 +38,7 @@
 -f the maximum size of files written by the shell and its children
 -i the maximum number of pending signals
 -l the maximum size a process may lock into memory
--m the maximum resident set size
+-m the maximum resident set size (has no effect on Linux)
 -n the maximum number of open file descriptors
 -p the pipe buffer size
 -q the maximum number of bytes in POSIX message queues
--- bash-3.2/doc/bash.1.ulimit-m2007-07-04 16:41:59.0 +0100
+++ bash-3.2/doc/bash.1 2007-07-04 16:42:12.0 +0100
@@ -8545,7 +8545,7 @@
 The maximum size that may be locked into memory
 .TP
 .B \-m
-The maximum resident set size
+The maximum resident set size (has no effect on Linux)
 .TP
 .B \-n
 The maximum number of open file descriptors (most systems do not
--- bash-3.2/doc/bash.1.245641  2008-01-15 16:17:17.0 +0100
+++ bash-3.2/doc/bash.1 2008-01-17 13:07:36.0 +0100
@@ -5916,6 +5916,13 @@
 to signify the end of the options.
 For example, the \fB:\fP, \fBtrue\fP, \fBfalse\fP, and \fBtest\fP builtins
 do not accept options.
+Also, please note that while executing in non-interactive mode and while in
+.I posix
+mode, any special builtin (like \fB.\fP, \fB:\fP, \fBbreak\fP,
+\fBcontinue\fP, \fBeval\fP, \fBexec\fP, \fBexit\fP, \fBexport\fP,
+\fBreadonly\fP, \fBreturn\fP, \fBset\fP, \fBshift\fP, \fBsource\fP,
+\fBtimes\fP, \fBtrap\fP, \fBunset\fP) exiting with a non-zero status
+causes the shell to stop execution.
 .sp .5
 .PD 0
 .TP


Re: A few man page fixes from RHEL-5

2008-02-04 Thread Matthew Woehlke

Tomas Janousek wrote:

these three patches have been accepted into RHEL-5.2 and I think they may be
worth including in bash upstream.

+Also, please note that while executing in non-interactive mode and while in
+.I posix
+mode, any special builtin (like \fB.\fP, \fB:\fP, \fBbreak\fP,
+\fBcontinue\fP, \fBeval\fP, \fBexec\fP, \fBexit\fP, \fBexport\fP,
+\fBreadonly\fP, \fBreturn\fP, \fBset\fP, \fBshift\fP, \fBsource\fP,
+\fBtimes\fP, \fBtrap\fP, \fBunset\fP) exiting with a non-zero status
+causes the shell to stop execution.


Doesn't 'exec' replace the process? I get the others (I think), but I 
don't understand what shell is left to "stop execution" after an exec.


--
Matthew
HIPPOS wallow slightly in the MUDDY RIVER
What do you want to do next?
> WALLOW IN MUDDY RIVER
You join HIPPOS.





Re: A few man page fixes from RHEL-5

2008-02-04 Thread Andreas Schwab
Matthew Woehlke <[EMAIL PROTECTED]> writes:

> Doesn't 'exec' replace the process? I get the others (I think), but I
> don't understand what shell is left to "stop execution" after an exec.

exec can fail.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Re: A few man page fixes from RHEL-5

2008-02-04 Thread Chet Ramey

Matthew Woehlke wrote:

Doesn't 'exec' replace the process? I get the others (I think), but I 
don't understand what shell is left to "stop execution" after an exec.


`exec' can fail for various reasons: usually because the file to be
executed is not present or not executable.  In its default mode, an
interactive bash will not exit, while a non-interactive shell will.
The `execfail' shell option can be used to control the behavior in a
non-interactive shell.  Posix just says the shell exits if exec fails.
Previous versions once made a distinction between interactive and non-
interactive shells, which newer versions have dropped.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/




Re: A few man page fixes from RHEL-5

2008-02-04 Thread Matthew Woehlke

Andreas Schwab wrote:

Matthew Woehlke <[EMAIL PROTECTED]> writes:


Doesn't 'exec' replace the process? I get the others (I think), but I
don't understand what shell is left to "stop execution" after an exec.


exec can fail.


D'oh, fail to *do* anything... I was thinking if whatever was exec'd 
failed :-). Yes, that makes sense, of course.


--
Matthew
HIPPOS wallow slightly in the MUDDY RIVER
What do you want to do next?
> WALLOW IN MUDDY RIVER
You join HIPPOS.





bash sucks lots of RAM doing read & echo in loop

2008-02-04 Thread wojtek
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd6.2
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='freebsd6.2' -DCONF_MACHTYPE='i386-portbld-freebsd6.2' 
-DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -I/usr/local/include 
-O2 -fno-strict-aliasing -pipe -march=pentium3
uname output: FreeBSD wojtek.tensor.gdynia.pl 6.2-RELEASE-p10 FreeBSD 
6.2-RELEASE-p10 #0: Tue Jan 15 16:35:37 CET 2008 [EMAIL 
PROTECTED]:/usr/src/sys/i386/compile/p234  i386
Machine Type: i386-portbld-freebsd6.2

Bash Version: 3.2
Patch Level: 17
Release Status: release

Description:
bash keeps all output it echoed in memory.
in my case it sucked over 3GB VM processing 2.5GB file.
details in "Repeat-By:"

Repeat-By:
such fragment of my script is executed

while read ll;do  echo $RANDOM $RANDOM $ll; done <$tmp2 | $SORT | cut 
-f 3- -d " " >$tmp3

where $tmp2 is 2.5GB input file, $tmp3 is output file and $SORT is 
"sort -S 512m"

this routine has to randomize lines of input file $tmp2.

and it works fine, but WHY bash gets over 3GB size, which grows as it 
processes $tmp2
input?

it should not keep anything in memory but pipe to sort program (which 
takes 512MB as
i wanted it+tempfiles). but it does both.

Fix: