Segmentation fault after fc command in bash script

2011-04-17 Thread pi...@piumalab.org
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


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)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNqsDRAAoJEDSpnBSp0g/Yh2oH/3Z1UwsgnZctN8FSpHAksKIl
1yxGRLqhLQw8D8wONUUI1FEpyy5jAgXELhx4TQbSAf0X/NlNqY/j/6UkGIeokQnA
tE75SYUnAqKPk55o8Bv6fKnvmVJZdh7gSZOVmMuXZXHeHmcWcWBL5YsyKiv3pUwh
nPhTa6DJAXOLMW6dCej1wXhp6TVQQyH7q22UBhDHweY1pcF3EGPKCZ0gGCQbr1NM
fs5qtoOoZoA1c7Mp+q1DX6MFIwuXKijOw6DjqjNVtbLWxEYui4lCOMQV7y2fNpT/
EY+gjIquMCO2BXRtFJbVFPAY+90JU/zb4m7NmmyX2XM+0Hz5lqfpZ96soTGu4T0=
=5NuS
-END PGP SIGNATURE-



Re: Segmentation fault after fc command in bash script

2011-04-21 Thread pi...@piumalab.org
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 19/04/2011 22:11, Chet Ramey wrote:
> 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

Hello Chet!
I had tested your patch in the bash version 4.2, and I didn't found the bug any
more.
All seems works well.


Thanks a lot for the patch.
   Piuma
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNsEr4AAoJEDSpnBSp0g/YfckH/392ReNtFH7PE+mpNtc+BaJZ
HVHdPlDTxrfmxj8cXbjxQPYbUMhGIxCmu3wZFY5iOcCyA+p2IYldg53LrvJq7tUr
LXsrGCH5yj+ifBGKyhdRvf7msFimt4i7HCON+I4OrdoeuL0E4BMqkbGND+gwHUJo
ssSqCpJQn8mRZ7/iOZFrxQZoknedmQqB8TEi+k67U4RJ6SpGibx61THa1mOiWkFJ
BKXuI1fAWkCDhkv34Jad+Dol/zgjVafmufgZy9WYYoleF9RlYOQEw6g1Wi9bK5Cv
eBI8ANVWwWpPwF/Iy0KakEeID53D1T7Ok0gjEFkS87FxzLG3Q17hvsJBjqGvwcs=
=MC5u
-END PGP SIGNATURE-