[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#656659: info not showing anything with certain build flags



On Wed, Apr 18, 2012 at 10:07:24AM +0300, Sergey Poznyakoff wrote:
> Norbert Preining <preining@logic.at> wrote:
> 
> > 	footnotes.c: In function ‘info_show_footnotes’:
> > 	footnotes.c:258:11: error: format not a string literal and no format arguments [-Werror=format-security]
> > 	footnotes.c:262:11: error: format not a string literal and no
> > 	format arguments [-Werror=format-security]
> 
> It is intended (see the comment in info.c:692-695, for the reason of
> it). I'll see if this can be rewritten some other way to pacify gcc, but
> for the time being you'll have to drop that `-Werror' option.

Indeed it can be written in another way:

   info_error("%s", msg_no_foot_node);

and similarly for the next case.  Then you won't have an empty format
argument list.  The same applies to the cases in infodoc.c, infomap.c
(line 942) and session.c (lots of cases, including line 1295).

A diff against the latest CVS version of the info directory is
attached.

   Julian
Index: footnotes.c
===================================================================
RCS file: /sources/texinfo/texinfo/info/footnotes.c,v
retrieving revision 1.13
diff -u -b -B -r1.13 footnotes.c
--- footnotes.c	12 Apr 2012 10:38:28 -0000	1.13
+++ footnotes.c	18 Apr 2012 17:20:13 -0000
@@ -255,11 +255,11 @@
       switch (result)
         {
         case FN_UNFOUND:
-          info_error (msg_no_foot_node);
+          info_error ("%s", msg_no_foot_node);
           break;
 
         case FN_UNABLE:
-          info_error (msg_win_too_small);
+          info_error ("%s", msg_win_too_small);
           break;
         }
     }
Index: infodoc.c
===================================================================
RCS file: /sources/texinfo/texinfo/info/infodoc.c,v
retrieving revision 1.31
diff -u -b -B -r1.31 infodoc.c
--- infodoc.c	12 Apr 2012 10:38:29 -0000	1.31
+++ infodoc.c	18 Apr 2012 17:20:13 -0000
@@ -478,7 +478,7 @@
     }
   else
     {
-      info_error (msg_cant_make_help);
+      info_error ("%s", msg_cant_make_help);
     }
 }
 
@@ -520,7 +520,7 @@
   if (!node)
     {
       if (info_recent_file_error)
-        info_error (info_recent_file_error);
+        info_error ("%s", info_recent_file_error);
       else
         info_error (msg_cant_file_node, "Info", nodename);
     }
Index: infomap.c
===================================================================
RCS file: /sources/texinfo/texinfo/info/infomap.c,v
retrieving revision 1.24
diff -u -b -B -r1.24 infomap.c
--- infomap.c	17 Nov 2011 10:04:59 -0000	1.24
+++ infomap.c	18 Apr 2012 17:20:13 -0000
@@ -939,7 +939,7 @@
         {
                 if (filename && errno != ENOENT)
                 {
-                        info_error(filesys_error_string(filename, errno));
+                        info_error("%s", filesys_error_string(filename, errno));
                         free(filename);
                 }
                 return 0;
@@ -1169,7 +1169,7 @@
                 }
         }
         if (state != getseq)
-                info_error(_("Bad data in infokey file -- some key bindings ignored"));
+                info_error("%s", _("Bad data in infokey file -- some key bindings ignored"));
         return !stop;
 }
 
@@ -1218,7 +1218,7 @@
               }
           }
       if (state != getvar)
-        info_error(_("Bad data in infokey file -- some var settings ignored"));
+        info_error("%s", _("Bad data in infokey file -- some var settings ignored"));
 }
 
 void
Index: session.c
===================================================================
RCS file: /sources/texinfo/texinfo/info/session.c,v
retrieving revision 1.54
diff -u -b -B -r1.54 session.c
--- session.c	12 Apr 2012 10:38:30 -0000	1.54
+++ session.c	18 Apr 2012 17:20:14 -0000
@@ -115,7 +115,7 @@
           if (!largest)
             {
               display_update_display (windows);
-              info_error (msg_cant_find_window);
+              info_error ("%s", msg_cant_find_window);
               info_session ();
               xexit (0);
             }
@@ -130,7 +130,7 @@
           else
             {
               display_update_display (windows);
-              info_error (msg_win_too_small);
+              info_error ("%s", msg_win_too_small);
               info_session ();
               xexit (0);
             }
@@ -597,7 +597,7 @@
 {
   if (old == -1)
     {
-      info_error (msg_cant_find_point);
+      info_error ("%s", msg_cant_find_point);
     }
   else
     {
@@ -1145,7 +1145,7 @@
   switch (behaviour)
     {
     case IS_PageOnly:
-      info_error (msg_at_node_bottom);
+      info_error ("%s", msg_at_node_bottom);
       return 1;
 
     case IS_NextOnly:
@@ -1168,7 +1168,7 @@
 	    switch (scroll_last_node)
 	      {
 	      case SLN_Stop:
-		info_error (_("No more nodes within this document."));
+		info_error ("%s", _("No more nodes within this document."));
 		return 1;
 		
 	      case SLN_Scroll:
@@ -1292,7 +1292,7 @@
                   window->point = info_win->points[old_current];
                   recalculate_line_starts (window);
                   window->flags |= W_UpdateWindow;
-                  info_error (_("No more nodes within this document."));
+                  info_error ("%s", _("No more nodes within this document."));
                   return 1;
                 }
             }
@@ -1310,14 +1310,14 @@
   switch (behaviour)
     {
     case IS_PageOnly:
-      info_error (msg_at_node_top);
+      info_error ("%s", msg_at_node_top);
       return 1;
 
     case IS_NextOnly:
       info_prev_label_of_node (window->node);
       if (!info_parsed_nodename && !info_parsed_filename)
         {
-          info_error (_("No `Prev' for this node."));
+          info_error ("%s", _("No `Prev' for this node."));
           return 1;
         }
       else
@@ -1336,7 +1336,7 @@
           if (!info_parsed_nodename && (!info_parsed_filename
                                         || is_dir_name (info_parsed_filename)))
             {
-              info_error (
+              info_error ("%s", 
                     _("No `Prev' or `Up' for this node within this document."));
               return 1;
             }
@@ -1695,7 +1695,7 @@
   /* If no other window, error now. */
   if (!windows->next && !echo_area_is_active)
     {
-      info_error (msg_one_window);
+      info_error ("%s", msg_one_window);
       return;
     }
 
@@ -1735,7 +1735,7 @@
 
   if (!windows->next && !echo_area_is_active)
     {
-      info_error (msg_one_window);
+      info_error ("%s", msg_one_window);
       return;
     }
 
@@ -1791,7 +1791,7 @@
 
   if (!split)
     {
-      info_error (msg_win_too_small);
+      info_error ("%s", msg_win_too_small);
     }
   else
     {
@@ -1860,11 +1860,11 @@
 {
   if (!windows->next)
     {
-      info_error (msg_cant_kill_last);
+      info_error ("%s", msg_cant_kill_last);
     }
   else if (window->flags & W_WindowIsPerm)
     {
-      info_error (_("Cannot delete a permanent window"));
+      info_error ("%s", _("Cannot delete a permanent window"));
     }
   else
     {
@@ -1949,7 +1949,7 @@
   /* If only one window, give up. */
   if (!windows->next)
     {
-      info_error (msg_one_window);
+      info_error ("%s", msg_one_window);
       return;
     }
 
@@ -2077,7 +2077,7 @@
   if (!node)
     {
       if (file_system_error)
-        info_error (file_system_error);
+        info_error ("%s", file_system_error);
       else
         info_error (msg_cant_find_node, nodename);
     }
@@ -2153,7 +2153,7 @@
       else
         {
           if (info_recent_file_error)
-            info_error (info_recent_file_error);
+            info_error ("%s", info_recent_file_error);
           else
             info_error (msg_cant_file_node, filename, nodename);
         }
@@ -2220,7 +2220,7 @@
     }
 
   if (!node)
-    info_error (_("This window has no additional nodes"));
+    info_error ("%s", _("This window has no additional nodes"));
   else
     info_set_node_of_window (1, window, node);
 }
@@ -2254,7 +2254,7 @@
     }
 
   if (!node)
-    info_error (_("This window has no additional nodes"));
+    info_error ("%s", _("This window has no additional nodes"));
   else
     info_set_node_of_window (1, window, node);
 }
@@ -2276,7 +2276,7 @@
 
   if (!menu)
     {
-      info_error (msg_no_menu_node);
+      info_error ("%s", msg_no_menu_node);
       return;
     }
 
@@ -2391,9 +2391,9 @@
   if (!menu)
     {
       if (builder == info_menu_of_node)
-        info_error (msg_no_menu_node);
+        info_error ("%s", msg_no_menu_node);
       else
-        info_error (msg_no_xref_node);
+        info_error ("%s", msg_no_xref_node);
       return;
     }
 
@@ -2669,7 +2669,7 @@
       window->flags |= W_UpdateWindow;
     }
   else
-    info_error (msg_no_menu_node);
+    info_error ("%s", msg_no_menu_node);
 }
 
 /* Visit as many menu items as is possible, each in a separate window. */
@@ -2682,7 +2682,7 @@
   menu = info_menu_of_node (window->node);
 
   if (!menu)
-    info_error (msg_no_menu_node);
+    info_error ("%s", msg_no_menu_node);
 
   for (i = 0; (!info_error_was_printed) && (entry = menu[i]); i++)
     {
@@ -2692,7 +2692,7 @@
       window_tile_windows (TILE_INTERNALS);
 
       if (!new)
-        info_error (msg_win_too_small);
+        info_error ("%s", msg_win_too_small);
       else
         {
           active_window = new;
@@ -3313,7 +3313,7 @@
   /* If there are no more nodes left anywhere to view, complain and exit. */
   if (info_windows_index == 1 && info_windows[0]->nodes_index == 1)
     {
-      info_error (_("Cannot kill the last node"));
+      info_error ("%s", _("Cannot kill the last node"));
       return;
     }
 
@@ -3432,7 +3432,7 @@
       if (!node)
         {
           if (info_recent_file_error)
-            info_error (info_recent_file_error);
+            info_error ("%s", info_recent_file_error);
           else
             info_error (_("Cannot find `%s'."), line);
         }
@@ -3490,7 +3490,7 @@
     fclose (output_stream);
 
 #if defined (VERBOSE_NODE_DUMPING)
-  info_error (_("Done."));
+  info_error ("%s", _("Done."));
 #endif /* VERBOSE_NODE_DUMPING */
 }
 
@@ -3520,7 +3520,7 @@
   if (!node)
     {
       if (info_recent_file_error)
-        info_error (info_recent_file_error);
+        info_error ("%s", info_recent_file_error);
       else
         {
           if (filename && *nodename != '(')
@@ -3611,7 +3611,7 @@
     fclose (output_stream);
 
 #if defined (VERBOSE_NODE_DUMPING)
-  info_error (_("Done."));
+  info_error ("%s", _("Done."));
 #endif /* VERBOSE_NODE_DUMPING */
 }
 
@@ -3671,7 +3671,7 @@
     fclose (printer_pipe);
 
 #if defined (VERBOSE_NODE_DUMPING)
-  info_error (_("Done."));
+  info_error ("%s", _("Done."));
 #endif /* VERBOSE_NODE_DUMPING */
 }
 
@@ -3994,7 +3994,7 @@
               if (!echo_area_is_active)
                 {
                   if (info_recent_file_error)
-                    info_error (info_recent_file_error);
+                    info_error ("%s", info_recent_file_error);
                   else
                     info_error (msg_cant_file_node,
                                 filename_non_directory (file_buffer->filename),
@@ -4124,7 +4124,7 @@
 
   if (mbslen (search_string) < min_search_length)
     {
-      info_error (_("Search string too short"));
+      info_error ("%s", _("Search string too short"));
       return;
     }
 
@@ -4145,7 +4145,7 @@
 				   NULL);
 
   if (result != 0 && !info_error_was_printed)
-    info_error (_("Search failed."));
+    info_error ("%s", _("Search failed."));
   else if (old_pagetop != active_window->pagetop)
     {
       int new_pagetop;
@@ -4166,7 +4166,7 @@
                       _("Repeat last search in the same direction"))
 {
   if (!last_search_direction)
-    info_error (_("No previous search string"));
+    info_error ("%s", _("No previous search string"));
   else
     info_search_1 (window, last_search_direction * count,
                    key, last_search_case_sensitive, 0);
@@ -4176,7 +4176,7 @@
                       _("Repeat last search in the reverse direction"))
 {
   if (!last_search_direction)
-    info_error (_("No previous search string"));
+    info_error ("%s", _("No previous search string"));
   else
     info_search_1 (window, -last_search_direction * count,
                    key, last_search_case_sensitive, 0);
@@ -4719,7 +4719,7 @@
   if (firstmenu == -1 && firstxref == -1)
     {
       if (!cursor_movement_scrolls_p)
-        info_error (msg_no_xref_node);
+        info_error ("%s", msg_no_xref_node);
       return cursor_movement_scrolls_p;
     }
 
@@ -4862,7 +4862,7 @@
      do it. */
   if (!info_error_rings_bell_p)
     terminal_ring_bell ();
-  info_error (_("Quit"));
+  info_error ("%s", _("Quit"));
 
   info_initialize_numeric_arg ();
   info_clear_pending_input ();

Reply to: