Re: memory allocation bug in bash 4.2.39(1)-release

2013-08-12 Thread Greg Wooledge
On Fri, Aug 09, 2013 at 10:47:21PM -0600, Bob Proulx wrote:
> John Vincent wrote:
> > echo {1..2000}
> > it runs, but afterwards whenever I enter another command I get the error:
> > -bash: fork: Cannot allocate memory
> 
> You need to allocate more virtual memory space to your machine.  You
> are asking it to do more than it can do with the memory it has
> available.

Brace expansion causes bash to generate the full list of expanded words
in memory all at once.  This means bash has to allocate enough memory
to hold them, all at once.  20 million strings of varying length from
1 to 8 bytes, plus NUL terminators, plus all the overhead of the memory
allocation system... is a lot of wasted memory just to count integers.

If you use a C-style for loop instead, then bash doesn't have to
generate and store the entire list of strings all at once:

  for ((i=1; i<=2000; i++)); do
printf "%d " "$i"
  done
  echo

(That's not 100% equivalent because the for loop generates one extra
space right before the final newline.)



Wrong Character Encoding

2013-08-12 Thread Marcus Manning
I hope it is right so to write my bug report to this address in the 
given format.


If I put a "ä"-character in my terminal and press Enter, then I will 
receive an escape-sequence like this: $'\303\244'.  The same result by 
"ü", "ö", "ß", but other sequences.


My /etc/inputrc:
# do not bell on tab-completion
#set bell-style none

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

$if mode=emacs

# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[7~": beginning-of-line
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word

# for rxvt
"\e[8~": end-of-line

# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif

localectl:
System Locale: LANG=de_DE.UTF-8
  LC_COLLATE=C
  LC_MESSAGES=C
   VC Keymap: de-latin1
  X11 Layout: n/a

locale:
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE=C
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES=C
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

SHELL=bash
TERM=xterm
OS=arch linux



Maybe you could help me.
Thanks.




Re: memory allocation bug in bash 4.2.39(1)-release

2013-08-12 Thread Chet Ramey
On 8/10/13 12:47 AM, Bob Proulx wrote:
> John Vincent wrote:
>> I find that if I enter the command:
>> echo {1..2000}
>> it runs, but afterwards whenever I enter another command I get the error:
>> -bash: fork: Cannot allocate memory
> 
> You need to allocate more virtual memory space to your machine.  You
> are asking it to do more than it can do with the memory it has
> available.
> 
>> I guess that the memory allocated to all those numbers on the echo
>> command line is not freed properly.
> 
> This has been discussed previously.  Please see this message thread
> for the previous discussion.
> 
>   http://lists.gnu.org/archive/html/bug-bash/2011-11/msg00181.html

Other references:

http://lists.gnu.org/archive/html/bug-bash/2008-05/msg00047.html
http://lists.gnu.org/archive/html/bug-bash/2009-05/msg6.html

In short: malloc requests memory from the kernel but only returns it to
the kernel under certain special circumstances.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Wrong Character Encoding

2013-08-12 Thread Roman Rakus

This will probably be fixed in next release. For reference:
http://lists.gnu.org/archive/html/bug-bash/2011-08/msg00214.html

RR

On 08/12/2013 03:55 PM, Marcus Manning wrote:

I hope it is right so to write my bug report to this address in the
given format.

If I put a "ä"-character in my terminal and press Enter, then I will
receive an escape-sequence like this: $'\303\244'.  The same result by
"ü", "ö", "ß", but other sequences.

My /etc/inputrc:
# do not bell on tab-completion
#set bell-style none

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

$if mode=emacs

# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[7~": beginning-of-line
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word

# for rxvt
"\e[8~": end-of-line

# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif

localectl:
System Locale: LANG=de_DE.UTF-8
   LC_COLLATE=C
   LC_MESSAGES=C
VC Keymap: de-latin1
   X11 Layout: n/a

locale:
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE=C
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES=C
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

SHELL=bash
TERM=xterm
OS=arch linux



Maybe you could help me.
Thanks.







Re: Wrong Character Encoding

2013-08-12 Thread Chet Ramey
On 8/12/13 1:04 PM, Roman Rakus wrote:
> This will probably be fixed in next release. For reference:
> http://lists.gnu.org/archive/html/bug-bash/2011-08/msg00214.html

Maybe, maybe not.  I'm assuming yes because it seems like it is
command-not-found output he's seeing, but we can't be sure without
more details.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/