bug-bash
[Top][All Lists]
Advanced

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

Re: Segmentation fault after fc command in bash script


From: Chet Ramey
Subject: Re: Segmentation fault after fc command in bash script
Date: Tue, 19 Apr 2011 16:11:20 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

On 4/17/11 6:28 AM, address@hidden wrote:
> 
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
> -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
> -DSHELL
> -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS
> -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic
> uname output: Linux dabbasciano 2.6.35.12-88.fc14.x86_64 #1 SMP Thu Mar 31
> 21:21:57 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-redhat-linux-gnu
> 
> Bash Version: 4.1
> Patch Level: 7
> Release Status: release
> 
> Description:
> I tried to write a simple bash script like this:
>    #!/bin/bash
>    fc -l -2
> When I run for the first time it works well, but if I execute again the 
> script I
> receive a "Segmentation fault (core dumped)" and the bash die.
> 
> Repeat-By:
> To reproduce the problem you must create a simple script with the follow 2 
> lines:
>    #!/bin/bash
>    fc -l -2
> and then run the script for 2 time. The output is:
>    $ . fc.sh
>    1000        cd prog/script/
>    1001        . fc.sh
>    $ . fc.sh
>    1001        . fc.sh
>    Segmentation fault (core dumped)

The problem has to do with bad calculations of the last history entry.
I've attached patches for bash-4.1 and bash-4.2.  Please let me know if
they fix the problem; they seem to fix it for me.

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

Attachment: fc-bash41.patch
Description: Source code patch

Attachment: fc-bash42.patch
Description: Source code patch


reply via email to

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