bug-bash
[Top][All Lists]
Advanced

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

Bash 2.05 portability problems found by IRIX compiler


From: Paul Eggert
Subject: Bash 2.05 portability problems found by IRIX compiler
Date: Thu, 3 May 2001 17:50:36 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.7
Compiler: cc -xarch=v9
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' 
-DCONF_OSTYPE='solaris2.7' -DCONF_MACHTYPE='sparc-sun-solaris2.7' 
-DCONF_VENDOR='sun' -DSHELL  -DHAVE_CONFIG_H  -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I.  -I.. -I../include -I../lib 
-I/tmp/prefix/include -g
uname output: SunOS sic.twinsun.com 5.7 Generic_106541-15 sun4u sparc 
SUNW,UltraSPARC-IIi-Engine
Machine Type: sparc-sun-solaris2.7

Bash Version: 2.05
Patch Level: 0
Release Status: release

Description:
        Tim Mooney sensed that I was a man on a mission, and emailed me
        the output of the famously noisy IRIX compiler on Bash 2.05.
        Some of its messages reflect portability bugs in Bash that
        (as far as I know) nobody has submitted patches for yet.
        Here's a patch.

Repeat-By:

Fix:

This patch assumes the fixes I've already sent in.  The yyerror and
unwind_prot fixes are merely lint removal on my host; the other fixes
merely fix the debugging output of Bash.

2001-05-03  Paul Eggert  <eggert@twinsun.com>

        Fix porting nits caught by IRIX compiler.

        * parse.y (yyerror): Accept an argument, as POSIX requires.
        (parse_string_to_word_list): Pass an arg to yyerror.

        * pcomplete.c (gen_compspec_completions): Cast pointers to
        long, not int, to print them, as that's less likely to lose
        info (e.g. on hosts with 64-bit pointers and 32-bit, a common
        combination).
        * trap.c (run_pending_traps): Likewise.

        * unwind_prot.c (clear_unwind_protects_internal): Just test
        the pointer rather than casting it to int.  This avoids a
        warning on IRIX, and makes the code cleaner anyway.  Remove
        redundant test of unwind_protect_list.

===================================================================
RCS file: parse.y,v
retrieving revision 2.5.0.3
retrieving revision 2.5.0.4
diff -pu -r2.5.0.3 -r2.5.0.4
--- parse.y     2001/05/03 20:13:05     2.5.0.3
+++ parse.y     2001/05/04 00:47:15     2.5.0.4
@@ -3923,7 +3923,8 @@ decode_prompt_string (string)
 /* Report a syntax error, and restart the parser.  Call here for fatal
    errors. */
 int
-yyerror ()
+yyerror (message)
+     char const *message;
 {
   report_syntax_error ((char *)NULL);
   reset_parser ();
@@ -4125,7 +4126,7 @@ parse_string_to_word_list (s, whom)
       if (tok != WORD && tok != ASSIGNMENT_WORD)
        {
          line_number = orig_line_number + line_number - 1;
-         yyerror ();   /* does the right thing */
+         yyerror ((char *) NULL);      /* does the right thing */
          if (wl)
            dispose_words (wl);
          wl = &parse_string_error;
===================================================================
RCS file: pcomplete.c,v
retrieving revision 2.5.0.2
retrieving revision 2.5.0.3
diff -pu -r2.5.0.2 -r2.5.0.3
--- pcomplete.c 2001/05/03 23:39:16     2.5.0.2
+++ pcomplete.c 2001/05/04 00:29:09     2.5.0.3
@@ -1108,11 +1108,11 @@ gen_compspec_completions (cs, cmd, word,
   WORD_LIST *lwords;
 
   debug_printf ("programmable_completions (%s, %s, %d, %d)", cmd, word, start, 
end);
-  debug_printf ("programmable_completions: %s -> 0x%x", cmd, (int)cs);
+  debug_printf ("programmable_completions: %s -> 0x%lx", cmd, (long) cs);
   ret = gen_action_completions (cs, word);
   if (ret && progcomp_debug)
     {
-      debug_printf ("gen_action_completions (0x%x, %s) -->", (int)cs, word);
+      debug_printf ("gen_action_completions (0x%lx, %s) -->", (long) cs, word);
       print_stringlist (ret, "\t");
       rl_on_new_line ();
     }
@@ -1125,7 +1125,8 @@ gen_compspec_completions (cs, cmd, word,
        {
          if (progcomp_debug)
            {
-             debug_printf ("gen_globpat_matches (0x%x, %s) -->", (int)cs, 
word);
+             debug_printf ("gen_globpat_matches (0x%lx, %s) -->",
+                           (long) cs, word);
              print_stringlist (tmatches, "\t");
              rl_on_new_line ();
            }
@@ -1142,7 +1143,8 @@ gen_compspec_completions (cs, cmd, word,
        {
          if (progcomp_debug)
            {
-             debug_printf ("gen_wordlist_matches (0x%x, %s) -->", (int)cs, 
word);
+             debug_printf ("gen_wordlist_matches (0x%lx, %s) -->",
+                           (long) cs, word);
              print_stringlist (tmatches, "\t");
              rl_on_new_line ();
            }
@@ -1184,7 +1186,8 @@ gen_compspec_completions (cs, cmd, word,
        {
          if (progcomp_debug)
            {
-             debug_printf ("gen_shell_function_matches (0x%x, %s, 0x%x, %d, 
%d) -->", (int)cs, word, lwords, nw, cw);
+             debug_printf ("gen_shell_function_matches (0x%lx, %s, 0x%x, %d, 
%d) -->",
+                           (long) cs, word, lwords, nw, cw);
              print_stringlist (tmatches, "\t");
              rl_on_new_line ();
            }
@@ -1200,7 +1203,8 @@ gen_compspec_completions (cs, cmd, word,
        {
          if (progcomp_debug)
            {
-             debug_printf ("gen_command_matches (0x%x, %s, 0x%x, %d, %d) -->", 
(int)cs, word, lwords, nw, cw);
+             debug_printf ("gen_command_matches (0x%lx, %s, 0x%x, %d, %d) -->",
+                           (long) cs, word, lwords, nw, cw);
              print_stringlist (tmatches, "\t");
              rl_on_new_line ();
            }
===================================================================
RCS file: trap.c,v
retrieving revision 2.5.0.1
retrieving revision 2.5.0.2
diff -pu -r2.5.0.1 -r2.5.0.2
--- trap.c      2001/05/01 17:14:41     2.5.0.1
+++ trap.c      2001/05/04 00:29:09     2.5.0.2
@@ -260,8 +260,8 @@ run_pending_traps ()
                 Unless we catch this, the subshell will dump core when
                 trap_list[SIGTERM] == DEFAULT_SIG, because DEFAULT_SIG is
                 usually 0x0. */
-             internal_warning ("run_pending_traps: bad value in trap_list[%d]: 
0x%x",
-                               sig, (int)trap_list[sig]);
+             internal_warning ("run_pending_traps: bad value in trap_list[%d]: 
0x%lx",
+                               sig, (long) trap_list[sig]);
              if (trap_list[sig] == (char *)DEFAULT_SIG)
                {
                  internal_warning ("run_pending_traps: signal handler is 
SIG_DFL, resending %d (%s) to myself", sig, signal_name (sig));
===================================================================
RCS file: unwind_prot.c,v
retrieving revision 2.5.0.2
retrieving revision 2.5.0.3
diff -pu -r2.5.0.2 -r2.5.0.3
--- unwind_prot.c       2001/05/03 19:06:02     2.5.0.2
+++ unwind_prot.c       2001/05/04 00:32:10     2.5.0.3
@@ -156,7 +156,7 @@ run_unwind_protects ()
       (run_unwind_protects_internal, (char *)NULL, (char *)NULL);
 }
 
-/* Erase the unwind-protect list.  If flags is 1, free the elements. */
+/* Erase the unwind-protect list.  If flags is non-zero, free the elements. */
 void
 clear_unwind_protect_list (flags)
      int flags;
@@ -211,10 +211,9 @@ static void
 clear_unwind_protects_internal (flag, ignore)
      char *flag, *ignore;
 {
-  int free_elts = (int)flag;
   UNWIND_ELT *elt;
 
-  if (free_elts != 0 && unwind_protect_list)
+  if (flag)
     {
       while (unwind_protect_list)
        remove_unwind_protect_internal ((char *)NULL, (char *)NULL);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]