[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    bash 2.05b: missing ifdefs in execute_cmd.c
From:       "Michael Zwettler" <michael.zwettler () gmx ! at>
Date:       2003-10-20 18:49:56
Message-ID: 8213.1066675796 () www44 ! gmx ! net
[Download RAW message or body]

Hi,

bash 2.05b doesn't compile when configured with
--enable-minimal-config:

execute_cmd.c: In function `executing_line_number':
execute_cmd.c:290: union has no member named `Cond'
execute_cmd.c:292: union has no member named `Arith'
execute_cmd.c:294: union has no member named `ArithFor'
make: *** [execute_cmd.o] Error 1


In the function executing_line_number() the COMMAND union
members Cond, Arith and ArithFor are accessed without
checking the configuration:


/* Return the line number of the currently executing command. */
int
executing_line_number ()
{
  if (executing && (variable_context == 0 || interactive_shell == 0) &&
currently_executing_command)
    {
      if (currently_executing_command->type == cm_simple)
        return currently_executing_command->value.Simple->line;
      else if (currently_executing_command->type == cm_cond)
        return currently_executing_command->value.Cond->line;
      else if (currently_executing_command->type == cm_arith)
        return currently_executing_command->value.Arith->line;
      else if (currently_executing_command->type == cm_arith_for)
        return currently_executing_command->value.ArithFor->line;
      else
        return line_number;
    }
  else if (running_trap)
    return trap_line_number;
  else
    return line_number;
}


I added the following missing #ifdefs, now it compiles (and works)
fine:


/* Return the line number of the currently executing command. */
int
executing_line_number ()
{
  if (executing && (variable_context == 0 || interactive_shell == 0) &&
currently_executing_command)
    {
      if (currently_executing_command->type == cm_simple)
        return currently_executing_command->value.Simple->line;
#if defined (COND_COMMAND)
      else if (currently_executing_command->type == cm_cond)
        return currently_executing_command->value.Cond->line;
#endif
#if defined (DPAREN_ARITHMETIC)
      else if (currently_executing_command->type == cm_arith)
        return currently_executing_command->value.Arith->line;
#endif
#if defined (ARITH_FOR_COMMAND)
      else if (currently_executing_command->type == cm_arith_for)
        return currently_executing_command->value.ArithFor->line;
#endif
      else
        return line_number;
    }
  else if (running_trap)
    return trap_line_number;
  else
    return line_number;
}


Hope this helps,
Michael Zwettler


-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic