From: Ian Beckwith Date: Wed, 9 May 2012 15:57:37 +0000 (+0100) Subject: 040_fix_types: DEP3 header X-Git-Tag: 302-2~5 X-Git-Url: http://erislabs.net/gitweb/?p=ckermit.git;a=commitdiff_plain;h=8011b0ca8e9c5663b610ab9d11fd1c25e3bc421a 040_fix_types: DEP3 header --- diff --git a/debian/patches/040_fix_types.patch b/debian/patches/040_fix_types.patch index 5ad3790..71f7a15 100644 --- a/debian/patches/040_fix_types.patch +++ b/debian/patches/040_fix_types.patch @@ -1,3 +1,101 @@ +Description: fix inconsistent types + C-Kermit 9 on OpenBSD on sparc64 gets a "Bus error" and dumps core when + receiving a file. +. + I compiled with "-g" and determined the location of the error: +. + [37] erb@netra:~/tmp/kermit$ gdb wermit wermit.core + GNU gdb 6.3 + Copyright 2004 Free Software Foundation, Inc. + GDB is free software, covered by the GNU General Public License, and you are + welcome to change it and/or distribute copies of it under certain + conditions. + Type "show copying" to see the conditions. + There is absolutely no warranty for GDB. Type "show warranty" for details. + This GDB was configured as "sparc64-unknown-openbsd4.8"... + Core was generated by `wermit'. + Program terminated with signal 10, Bus error. + Reading symbols from /usr/lib/libcurses.so.11.0...done. + Loaded symbols for /usr/lib/libcurses.so.11.0 + Reading symbols from /usr/lib/libutil.so.11.1...done. + Loaded symbols for /usr/lib/libutil.so.11.1 + Reading symbols from /usr/lib/libm.so.5.2...done. + Loaded symbols for /usr/lib/libm.so.5.2 + Reading symbols from /usr/lib/libc.so.56.0...done. + Loaded symbols for /usr/lib/libc.so.56.0 + Reading symbols from /usr/libexec/ld.so...done. + Loaded symbols for /usr/libexec/ld.so + #0 0x00000000001b15e8 in wart () at ckcpro.c:1510 + 1510 if (dest == DEST_N) + (gdb) bt + #0 0x00000000001b15e8 in wart () at ckcpro.c:1510 + #1 0x00000000001c0f34 in xxproto () at ckcpro.c:3579 + #2 0x00000000001beaac in proto () at ckcpro.c:3141 + #3 0x0000000000105974 in doicp (threadinfo=0x0) at ckcmai.c:2420 + #4 0x000000000038840c in cc_execute (sj_buf=0xb59120, dofunc=0x1057c4 + , failfunc=0x10597c ) at ckusig.c:171 + #5 0x000000000010961c in main (argc=1, argv=0xfffffffffffc7ff8) at + ckcmai.c:3551 + (gdb) quit + [38] erb@netra:~/tmp/kermit$ +. + That line number 1510 in ckcpro.c corresponds to line 1434 of ckcpro.w: +. + 1429 debug(F101,"F winlo 1","",winlo); + 1430 xflg = 0; /* Not screen data */ + 1431 if (!czseen) + 1432 cancel = 0; /* Reset cancellation counter */ + 1433 #ifdef CALIBRATE + 1434 if (dest == DEST_N) + 1435 calibrate = 1; + 1436 #endif /* CALIBRATE */ + 1437 if (!rcvfil(filnam)) { /* Figure out local filename */ + 1438 errpkt((CHAR *)rf_err); /* Trouble */ + 1439 RESUME; +. + And that leads us to the source of the problem. On line 155 of ckcpro.w, + dest is declared as a long: +. + 155 extern long speed, ffc, crc16, calibrate, dest; +. + but on line 1313 of ckcmai.c dest is declared as an int: +. + 1296 int deblog = 0, /* Debug log is open */ + [snip] + 1313 dest = DEST_D, /* Destination for packet + data */ +. + In the process of checking some of the other extern declarations for + consistency, I discovered that lint will report these errors. The lint + output + is below. (I suppose there could also be some inconsistencies hiding behind + #ifdef's -- I didn't investigate things that deeply.) +. + [60] erb@netra:~/tmp/kermit$ lint *.c | grep "declared inconsistently" | + grep -v llib-lc + ckcmai.c:1277: filcnt declared inconsistently (ckcpro.c:85) + ckcmai.c:1017: calibrate declared inconsistently (ckcpro.c:177) + ckucmd.c:309: prevcmd declared inconsistently (ckuus5.c:3103) + ckcmai.c:636: cmdfil declared inconsistently (ckuusy.c:109) + ckcmai.c:1313: dest declared inconsistently (ckcpro.c:177) + ckcmai.c:1015: fsize declared inconsistently (ckcpro.c:1588) + ckcmai.c:1274: ffc declared inconsistently (ckcpro.c:177) + ckudia.c:293: dialcapas declared inconsistently (ckuusx.c:2364) + ckcmai.c:1278: filrej declared inconsistently (ckcpro.c:233) + [61] erb@netra:~/tmp/kermit$ +. + The prevcmd and cmdfil inconsistencies are character array versus character + pointer issues and I don't know whether they're real problems or not. The + rest of the inconsistencies are addressed in the attached patch. +. + The patched kermit no longer crashes when receiving files on + openbsd/sparc64. + I tested that the patched kermit can build and send and receive files on + both openbsd/sparc64 and linux/x86_64 (CentOS 5). +From: Edward Berner +Origin: upstream, via private mail +Last-Update: 2012-05-09 + Index: ckermit/ckcpro.w =================================================================== --- ckermit.orig/ckcpro.w 2012-05-09 05:25:12.000000000 +0100