Bug 77571 - bad source code
bad source code
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: texinfo (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-11-09 07:55 EST by d.binderman
Modified: 2007-04-18 12:48 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-10 11:16:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2002-11-09 07:55:43 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk  (Win98; I)

Description of problem:

Hello there,

I just tried to compile package texinfo-4.2-5 from Redhat 8.0

Here are some of the compiler messages

display.c:139: warning: `rep' might be used uninitialized in this function
echo-area.c:127: warning: `pagetop' might be used uninitialized in this function
echo-area.c:127: warning: `start' might be used uninitialized in this function
echo-area.c:127: warning: `end' might be used uninitialized in this function
echo-area.c:127: warning: `amount' might be used uninitialized in this function
info-utils.c:389: warning: `whitespace_loc' might be used uninitialized in this function
info.c:476: warning: control reaches end of non-void function
infomap.c:1553: warning: `seq' might be used uninitialized in this function
infomap.c:1554: warning: `seqlen' might be used uninitialized in this function
session.c:203: warning: `lk' might be used uninitialized in this function
session.c:1460: warning: `last' might be used uninitialized in this function
session.c:2615: warning: `node' might be used uninitialized in this function
session.c:2728: warning: `entry' might be used uninitialized in this function
session.c:3439: warning: `offset' might be used uninitialized in this function
session.c:3508: warning: `current_tag' might be used uninitialized in this function
signals.c:123: warning: `old_signal_handler' might be used uninitialized in this function
window.c:234: warning: `lastwin' might be used uninitialized in this function
window.c:1075: warning: `check' might be used uninitialized in this function
infokey.c:237: warning: control reaches end of non-void function
infokey.c:383: warning: `c' might be used uninitialized in this function
infokey.c:415: warning: `seqstate' might be used uninitialized in this function
infokey.c:417: warning: `ocnt' might be used uninitialized in this function
infokey.c:425: warning: `oval' might be used uninitialized in this function
infokey.c:427: warning: `clen' might be used uninitialized in this function
infokey.c:429: warning: `slen' might be used uninitialized in this function
infokey.c:431: warning: `alen' might be used uninitialized in this function
infokey.c:433: warning: `varlen' might be used uninitialized in this function
infokey.c:435: warning: `vallen' might be used uninitialized in this function
makedoc.c:233: warning: control reaches end of non-void function
cmds.c:743: warning: `delimiter' might be used uninitialized in this function
defun.c:326: warning: `type_name' might be used uninitialized in this function
defun.c:326: warning: `type_name2' might be used uninitialized in this function
macro.c:462: warning: `last_end' might be used uninitialized in this function
toc.c:62: warning: `s' might be used uninitialized in this function
toc.c:322: warning: `toc_file' might be used uninitialized in this function
xml.c:1192: warning:control reaches end of non-void function
xml.c:1162: warning: `secondary' might be used uninitialized in this function
install-info.c:1368: warning: control reaches end of non-void function

Here is a set of patchs which fixes these problems.

*** ./info/display.c.old	2002-11-05 10:37:06.000000000 +0000
--- ./info/display.c	2002-11-05 10:37:17.000000000 +0000
***************
*** 136,142 ****
  
    for (; nodetext < last_node_char; nodetext++)
      {
!       char *rep, *rep_carried_over, rep_temp[2];
        int replen;
  
        if (isprint (*nodetext))
--- 136,142 ----
  
    for (; nodetext < last_node_char; nodetext++)
      {
!       char *rep = 0, *rep_carried_over, rep_temp[2];
        int replen;
  
        if (isprint (*nodetext))
*** ./info/echo-area.c.old	2002-11-05 10:37:37.000000000 +0000
--- ./info/echo-area.c	2002-11-05 10:38:03.000000000 +0000
***************
*** 124,130 ****
            !echo_area_stack_contains_completions_p ())
          {
            WINDOW *next;
!           int pagetop, start, end, amount;
  
            next = compwin->next;
            if (next)
--- 124,130 ----
            !echo_area_stack_contains_completions_p ())
          {
            WINDOW *next;
!           int pagetop = 0, start = 0, end = 0, amount = 0;
  
            next = compwin->next;
            if (next)
*** ./info/info.c.old	2002-11-05 10:39:11.000000000 +0000
--- ./info/info.c	2002-11-05 10:39:34.000000000 +0000
***************
*** 473,478 ****
--- 473,480 ----
  
      xexit (0);
    }
+ 
+   return 0;
  }
  
  void
*** ./info/infokey.c.old	2002-11-05 10:46:45.000000000 +0000
--- ./info/infokey.c	2002-11-05 10:49:45.000000000 +0000
***************
*** 234,239 ****
--- 234,240 ----
    }
  
    xexit (0);
+   return 0; 
  }
  
  static char *
***************
*** 380,386 ****
    int error = 0;
    char rescan = 0;
    unsigned int lnum = 0;
!   int c;
  
    /* This parser is a true state machine, with no sneaky fetching
       of input characters inside the main loop.  In other words, all
--- 381,387 ----
    int error = 0;
    char rescan = 0;
    unsigned int lnum = 0;
!   int c = 0;
  
    /* This parser is a true state machine, with no sneaky fetching
       of input characters inside the main loop.  In other words, all
***************
*** 412,420 ****
        octal,
        special_key
      }
!   seqstate;			/* used if state == get_keyseq */
    char meta = 0;
!   char ocnt;			/* used if state == get_keyseq && seqstate == octal */
  
    /* Data is accumulated in the following variables.  The code
       avoids overflowing these strings, and throws an error
--- 413,421 ----
        octal,
        special_key
      }
!   seqstate = normal;			/* used if state == get_keyseq */
    char meta = 0;
!   char ocnt = 0;			/* used if state == get_keyseq && seqstate == octal */
  
    /* Data is accumulated in the following variables.  The code
       avoids overflowing these strings, andthrows an error
***************
*** 422,438 ****
       lengths are arbitrary (and should be large enough) and their
       lengths are not hard-coded anywhere else, so increasing them
       here will not break anything.  */
!   char oval;
    char comment[10];
!   unsigned int clen;
    char seq[20];
!   unsigned int slen;
    char act[80];
!   unsigned int alen;
    char varn[80];
!   unsigned int varlen;
    char val[80];
!   unsigned int vallen;
  
  #define	To_seq(c) \
  		  do { \
--- 423,439 ----
       lengths are arbitrary (and should be large enough) and their
       lengths are not hard-coded anywhere else, so increasing them
       here will not break anything.  */
!   char oval = 0;
    char comment[10];
!   unsigned int clen = 0;
    char seq[20];
!   unsigned int slen = 0;
    char act[80];
!   unsigned int alen = 0;
    char varn[80];
!   unsigned int varlen = 0;
    char val[80];
!   unsigned int vallen = 0;
  
  #define	To_seq(c) \
  		  do { \
*** ./info/infomap.c.old	2002-11-05 10:41:34.000000000 +0000
--- ./info/infomap.c	2002-11-05 10:41:50.000000000 +0000
***************
*** 1550,1557 ****
  {
  	int stop;
  	unsigned char *p;
! 	unsigned char *seq;
! 	unsigned int seqlen;
  	KEYMAP_ENTRY ke;
  	enum { getseq, gotseq, getaction } state = getseq;
  
--- 1550,1557 ----
  {
  	int stop;
  	unsigned char *p;
! 	unsigned char *seq = 0;
! 	unsigned int seqlen = 0;
  	KEYMAP_ENTRY ke;
  	enum { getseq, gotseq, getaction } state = getseq;
  
*** ./info/info-utils.c.old	2002-11-05 10:38:29.000000000 +0000
--- ./info/info-utils.c	2002-11-05 10:38:45.000000000 +0000
***************
*** 386,392 ****
       char *string;
  {
    register int i, j;
!   int len, whitespace_found, whitespace_loc;
    char *temp;
  
    if (!string)
--- 386,392 ----
       char *string;
  {
    register int i, j;
!   int len, whitespace_found, whitespace_loc = 0;
    char *temp;
  
    if (!string)
*** ./info/makedoc.c.old	2002-11-05 10:50:11.000000000 +0000
--- ./info/makedoc.c	2002-11-05 10:50:23.000000000 +0000
***************
*** 230,235 ****
--- 230,237 ----
    if (tags_only)
      maybe_dump_tags (stdout);
    xexit (0);
+ 
+   return 0;
  }
  
  /* Dumping out the contents of an Emacs tags table. */
*** ./info/session.c.old	2002-11-05 10:42:10.000000000 +0000
--- ./info/session.c	2002-11-05 10:44:13.000000000 +0000
***************
*** 200,206 ****
  
    while (!done && !quit_info_immediately)
      {
!       int lk;
  
        /* If we haven't just gone up or down a line, there is no
           goal column for this window. */
--- 200,206 ----
  
    while (!done && !quit_info_immediately)
      {
!       int lk = 0;
  
        /* If we haven't just gone up or down a line, there is no
           goal column for this window. */
***************
*** 1457,1463 ****
        if (window == the_echo_area ||
            (window == windows && !echo_area_is_active))
          {
!           register WINDOW *win, *last;
  
            for (win = windows; win; win = win->next)
              last = win;
--- 1457,1463 ----
        if (window == the_echo_area ||
            (window == windows && !echo_area_is_active))
          {
!           register WINDOW *win, *last = 0;
  
            for (win = windows; win; win = win->next)
              last = win;
***************
*** 2612,2618 ****
        char *errstr, *errarg1, *errarg2;
        NODE *dir_node = info_get_node (NULL, NULL);
        char **nodes = split_list_of_nodenames (line);
!       NODE *node;
  
        /* If DIR_NODE is NULL, they might be reading a file directly,
  	 like in "info -d . -f ./foo".  Try using "Top" instead.  */
--- 2612,2618 ----
        char *errstr, *errarg1, *errarg2;
        NODE *dir_node = info_get_node (NULL, NULL);
        char **nodes = split_list_of_nodenames (line);
!       NODE *node = 0;
  
        /* If DIR_NODE is NULL, they might be reading a file directly,
  	 like in "info -d . -f ./foo".  Try using "Top" instead.  */
***************
*** 2725,2731 ****
       in the menu hierarchy...  */
    for (node = initial_node; node; initial_node = node)
      {
!       REFERENCE *entry;
  
        /* Build and return a list of the menu items in this node. */
        menu = info_menu_of_node (initial_node);
--- 2725,2731 ----
       in the menu hierarchy...  */
    for (node = initial_node; node; initial_node = node)
      {
!       REFERENCE *entry = 0;
  
        /* Build and return a list of the menu items in this node. */
        menu = info_menu_of_node (initial_node);
***************
*** 3436,3442 ****
       long start;
  {
    register int i;
!   long offset;
    char *target;
  
    target = xstrdup (string);
--- 3436,3442 ----
       long start;
  {
    register int i;
!   long offset = 0;
    char *target;
  
    target = xstrdup (string);
***************
*** 3505,3511 ****
       file's node list. */
    if (file_buffer->tags)
      {
!       register int current_tag, number_of_tags;
        char *last_subfile;
        TAG *tag;
  
--- 3505,3511 ----
       file's node list. */
    if (file_buffer->tags)
      {
!       register int current_tag = 0, number_of_tags;
        char *last_subfile;
        TAG *tag;
  
*** ./info/signals.c.old	2002-11-05 10:44:53.000000000 +0000
--- ./info/signals.c	2002-11-05 10:45:08.000000000 +0000
***************
*** 120,126 ****
  info_signal_handler (sig)
       int sig;
  {
!   signal_handler **old_signal_handler;
  
    switch (sig)
      {
--- 120,126 ----
  info_signal_handler (sig)
       int sig;
  {
!   signal_handler **old_signal_handler = 0;
  
    switch (sig)
      {
*** ./info/window.c.old	2002-11-05 10:45:33.000000000 +0000
--- ./info/window.c	2002-11-05 10:45:54.000000000 +0000
***************
*** 231,237 ****
            if ((win->height < WINDOW_MIN_HEIGHT) ||
                (win->height > avail))
              {
!               WINDOW *lastwin;
  
      /* Split the space among the available windows. */
                delta_each = avail / numwins;
--- 231,237 ----
            if ((win->height < WINDOW_MIN_HEIGHT) ||
                (win->height > avail))
              {
!               WINDOW *lastwin = 0;
  
                /* Split the space among the available windows. */
                delta_each = avail / numwins;
***************
*** 1072,1078 ****
       char *line;
       int goal;
  {
!   register int i, check, hpos;
  
    for (hpos = 0, i = 0; line[i] != '\n'; i++)
      {
--- 1072,1078 ----
       char *line;
       int goal;
  {
!   register int i, check = 0, hpos;
  
    for (hpos = 0, i = 0; line[i] != '\n'; i++)
      {
*** ./makeinfo/cmds.c.old	2002-11-05 10:50:49.000000000 +0000
--- ./makeinfo/cmds.c	2002-11-05 10:51:34.000000000 +0000
***************
*** 740,746 ****
       int arg;
  {
    int character;
!   int delimiter;
    int seen_end = 0;
  
    in_fixed_width_font++;
--- 740,746 ----
       int arg;
  {
    int character;
!   int delimiter = 0;
    int seen_end = 0;
  
    in_fixed_width_font++;
*** ./makeinfo/defun.c.old	2002-11-05 10:51:52.000000000 +0000
--- ./makeinfo/defun.c	2002-11-05 10:52:21.000000000 +0000
***************
*** 323,329 ****
  {
    enum insertion_type base_type;
    char **defun_args, **scan_args;
!   char *category, *defined_name, *type_name, *type_name2;
  
    {
      char *line;
--- 323,329 ----
  {
    enum insertion_type base_type;
    char **defun_args, **scan_args;
!   char *category, *defined_name, *type_name = 0, *type_name2 = 0;
  
    {
      char *line;
*** ./makeinfo/macro.c.old	2002-11-05 10:52:34.000000000 +0000
--- ./makeinfo/macro.c	2002-11-05 10:53:29.000000000 +0000
***************
*** 459,465 ****
       int recursive;
  {
    int i;
!   char *name, **arglist, *body, *line, *last_end;
    int body_size, body_index;
    int depth = 1;
    int defining_line = line_number;
--- 459,465 ----
       int recursive;
  {
    int i;
!   char *name, **arglist, *body, *line, *last_end = 0;
    int body_size, body_index;
    int depth = 1;
    int defining_line = line_number;
*** ./makeinfo/toc.c.old	2002-11-05 10:53:46.000000000 +0000
--- ./makeinfo/toc.c	2002-11-05 10:54:24.000000000 +0000
***************
*** 59,65 ****
       char *node_name;
       char *anchor;
  {
!   char *tocname_and_node, *expanded_node, *s, *d;
    char *filename = NULL;
  
    if (!node_name)
--- 59,65 ----
       char *node_name;
       char *anchor;
  {
!   char *tocname_and_node, *expanded_node, *s = 0, *d;
    char *filename = NULL;
  
    if (!node_name)
***************
*** 319,325 ****
       FILE *fp;
  {
    int i;
!   char *toc_file;
  
    /* does exist any toc? */
    if (!toc_counter)
--- 319,325 ----
       FILE *fp;
  {
    int i;
!   char *toc_file = 0;
  
    /* does exist any toc? */
    if (!toc_counter)
*** ./makeinfo/xml.c.old	2002-11-05 10:54:41.000000000 +0000
--- ./makeinfo/xml.c	2002-11-05 10:55:19.000000000 +0000
***************
*** 1146,1151 ****
--- 1146,1152 ----
  /* Used to separate primary and secondary entries in an index */
  #define INDEX_SEP ", "
  
+ void
  xml_insert_indexterm (indexterm, index)
      char *indexterm;
      char *index;
***************
*** 1159,1165 ****
    else
      {      
        char *expanded;
!       char *primary = NULL, *secondary;
        xml_sort_index = 1;
        xml_no_para = 1;
        expanded = expansion (indexterm);
--- 1160,1166 ----
    else
      {      
        char *expanded;
!       char *primary = NULL, *secondary = NULL;
        xml_sort_index = 1;
        xml_no_para = 1;
        expanded = expansion (indexterm);
*** ./util/install-info.c.old	2002-11-05 10:55:40.000000000 +0000
--- ./util/install-info.c	2002-11-05 10:55:57.000000000 +0000
***************
*** 1365,1370 ****
--- 1365,1371 ----
                    entries_to_add, input_sections, NULL);
  
    xexit (0);
+   return 0;
  }
  

  /* Divide the text at DATA (of SIZE bytes) into lines.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. compile the package
2.
3.
	

Additional info:
Comment 1 Tim Waugh 2002-11-11 08:12:48 EST
Reported upstream.
Comment 2 Mike A. Harris 2004-01-13 13:10:59 EST
Just a note to bug reporter....   When generating patches with the
diff command, please use "diff -u" to generate a unified diff, as
that format is easiest to apply, and easiest to hack by hand when
the need arises, and is generally the preferred diff format.  Also,
when attaching patches to bug reports, please use bugzilla's file
attachment feature rather than cut and pasting it into the comment
field, as tab characters and other whitespace may get translated,
and usually result in a patch that does not apply anymore, and must
be manually hand edited line by line, which is particularly difficult
with context diffs.

Just some hopefully helpful tips for future patch submissions.

Hope this helps.
Comment 3 Tim Waugh 2004-12-10 11:16:20 EST
These all seem to be fixed now.

Note You need to log in before you can comment on or make changes to this bug.