home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / linux / 16921 < prev    next >
Encoding:
Text File  |  1992-11-17  |  5.7 KB  |  271 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!caen!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!dohm
  3. From: dohm@magnus.acs.ohio-state.edu (Peter J Dohm)
  4. Subject: minicom broken under .98-5
  5. Message-ID: <1992Nov17.062728.28748@magnus.acs.ohio-state.edu>
  6. Summary: text segment problems, plus some...
  7. Keywords: linux
  8. Sender: news@magnus.acs.ohio-state.edu
  9. Nntp-Posting-Host: magnusug.magnus.acs.ohio-state.edu
  10. Organization: The Ohio State University
  11. Date: Tue, 17 Nov 1992 06:27:28 GMT
  12. Lines: 257
  13.  
  14. Hi all....
  15.  
  16. I have discovered that Minicom has broken in numerous ways due to the new
  17. text segment protection.  For one, there was a line in function win_init
  18. in window.c that had:
  19.  
  20. char *gname = "stuff"
  21.  
  22. then later:
  23.  
  24. gname[1]='x';
  25. this seg faulted... (no kidding, right?)
  26.  
  27. it needed to be changed to something like:
  28.  
  29. char *gname;
  30.  
  31. gname=(char *)malloc(2);  (the original string was 2 bytes in length)
  32. strcpy(gname,"whatever");  (take the original string in the declaration and
  33.                             place it here)
  34.  
  35. that was a pretty simple problem to fix... however...
  36. i've now got a lockup condition that I've not been able to correct.
  37. here is the code that it's dying in:
  38.  
  39. (note that it makes it until the case statement some lines below without
  40. a problem)
  41.  
  42. void init_emul(type)
  43. int type;
  44. {
  45.   int x = -1, y = -1;
  46.   char attr;
  47.  
  48.   if (st != NIL_WIN) {
  49.       wclose(st, 1);
  50.       tempst = 0;
  51.       st = NIL_WIN;
  52.   }
  53.  
  54.   if (us != NIL_WIN) {
  55.     x = us->curx; y = us->cury;
  56.     attr = us->attr;
  57.       wclose(us, 0);
  58.   }    
  59.   /* Open a new window. */
  60.   us = wopen(0, 0, 79, 23 + (type == MINIX && LINES > 24),
  61.               BNONE, A_NORMAL, SFG, SBG, 1);
  62.  
  63.   if (x >= 0) {
  64.       wlocate(us, x, y);
  65.       wsetattr(us, attr);
  66.   }
  67.  
  68.   if (type == VT100)
  69.       wresetam(us);
  70.   else
  71.       wsetam(us);
  72.   linewrap = -1;    
  73.  
  74.   us->autocr = 0;
  75.  
  76.   /* See if we have space for a status line */
  77.   if (LINES > (24 + (type == MINIX)) && P_STATLINE[0] == 'e')
  78.       st = wopen(0, 24 + (type == MINIX), 79, 24 + (type == MINIX),
  79.               BNONE, A_REVERSE, WHITE, BLACK, 1);
  80.  
  81.   if (type == MINIX && terminal != MINIX && LINES > 24) {
  82.       x = us->curx;
  83.       y = us->cury;
  84.       wlocate(us, 0, 24);
  85.       wclreol(us);
  86.       wlocate(us, x, y);
  87.   }
  88.  
  89.   terminal = type;
  90.   lines = 24 + ((type == MINIX) && LINES > 24);
  91.   cols = 80;
  92.   
  93.   /* If "keyserv" process is stopped, it will still react to
  94.    * some signals.
  95.    */
  96.   switch(type) {
  97.       case VT100:
  98.           keyserv(KVT100, 0);
  99.           break;
  100.       case MINIX:
  101.           keyserv(KMINIX, 0);
  102.           break;
  103.       case ANSI:
  104.           keyserv(KANSI, 0);
  105.           break;
  106.   }
  107.  
  108.  
  109.  
  110. /* 
  111. following this case statement, if i write something out to the screen,
  112. (via a printf)
  113. it makes it there, readable.  i usually include a sleep(1) after all my
  114. debug statements.. so the following worked:
  115. */
  116.  
  117. #ifdef DEBUG
  118. printf("ok... were're going to try and show the status bar\n");
  119. sleep(1);
  120. #endif
  121.  
  122.  
  123.  
  124.  
  125.   if (st != NIL_WIN) show_status();
  126.  
  127. /*
  128. however we've never made it to here... see below in show_status...
  129. */
  130.  
  131. #ifdef DEBUG
  132.   printf("trying init vt100 - ");
  133.   sleep(1);
  134. #endif
  135.  
  136.   init_vt(); /* in v100.c */
  137.  
  138. #ifdef DEBUG
  139.   printf("successful\n");
  140.   sleep(1);
  141. #endif
  142. }
  143.  
  144. /*
  145.  * Locate the cursor at the correct position in
  146.  * the user screen.
  147.  */
  148. static void ret_csr()
  149. {
  150.   wlocate(us, us->curx, us->cury);
  151.   wflush();
  152. }
  153.  
  154. /*
  155.  * Show baudrate, parity etc.
  156.  */
  157. void mode_status()
  158. {
  159.   wlocate(st, 20, 0);
  160.   wprintf(st, " %-5s %s%s1", P_BAUDRATE, P_BITS, P_PARITY);
  161.   ret_csr();
  162. }
  163.  
  164. /*
  165.  * Show offline or online time.
  166.  * If real dcd is not supported, Online and Offline will be
  167.  * shown in capitals.
  168.  */
  169. void time_status()
  170. {
  171.   wlocate(st, 66, 0);
  172.   if (online < 0)
  173.       wputs(st, P_HASDCD[0] == 'Y' ? " Offline     " : " OFFLINE     ");
  174.   else
  175.       wprintf(st," %s %02ld:%02ld", P_HASDCD[0] == 'Y' ? "Online" : "ONLINE",
  176.           online / 3600, (online / 60) % 60);
  177.           
  178.   ret_csr();
  179. }
  180.  
  181. /*
  182.  * Update the online time.
  183.  */
  184. static void updtime()
  185. {
  186.   static int old_online = 0;
  187.  
  188.   if (old_online == online) return;
  189.   old_online = online;
  190.   if (st != NIL_WIN) {
  191.       time_status();
  192.       ret_csr();
  193.   }
  194.   wflush();
  195. }
  196.  
  197. /*
  198.  * Show the status line 
  199.  */
  200. void show_status()
  201. {
  202.  
  203.  
  204.  
  205. /* here's where the bizzarities start to occur:
  206. if i put the same #ifdef DEBUG statement as before, it *never* gets printed...
  207. the only difference is that now the ip should be pointing to the beginning
  208. of the code to print the string, and the stack should contain a new pointer
  209. for reentry... 
  210. I'm not sure I understand why, but it just doesn't make it into this
  211. function correctly...
  212. can anyone venture a guess WHY?????
  213. the program hangs right at the beginning of this function... never returns.
  214. gone... dead...
  215. */
  216.  
  217.  
  218.  
  219.   wlocate(st, 0, 0);
  220.   wprintf(st, " %7.7sZ for help |           | FDX | Minicom %-9.9s |       | ",
  221.       esc_key(), version);
  222.   mode_status();
  223.   time_status();
  224.   wlocate(st, 59, 0);
  225.   switch(terminal) {
  226.       case VT100:
  227.           wputs(st, "VT100");
  228.           break;
  229.       case MINIX:
  230.           wputs(st, "MINIX");
  231.           break;
  232.       case ANSI:
  233.           wputs(st, "ANSI");
  234.           break;
  235.   }
  236.   ret_csr();
  237. }
  238.  
  239.  
  240. Some quick notes:
  241.  
  242. the flags I tried compiling this with was:
  243.  
  244. -O6 -s -fomit-frame-pointer
  245.  
  246. -O2 -s -fomit-frame-pointer
  247.  
  248. -O -s -fomit-frame-pointer
  249.  
  250. -O -fomit-frame-pointer
  251.  
  252. -fomit-frame-pointer
  253.  
  254. and no optimizing switches
  255.  
  256. NONE worked...
  257.  
  258. I figured it could be an gcc optimizing bug, but i don't thing it is...
  259. (i'd love to be proven wrong, though...)
  260.  
  261. So, if anyone can figure this one out, i'd be really appreciative...
  262. (i don't like to have to go to dos to download ;)
  263.  
  264. Pete
  265. ---
  266. +---------------------------------------------------------------------------+
  267. |  Peter J. Dohm - Comp. Science Major    |    The Ohio State University    |
  268. | ** dohm@magnus.acs.ohio-state.edu **    |   ak541@cleveland.freenet.edu   |
  269. | dohm.1@osu.edu, dohm@cis.ohio-state.edu |     dohm@cis.ohio-state.edu     |
  270. +---------------------------------------------------------------------------+
  271.