trouble porting dash shell (make errors)

View: New views
2 Messages — Rating Filter:   Alert me  

trouble porting dash shell (make errors)

by Eitan Adler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried the dash mailing list with no reply.
mksignames.c is attached.

Here is the output from ./configure && gmake

if gcc -DHAVE_CONFIG_H -I. -I. -I..  -include ../config.h -DBSD=1
-DSHELL -DIFS_BROKEN  -Wall -g -O2 -MT nodes.o -MD -MP -MF
".deps/nodes.Tpo" -c -o nodes.o nodes.c; \
       then mv -f ".deps/nodes.Tpo" ".deps/nodes.Po"; else rm -f
".deps/nodes.Tpo"; exit 1; fi
gcc -include ../config.h -DBSD=1 -DSHELL -DIFS_BROKEN  -g -O2 -Wall
-o mksignames mksignames.c
./mksignames
gmake[3]: *** [signames.c] Segmentation fault: 11 (core dumped)
gmake[3]: *** Deleting file `signames.c'
gmake[3]: Leaving directory `/home/eitan/dash/dash-0.5.5.1/src'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/home/eitan/dash/dash-0.5.5.1/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/eitan/dash/dash-0.5.5.1'
gmake: *** [all] Error 2


_______________________________________________
freebsd-ports@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe@..."

mksignames.c (14K) Download Attachment

Re: trouble porting dash shell (make errors)

by Dmitry Marakasov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Eitan Adler (eitanadlerlist@...) wrote:

> I tried the dash mailing list with no reply.
> mksignames.c is attached.
>
> Here is the output from ./configure && gmake

You should've use gdb to get a line where it dies:

--
% gdb ./mksignames                
...
(gdb) run
Starting program: /tmp/dash/dash-0.5.5.1/src/mksignames
Assertion failed: (arena->magic == ARENA_MAGIC), function arena_malloc, file /usr/src/lib/libc/stdlib/malloc.c, line 3348.

Program received signal SIGABRT, Aborted.
0x2816f7e7 in kill () from /lib/libc.so.7
(gdb) bt
#0  0x2816f7e7 in kill () from /lib/libc.so.7
#1  0x2816f746 in raise () from /lib/libc.so.7
#2  0x2816e4d4 in abort () from /lib/libc.so.7
#3  0x281553f6 in __assert () from /lib/libc.so.7
#4  0x280f512e in malloc_usable_size () from /lib/libc.so.7
#5  0x280f8b26 in malloc () from /lib/libc.so.7
#6  0x0804861d in initialize_signames () at mksignames.c:112
#7  0x08048a98 in main (argc=1, argv=0xbfbfea24) at mksignames.c:414
(gdb) frame 6
#6  0x0804861d in initialize_signames () at mksignames.c:112
112  signal_names[rtmax-i] = (char *)malloc(RTLEN);
(gdb) print sizeof(signal_names)/sizeof(signal_names[0])
$1 = 67
(gdb) print rtmax-i
$2 = 124
--

Obviously the array is accessed out of bounds.

Size of signal_names is 2*NSIG+3, and given that NSIG (sys/signal.h)
is 32, that is really not enough for signals up to SIGRTMAX (126).

The easiest way to fix it is to add -DUNUSABLE_RT_SIGNALS to compiler
flags. This way it'll ignore realtime signals and only list standart
32 ones.

--
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@...  ..:  jabber: amdmi3@...    http://www.amdmi3.ru
_______________________________________________
freebsd-ports@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe@..."