Mail Archives: djgpp/1997/07/28/23:33:58
On Tue, 15 Jul 1997 10:00:17 GMT, Esa A E Peuha <peuha AT cc DOT helsinki DOT fi>
wrote:
> On Sun, 13 Jul 1997, Eli Zaretskii wrote:
>
> > Yes, I also get the crash traceback which points into `gmalloc' (which
> > is GNU's replacement for `malloc' and friends). But I'm clueless as
> > to why does it crash there, or why only for .exe built on my machine?
>
I have tried rebuilding emacs, but my results are different:
***** crash.txt *****
D:\TEMP\GNU\EMACS\BIN>emacs.exe
Exiting due to signal SIGSEGV
General Protection Fault at eip=0007481f
eax=1011dc2c ebx=00070d02 ecx=0000006c edx=00000145 esi=00115364
edi=00070d02
ebp=00220f44 esp=00220f38 program=D:\TEMP\GNU\EMACS\BIN\EMACS.EXE
cs: sel=00a7 base=82f89000 limit=0025ffff
ds: sel=00af base=82f89000 limit=0025ffff
es: sel=00af base=82f89000 limit=0025ffff
fs: sel=0087 base=00017480 limit=0000ffff
gs: sel=00cf base=00000000 limit=ffffffff
ss: sel=00af base=82f89000 limit=0025ffff
Call frame traceback EIPs:
0x0007481f _getenv+47, line 20 of getenv.c
0x00070d68 _internal_terminal_init+72, line 916 of msdos.c
0x00025972 _init_sys_modes+70, line 1424 of sysdep.c
0x00018387 _main+1151, line 832 of emacs.c
0x0007a51a ___crt1_startup+138
***** end of crash.txt *****
In getenv eax holds environ[i] and it is out of selector limit.
(Emacs was compiled as suggested in `INSTALL':
unzip em1934*.zip; cd gnu/emacs; config msdos; make install.
Only added getenv.c for line numbers in traceback).
-----
There is a bug in putenv (when allocating bigger chunk for
environ, one element is not counted).
This bug can explain magic number 21.
Here is a patch:
***** putenv.fix ****
*** putenv.c Sun Oct 6 00:27:44 1996
--- d:/temp/gnu/emacs/src/putenv.c Thu Jul 24 10:26:06 1997
***************
*** 53,59 ****
if (putenv_bss_count != __bss_count
|| environ != prev_environ)
{
! putenv_bss_count = __bss_count;
for (ecount=0; environ[ecount]; ecount++);
emax = ecount;
/* Bump the count to a value no function has yet seen,
--- 53,59 ----
if (putenv_bss_count != __bss_count
|| environ != prev_environ)
{
! /* putenv_bss_count = __bss_count; */
for (ecount=0; environ[ecount]; ecount++);
emax = ecount;
/* Bump the count to a value no function has yet seen,
***************
*** 105,112 ****
if (ecount >= emax)
{
char **enew;
emax += 10;
! enew = (char **)malloc(emax * sizeof(char *));
if (enew == 0)
return -1;
memcpy(enew, environ, ecount * sizeof(char *));
--- 105,113 ----
if (ecount >= emax)
{
char **enew;
+ /* (environ[emax] == 0) when environ is full. */
emax += 10;
! enew = (char **)malloc((emax + 1) * sizeof(char *));
if (enew == 0)
return -1;
memcpy(enew, environ, ecount * sizeof(char *));
***** end of putenv.fix *****
The line with `putenv_bss_count = __bss_count;' was commented,
because later there is a test for `putenv_bss_count != __bss_count'.
(This can be left as it was, but it should be changed somehow).
Emacs compiled with patched putenv does not crash,
but emacs compiled without it does.
- Raw text -