source: patches/bash-4.0-branch_update-6.patch@ 55439e2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 55439e2 was 8e00734, checked in by Jim Gifford <clfs@…>, 15 years ago

Updated Bash Branch Update Patch

  • Property mode set to 100644
File size: 39.5 KB
  • arrayfunc.c

    Submitted By: Jim Gifford (jim at cross-lfs dot org)
    Date: 07-22-2009
    Initial Package Version: 4.0
    Origin: Upstream
    Upstream Status: Applied
    Description: Contains all upstream patches up to 4.0-028
    
    diff -Naur bash-4.0.orig/arrayfunc.c bash-4.0/arrayfunc.c
    old new  
    604604    }
    605605}
    606606
    607 /* This function assumes s[i] == '['; returns with s[ret] == ']' if
    608    an array subscript is correctly parsed. */
    609 int
    610 skipsubscript (s, i)
    611      const char *s;
    612      int i;
    613 {
    614   int count, c;
    615 #if defined (HANDLE_MULTIBYTE)
    616   mbstate_t state, state_bak;
    617   size_t slength, mblength;
    618 #endif
    619 
    620 #if defined (HANDLE_MULTIBYTE)
    621   memset (&state, '\0', sizeof (mbstate_t));
    622   slength = strlen (s + i);
    623 #endif
    624  
    625   count = 1;
    626   while (count)
    627     {
    628       /* Advance one (possibly multibyte) character in S starting at I. */
    629 #if defined (HANDLE_MULTIBYTE)
    630       if (MB_CUR_MAX > 1)
    631         {
    632           state_bak = state;
    633           mblength = mbrlen (s + i, slength, &state);
    634 
    635           if (MB_INVALIDCH (mblength))
    636             {
    637               state = state_bak;
    638               i++;
    639               slength--;
    640             }
    641           else if (MB_NULLWCH (mblength))
    642             return i;
    643           else
    644             {
    645               i += mblength;
    646               slength -= mblength;
    647             }
    648         }
    649       else
    650 #endif
    651       ++i;
    652 
    653       c = s[i];
    654 
    655       if (c == 0)
    656         break;
    657       else if (c == '[')
    658         count++;
    659       else if (c == ']')
    660         count--;
    661     }
    662 
    663   return i;
    664 }
     607/* skipsubscript moved to subst.c to use private functions. 2009/02/24. */
    665608
    666609/* This function is called with SUB pointing to just after the beginning
    667610   `[' of an array subscript and removes the array element to which SUB
  • builtins/declare.def

    diff -Naur bash-4.0.orig/builtins/declare.def bash-4.0/builtins/declare.def
    old new  
    295295      subscript_start = (char *)NULL;
    296296      if (t = strchr (name, '['))       /* ] */
    297297        {
     298          /* If offset != 0 we have already validated any array reference */
     299          if (offset == 0 && valid_array_reference (name) == 0)
     300            {
     301              sh_invalidid (name);
     302              assign_error++;
     303              NEXT_VARIABLE ();
     304            }
    298305          subscript_start = t;
    299306          *t = '\0';
    300307          making_array_special = 1;
     
    484491            }
    485492          /* declare -a name[[n]] or declare name[n] makes name an indexed
    486493             array variable. */
    487           else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0)
     494          else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0 && assoc_p (var) == 0)
    488495            var = convert_var_to_array (var);
    489496#endif /* ARRAY_VARS */
    490497
  • builtins/exit.def

    diff -Naur bash-4.0.orig/builtins/exit.def bash-4.0/builtins/exit.def
    old new  
    113113      for (i = stopmsg = 0; i < js.j_jobslots; i++)
    114114        if (jobs[i] && STOPPED (i))
    115115          stopmsg = JSTOPPED;
    116         else if (check_jobs_at_exit && stopmsg == 0 && RUNNING (i))
     116        else if (check_jobs_at_exit && stopmsg == 0 && jobs[i] && RUNNING (i))
    117117          stopmsg = JRUNNING;
    118118
    119119      if (stopmsg == JSTOPPED)
  • builtins/fc.def

    diff -Naur bash-4.0.orig/builtins/fc.def bash-4.0/builtins/fc.def
    old new  
    8888extern int current_command_line_count;
    8989extern int literal_history;
    9090extern int posixly_correct;
     91extern int subshell_environment, interactive_shell;
    9192
    9293extern int unlink __P((const char *));
    9394
     
    172173  register int i;
    173174  register char *sep;
    174175  int numbering, reverse, listing, execute;
    175   int histbeg, histend, last_hist, retval, opt;
     176  int histbeg, histend, last_hist, retval, opt, rh;
    176177  FILE *stream;
    177178  REPL *rlist, *rl;
    178179  char *ename, *command, *newcom, *fcedit;
     
    275276
    276277      fprintf (stderr, "%s\n", command);
    277278      fc_replhist (command);    /* replace `fc -s' with command */
     279      /* Posix says that the re-executed commands should be entered into the
     280         history. */
    278281      return (parse_and_execute (command, "fc", SEVAL_NOHIST));
    279282    }
    280283
     
    293296     line was actually added (HISTIGNORE may have caused it to not be),
    294297     so we check hist_last_line_added. */
    295298
    296   last_hist = i - remember_on_history - hist_last_line_added;
     299  /* Even though command substitution through parse_and_execute turns off
     300     remember_on_history, command substitution in a shell when set -o history
     301     has been enabled (interactive or not) should use it in the last_hist
     302     calculation as if it were on. */
     303  rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
     304  last_hist = i - rh - hist_last_line_added;
    297305
    298306  if (list)
    299307    {
     
    456464     char *command;
    457465     HIST_ENTRY **hlist;
    458466{
    459   int sign, n, clen;
     467  int sign, n, clen, rh;
    460468  register int i, j;
    461469  register char *s;
    462470
     
    472480     line was actually added (HISTIGNORE may have caused it to not be),
    473481     so we check hist_last_line_added.  This needs to agree with the
    474482     calculation of last_hist in fc_builtin above. */
    475   i -= remember_on_history + hist_last_line_added;
     483  /* Even though command substitution through parse_and_execute turns off
     484     remember_on_history, command substitution in a shell when set -o history
     485     has been enabled (interactive or not) should use it in the last_hist
     486     calculation as if it were on. */
     487  rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
     488  i -= rh + hist_last_line_added;
    476489
    477490  /* No specification defaults to most recent command. */
    478491  if (command == NULL)
  • builtins/read.def

    diff -Naur bash-4.0.orig/builtins/read.def bash-4.0/builtins/read.def
    old new  
    369369      code = setjmp (alrmbuf);
    370370      if (code)
    371371        {
    372 #if 0
     372          /* Tricky.  The top of the unwind-protect stack is the free of
     373             input_string.  We want to run all the rest and use input_string,
     374             so we have to remove it from the stack. */
     375          remove_unwind_protect ();
    373376          run_unwind_frame ("read_builtin");
    374           return (EXECUTION_FAILURE);
    375 #else
    376377          input_string[i] = '\0';       /* make sure it's terminated */
    377           retval = 128+SIGALRM;;
     378          retval = 128+SIGALRM;
    378379          goto assign_vars;
    379 #endif
    380380        }
    381381      old_alrm = set_signal_handler (SIGALRM, sigalrm);
    382382      add_unwind_protect (reset_alarm, (char *)NULL);
  • doc/bash.1

    diff -Naur bash-4.0.orig/doc/bash.1 bash-4.0/doc/bash.1
    old new  
    82578257Exit after reading and executing one command.
    82588258.TP 8
    82598259.B \-u
    8260 Treat unset variables as an error when performing
     8260Treat unset variables and parameters other than the special
     8261parameters "@" and "*" as an error when performing
    82618262parameter expansion.  If expansion is attempted on an
    8262 unset variable, the shell prints an error message, and,
     8263unset variable or parameter, the shell prints an error message, and,
    82638264if not interactive, exits with a non-zero status.
    82648265.TP 8
    82658266.B \-v
  • doc/bashref.texi

    diff -Naur bash-4.0.orig/doc/bashref.texi bash-4.0/doc/bashref.texi
    old new  
    41384138Exit after reading and executing one command.
    41394139
    41404140@item -u
    4141 Treat unset variables as an error when performing parameter expansion.
     4141Treat unset variables and parameters other than the special parameters
     4142@samp{@@} or @samp{*} as an error when performing parameter expansion.
    41424143An error message will be written to the standard error, and a non-interactive
    41434144shell will exit.
    41444145
  • execute_cmd.c

    diff -Naur bash-4.0.orig/execute_cmd.c bash-4.0/execute_cmd.c
    old new  
    568568
    569569      /* Fork a subshell, turn off the subshell bit, turn off job
    570570         control and call execute_command () on the command again. */
     571      line_number_for_err_trap = line_number;
    571572      paren_pid = make_child (savestring (make_command_string (command)),
    572573                              asynchronous);
    573574      if (paren_pid == 0)
     
    610611              if (user_subshell && was_error_trap && ignore_return == 0 && invert == 0 && exec_result != EXECUTION_SUCCESS)
    611612                {
    612613                  last_command_exit_value = exec_result;
     614                  save_line_number = line_number;
     615                  line_number = line_number_for_err_trap;
    613616                  run_error_trap ();
     617                  line_number = save_line_number;
    614618                }
    615619
    616620              if (user_subshell && ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS)
     
    766770      if (was_error_trap && ignore_return == 0 && invert == 0 && pipe_in == NO_PIPE && pipe_out == NO_PIPE && exec_result != EXECUTION_SUCCESS)
    767771        {
    768772          last_command_exit_value = exec_result;
     773          line_number = line_number_for_err_trap;
    769774          run_error_trap ();
     775          line_number = save_line_number;
    770776        }
    771777
    772778      if (ignore_return == 0 && invert == 0 &&
     
    21052111  REDIRECT *rp;
    21062112  COMMAND *tc, *second;
    21072113  int ignore_return, exec_result, was_error_trap, invert;
     2114  volatile int save_line_number;
    21082115
    21092116  ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0;
    21102117
     
    21742181      invert = (command->flags & CMD_INVERT_RETURN) != 0;
    21752182      ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0;
    21762183
     2184      line_number_for_err_trap = line_number;
    21772185      exec_result = execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close);
    21782186
    21792187      if (was_error_trap && ignore_return == 0 && invert == 0 && exec_result != EXECUTION_SUCCESS)
    21802188        {
    21812189          last_command_exit_value = exec_result;
     2190          save_line_number = line_number;
     2191          line_number = line_number_for_err_trap;
    21822192          run_error_trap ();
     2193          line_number = save_line_number;
    21832194        }
    21842195
    21852196      if (ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS)
     
    29302941                  retval = execute_command (clauses->action);
    29312942                }
    29322943              while ((clauses->flags & CASEPAT_FALLTHROUGH) && (clauses = clauses->next));
    2933               if ((clauses->flags & CASEPAT_TESTNEXT) == 0)
     2944              if (clauses == 0 || (clauses->flags & CASEPAT_TESTNEXT) == 0)
    29342945                EXIT_CASE ();
    29352946              else
    29362947                break;
  • externs.h

    diff -Naur bash-4.0.orig/externs.h bash-4.0/externs.h
    old new  
    192192extern char *fmtumax __P((uintmax_t, int, char *, size_t, int));
    193193
    194194/* Declarations for functions defined in lib/sh/fpurge.c */
     195
     196#if defined NEED_FPURGE_DECL
    195197#if !HAVE_DECL_FPURGE
    196198
    197199#if HAVE_FPURGE
     
    200202extern int fpurge __P((FILE *stream));
    201203
    202204#endif /* HAVE_DECL_FPURGE */
    203 
     205#endif /* NEED_FPURGE_DECL */
    204206
    205207/* Declarations for functions defined in lib/sh/getcwd.c */
    206208#if !defined (HAVE_GETCWD)
  • bash-4.0

    diff -Naur bash-4.0.orig/jobs.c bash-4.0/jobs.c
    old new  
    442442  old_pipeline = the_pipeline;
    443443  the_pipeline = saved_pipeline;
    444444  already_making_children = saved_already_making_children;
    445   if (discard)
     445  if (discard && old_pipeline)
    446446    discard_pipeline (old_pipeline);
    447447}
    448448
     
    42024202  sh_closepipe (pgrp_pipe);
    42034203}
    42044204
     4205void
     4206save_pgrp_pipe (p, clear)
     4207     int *p;
     4208     int clear;
     4209{
     4210  p[0] = pgrp_pipe[0];
     4211  p[1] = pgrp_pipe[1];
     4212  if (clear)
     4213    pgrp_pipe[0] = pgrp_pipe[1] = -1;
     4214}
     4215
     4216void
     4217restore_pgrp_pipe (p)
     4218     int *p;
     4219{
     4220  pgrp_pipe[0] = p[0];
     4221  pgrp_pipe[1] = p[1];
     4222}
     4223
    42054224#endif /* PGRP_PIPE */
  • bash-4.0

    diff -Naur bash-4.0.orig/jobs.h bash-4.0/jobs.h
    old new  
    235235extern void init_job_stats __P((void));
    236236
    237237extern void close_pgrp_pipe __P((void));
     238extern void save_pgrp_pipe __P((int *, int));
     239extern void restore_pgrp_pipe __P((int *));
    238240
    239241#if defined (JOB_CONTROL)
    240242extern int job_control;
  • lib/glob/glob.c

    diff -Naur bash-4.0.orig/lib/glob/glob.c bash-4.0/lib/glob/glob.c
    old new  
    356356        *np = 0;
    357357      if (ep)
    358358        *ep = 0;
    359       if (r)
     359      if (r && r != &glob_error_return)
    360360        free (r);
    361361      return (struct globval *)0;
    362362    }
     
    665665      (void) closedir (d);
    666666    }
    667667
    668   /* compat: if GX_ALLDIRS, add the passed directory also */
     668  /* compat: if GX_ADDCURDIR, add the passed directory also.  Add an empty
     669     directory name as a placeholder if GX_NULLDIR (in which case the passed
     670     directory name is "."). */
    669671  if (add_current)
    670672    {
    671673      sdlen = strlen (dir);
     
    942944              char **array;
    943945              register unsigned int l;
    944946
    945               array = glob_dir_to_array (directories[i], temp_results, flags);
     947              /* If we're expanding **, we don't need to glue the directory
     948                 name to the results; we've already done it in glob_vector */
     949              if ((dflags & GX_ALLDIRS) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0')
     950                array = temp_results;
     951              else
     952                array = glob_dir_to_array (directories[i], temp_results, flags);
    946953              l = 0;
    947954              while (array[l] != NULL)
    948955                ++l;
     
    959966              result[result_size - 1] = NULL;
    960967
    961968              /* Note that the elements of ARRAY are not freed.  */
    962               free ((char *) array);
     969              if (array != temp_results)
     970                free ((char *) array);
    963971            }
    964972        }
    965973      /* Free the directories.  */
     
    10031011
    10041012      /* Just return what glob_vector () returns appended to the
    10051013         directory name. */
     1014      /* If flags & GX_ALLDIRS, we're called recursively */
    10061015      dflags = flags & ~GX_MARKDIRS;
    10071016      if (directory_len == 0)
    10081017        dflags |= GX_NULLDIR;
    10091018      if ((flags & GX_GLOBSTAR) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0')
    1010         dflags |= GX_ALLDIRS|GX_ADDCURDIR;
     1019        {
     1020          dflags |= GX_ALLDIRS|GX_ADDCURDIR;
     1021#if 0
     1022          /* If we want all directories (dflags & GX_ALLDIRS) and we're not
     1023             being called recursively as something like `echo **/*.o'
     1024             ((flags & GX_ALLDIRS) == 0), we want to prevent glob_vector from
     1025             adding a null directory name to the front of the temp_results
     1026             array.  We turn off ADDCURDIR if not called recursively and
     1027             dlen == 0 */
     1028#endif
     1029          if (directory_len == 0 && (flags & GX_ALLDIRS) == 0)
     1030            dflags &= ~GX_ADDCURDIR;
     1031        }
    10111032      temp_results = glob_vector (filename,
    10121033                                  (directory_len == 0 ? "." : directory_name),
    10131034                                  dflags);
  • lib/readline/display.c

    diff -Naur bash-4.0.orig/lib/readline/display.c bash-4.0/lib/readline/display.c
    old new  
    512512  /* Block keyboard interrupts because this function manipulates global
    513513     data structures. */
    514514  _rl_block_sigint (); 
     515  RL_SETSTATE (RL_STATE_REDISPLAYING);
    515516
    516517  if (!rl_display_prompt)
    517518    rl_display_prompt = "";
     
    11881189      if (t < out)
    11891190        line[t - 1] = '>';
    11901191
    1191       if (!rl_display_fixed || forced_display || lmargin != last_lmargin)
     1192      if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin)
    11921193        {
    11931194          forced_display = 0;
     1195          o_cpos = _rl_last_c_pos;
     1196          cpos_adjusted = 0;
    11941197          update_line (&visible_line[last_lmargin],
    11951198                       &invisible_line[lmargin],
    11961199                       0,
     
    11981201                       _rl_screenwidth + (lmargin ? 0 : wrap_offset),
    11991202                       0);
    12001203
     1204          if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
     1205              cpos_adjusted == 0 &&
     1206              _rl_last_c_pos != o_cpos &&
     1207              _rl_last_c_pos > wrap_offset &&
     1208              o_cpos < prompt_last_invisible)
     1209                _rl_last_c_pos -= prompt_invis_chars_first_line;        /* XXX - was wrap_offset */
     1210
    12011211          /* If the visible new line is shorter than the old, but the number
    12021212             of invisible characters is greater, and we are at the end of
    12031213             the new line, we need to clear to eol. */
     
    12361246      visible_wrap_offset = wrap_offset;
    12371247  }
    12381248
     1249  RL_UNSETSTATE (RL_STATE_REDISPLAYING);
    12391250  _rl_release_sigint ();
    12401251}
    12411252
     
    17721783             space_to_eol will insert too many spaces.  XXX - maybe we should
    17731784             adjust col_lendiff based on the difference between _rl_last_c_pos
    17741785             and _rl_screenwidth */
    1775           if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth))
     1786          if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
    17761787#endif
    17771788            {     
    17781789              if (_rl_term_autowrap && current_line < inv_botlin)
     
    18921903
    18931904  woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
    18941905  cpos = _rl_last_c_pos;
     1906
     1907  if (cpos == 0 && cpos == new)
     1908    return;
     1909
    18951910#if defined (HANDLE_MULTIBYTE)
    18961911  /* If we have multibyte characters, NEW is indexed by the buffer point in
    18971912     a multibyte string, but _rl_last_c_pos is the display position.  In
     
    19051920         prompt string, since they're both buffer indices and DPOS is a
    19061921         desired display position. */
    19071922      if ((new > prompt_last_invisible) ||              /* XXX - don't use woff here */
    1908           (prompt_physical_chars > _rl_screenwidth &&
     1923          (prompt_physical_chars >= _rl_screenwidth &&
    19091924           _rl_last_v_pos == prompt_last_screen_line &&
    1910            wrap_offset >= woff &&
     1925           wrap_offset >= woff && dpos >= woff &&
    19111926           new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
    19121927           /* XXX last comparison might need to be >= */
    19131928        {
  • lib/readline/readline.h

    diff -Naur bash-4.0.orig/lib/readline/readline.h bash-4.0/lib/readline/readline.h
    old new  
    814814#define RL_STATE_VIMOTION       0x100000        /* reading vi motion arg */
    815815#define RL_STATE_MULTIKEY       0x200000        /* reading multiple-key command */
    816816#define RL_STATE_VICMDONCE      0x400000        /* entered vi command mode at least once */
     817#define RL_STATE_REDISPLAYING   0x800000        /* updating terminal display */
    817818
    818 #define RL_STATE_DONE           0x800000        /* done; accepted line */
     819#define RL_STATE_DONE           0x1000000       /* done; accepted line */
    819820
    820821#define RL_SETSTATE(x)          (rl_readline_state |= (x))
    821822#define RL_UNSETSTATE(x)        (rl_readline_state &= ~(x))
  • lib/readline/terminal.c

    diff -Naur bash-4.0.orig/lib/readline/terminal.c bash-4.0/lib/readline/terminal.c
    old new  
    355355      _rl_get_screen_size (fileno (rl_instream), 1);
    356356      if (CUSTOM_REDISPLAY_FUNC ())
    357357        rl_forced_update_display ();
    358       else
     358      else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
    359359        _rl_redisplay_after_sigwinch ();
    360360    }
    361361}
  • lib/sh/winsize.c

    diff -Naur bash-4.0.orig/lib/sh/winsize.c bash-4.0/lib/sh/winsize.c
    old new  
    3030
    3131#include <sys/ioctl.h>
    3232
    33 #if !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
    34 /* For struct winsize on SCO */
    35 /*   sys/ptem.h has winsize but needs mblk_t from sys/stream.h */
    36 #  if defined (HAVE_SYS_PTEM_H) && defined (TIOCGWINSZ) && defined (SIGWINCH)
    37 #    if defined (HAVE_SYS_STREAM_H)
    38 #      include <sys/stream.h>
    39 #    endif
     33/* Try to find the definitions of `struct winsize' and TIOGCWINSZ */
     34
     35#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
     36#  include <sys/ioctl.h>
     37#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
     38
     39#if defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
     40#  include <termios.h>
     41#endif /* STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
     42
     43/* Not in either of the standard places, look around. */
     44#if !defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
     45#  if defined (HAVE_SYS_STREAM_H)
     46#    include <sys/stream.h>
     47#  endif /* HAVE_SYS_STREAM_H */
     48#  if defined (HAVE_SYS_PTEM_H) /* SVR4.2, at least, has it here */
    4049#    include <sys/ptem.h>
    41 #  endif /* HAVE_SYS_PTEM_H && TIOCGWINSZ && SIGWINCH */
    42 #endif /* !STRUCT_WINSIZE_IN_SYS_IOCTL */
     50#    define _IO_PTEM_H          /* work around SVR4.2 1.1.4 bug */
     51#  endif /* HAVE_SYS_PTEM_H */
     52#  if defined (HAVE_SYS_PTE_H)  /* ??? */
     53#    include <sys/pte.h>
     54#  endif /* HAVE_SYS_PTE_H */
     55#endif /* !STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
    4356
    4457#include <stdio.h>
    4558
  • parse.y

    diff -Naur bash-4.0.orig/parse.y bash-4.0/parse.y
    old new  
    11221122                          REDIRECTEE rd;
    11231123                          REDIRECT *r;
    11241124
    1125                           tc = $1;
     1125                          tc = $1->type == cm_simple ? (COMMAND *)$1->value.Simple : $1;
    11261126                          rd.dest = 1;
    11271127                          r = make_redirection (2, r_duplicating_output, rd);
    11281128                          if (tc->redirects)
     
    16151615{
    16161616  int *ret;
    16171617
    1618   ret = (int *)xmalloc (3 * sizeof (int));
     1618  ret = (int *)xmalloc (4 * sizeof (int));
    16191619  ret[0] = last_read_token;
    16201620  ret[1] = token_before_that;
    16211621  ret[2] = two_tokens_ago;
     1622  ret[3] = current_token;
    16221623  return ret;
    16231624}
    16241625
     
    16311632  last_read_token = ts[0];
    16321633  token_before_that = ts[1];
    16331634  two_tokens_ago = ts[2];
     1635  current_token = ts[3];
    16341636}
    16351637
    16361638/*
     
    18771879    prompt_again ();
    18781880  ret = read_a_line (remove_quoted_newline);
    18791881#if defined (HISTORY)
    1880   if (remember_on_history && (parser_state & PST_HEREDOC))
     1882  if (ret && remember_on_history && (parser_state & PST_HEREDOC))
    18811883    {
    18821884      /* To make adding the the here-document body right, we need to rely
    18831885         on history_delimiting_chars() returning \n for the first line of
     
    26682670  FREE (word_desc_to_read);
    26692671  word_desc_to_read = (WORD_DESC *)NULL;
    26702672
     2673  current_token = '\n';         /* XXX */
    26712674  last_read_token = '\n';
    26722675  token_to_read = '\n';
    26732676}
     
    29152918#define P_DQUOTE        0x04
    29162919#define P_COMMAND       0x08    /* parsing a command, so look for comments */
    29172920#define P_BACKQUOTE     0x10    /* parsing a backquoted command substitution */
     2921#define P_ARRAYSUB      0x20    /* parsing a [...] array subscript for assignment */
    29182922
    29192923/* Lexical state while parsing a grouping construct or $(...). */
    29202924#define LEX_WASDOL      0x001
     
    29272931#define LEX_INHEREDOC   0x080
    29282932#define LEX_HEREDELIM   0x100           /* reading here-doc delimiter */
    29292933#define LEX_STRIPDOC    0x200           /* <<- strip tabs from here doc delim */
     2934#define LEX_INWORD      0x400
    29302935
    29312936#define COMSUB_META(ch)         ((ch) == ';' || (ch) == '&' || (ch) == '|')
    29322937
     
    31293134              APPEND_NESTRET ();
    31303135              FREE (nestret);
    31313136            }
     3137          else if ((flags & P_ARRAYSUB) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '['))      /* ) } ] */
     3138            goto parse_dollar_word;
    31323139        }
    31333140      /* Parse an old-style command substitution within double quotes as a
    31343141         single word. */
     
    31453152      else if MBTEST(open != '`' && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '['))     /* ) } ] */
    31463153        /* check for $(), $[], or ${} inside quoted string. */
    31473154        {
     3155parse_dollar_word:
    31483156          if (open == ch)       /* undo previous increment */
    31493157            count--;
    31503158          if (ch == '(')                /* ) */
     
    31793187     int open, close;
    31803188     int *lenp, flags;
    31813189{
    3182   int count, ch, peekc, tflags, lex_rwlen, lex_firstind;
     3190  int count, ch, peekc, tflags, lex_rwlen, lex_wlen, lex_firstind;
    31833191  int nestlen, ttranslen, start_lineno;
    31843192  char *ret, *nestret, *ttrans, *heredelim;
    31853193  int retind, retsize, rflags, hdlen;
     
    32003208  retind = 0;
    32013209
    32023210  start_lineno = line_number;
    3203   lex_rwlen = 0;
     3211  lex_rwlen = lex_wlen = 0;
    32043212
    32053213  heredelim = 0;
    32063214  lex_firstind = -1;
     
    32673275          continue;
    32683276        }
    32693277
     3278      if (tflags & LEX_PASSNEXT)                /* last char was backslash */
     3279        {
     3280/*itrace("parse_comsub:%d: lex_passnext -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
     3281          tflags &= ~LEX_PASSNEXT;
     3282          if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
     3283            {
     3284              if (retind > 0)
     3285                retind--;       /* swallow previously-added backslash */
     3286              continue;
     3287            }
     3288
     3289          RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
     3290          if MBTEST(ch == CTLESC || ch == CTLNUL)
     3291            ret[retind++] = CTLESC;
     3292          ret[retind++] = ch;
     3293          continue;
     3294        }
     3295
     3296      /* If this is a shell break character, we are not in a word.  If not,
     3297         we either start or continue a word. */
     3298      if MBTEST(shellbreak (ch))
     3299        {
     3300          tflags &= ~LEX_INWORD;
     3301/*itrace("parse_comsub:%d: lex_inword -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
     3302        }
     3303      else
     3304        {
     3305          if (tflags & LEX_INWORD)
     3306            {
     3307              lex_wlen++;
     3308/*itrace("parse_comsub:%d: lex_inword == 1 ch = `%c' lex_wlen = %d (%d)", line_number, ch, lex_wlen, __LINE__);*/
     3309            }         
     3310          else
     3311            {
     3312/*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/
     3313              tflags |= LEX_INWORD;
     3314              lex_wlen = 0;
     3315            }
     3316        }
     3317
    32703318      /* Skip whitespace */
    32713319      if MBTEST(shellblank (ch) && lex_rwlen == 0)
    32723320        {
     
    33063354        }
    33073355
    33083356      /* Meta-characters that can introduce a reserved word.  Not perfect yet. */
    3309       if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch))
     3357      if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && (shellmeta(ch) || ch == '\n'))
    33103358        {
    33113359          /* Add this character. */
    33123360          RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
     
    33643412}               
    33653413              tflags &= ~LEX_RESWDOK;
    33663414            }
    3367           else if (shellbreak (ch) == 0)
     3415          else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
     3416            ;   /* don't modify LEX_RESWDOK if we're starting a comment */
     3417          else if MBTEST((tflags & LEX_INCASE) && ch != '\n')
     3418            /* If we can read a reserved word and we're in case, we're at the
     3419               point where we can read a new pattern list or an esac.  We
     3420               handle the esac case above.  If we read a newline, we want to
     3421               leave LEX_RESWDOK alone.  If we read anything else, we want to
     3422               turn off LEX_RESWDOK, since we're going to read a pattern list. */
    33683423{
    3369               tflags &= ~LEX_RESWDOK;
     3424            tflags &= ~LEX_RESWDOK;
     3425/*itrace("parse_comsub:%d: lex_incase == 1 found `%c', lex_reswordok -> 0", line_number, ch);*/
     3426}
     3427          else if MBTEST(shellbreak (ch) == 0)
     3428{
     3429            tflags &= ~LEX_RESWDOK;
    33703430/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
    33713431}
    33723432        }
     
    33943454                }
    33953455              else
    33963456                shell_ungetc (peekc);
    3397               tflags |= LEX_HEREDELIM;
    3398               lex_firstind = -1;
     3457              if (peekc != '<')
     3458                {
     3459                  tflags |= LEX_HEREDELIM;
     3460                  lex_firstind = -1;
     3461                }
    33993462              continue;
    34003463            }
    34013464          else
    3402             ch = peekc;         /* fall through and continue XXX - this skips comments if peekc == '#' */
     3465            ch = peekc;         /* fall through and continue XXX */
    34033466        }
    3404       /* Not exactly right yet, should handle shell metacharacters, too.  If
    3405          any changes are made to this test, make analogous changes to subst.c:
    3406          extract_delimited_string(). */
    3407       else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
     3467      else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0)))
     3468{
     3469/*itrace("parse_comsub:%d: lex_incomment -> 1 (%d)", line_number, __LINE__);*/
    34083470        tflags |= LEX_INCOMMENT;
     3471}
    34093472
    3410       if (tflags & LEX_PASSNEXT)                /* last char was backslash */
    3411         {
    3412           tflags &= ~LEX_PASSNEXT;
    3413           if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
    3414             {
    3415               if (retind > 0)
    3416                 retind--;       /* swallow previously-added backslash */
    3417               continue;
    3418             }
    3419 
    3420           RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
    3421           if MBTEST(ch == CTLESC || ch == CTLNUL)
    3422             ret[retind++] = CTLESC;
    3423           ret[retind++] = ch;
    3424           continue;
    3425         }
    3426       else if MBTEST(ch == CTLESC || ch == CTLNUL)      /* special shell escapes */
     3473      if MBTEST(ch == CTLESC || ch == CTLNUL)   /* special shell escapes */
    34273474        {
    34283475          RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
    34293476          ret[retind++] = CTLESC;
     
    42484295                     ((token_index > 0 && assignment_acceptable (last_read_token) && token_is_ident (token, token_index)) ||
    42494296                      (token_index == 0 && (parser_state&PST_COMPASSIGN))))
    42504297        {
    4251           ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
     4298          ttok = parse_matched_pair (cd, '[', ']', &ttoklen, P_ARRAYSUB);
    42524299          if (ttok == &matched_pair_error)
    42534300            return -1;          /* Bail immediately. */
    42544301          RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
     
    44494496    case '}':           /* XXX */
    44504497    case AND_AND:
    44514498    case BANG:
     4499    case BAR_AND:
    44524500    case DO:
    44534501    case DONE:
    44544502    case ELIF:
  • patchlevel.h

    diff -Naur bash-4.0.orig/patchlevel.h bash-4.0/patchlevel.h
    old new  
    2525   regexp `^#define[    ]*PATCHLEVEL', since that's what support/mkversion.sh
    2626   looks for to find the patch level (for the sccs version string). */
    2727
    28 #define PATCHLEVEL 0
     28#define PATCHLEVEL 28
    2929
    3030#endif /* _PATCHLEVEL_H_ */
  • pcomplete.c

    diff -Naur bash-4.0.orig/pcomplete.c bash-4.0/pcomplete.c
    old new  
    10321032  cmdlist = build_arg_list (funcname, text, lwords, cw);
    10331033
    10341034  pps = &ps;
     1035  save_parser_state (pps);
    10351036  begin_unwind_frame ("gen-shell-function-matches");
    10361037  add_unwind_protect (restore_parser_state, (char *)pps);
    10371038  add_unwind_protect (dispose_words, (char *)cmdlist);
  • bash-4.0

    diff -Naur bash-4.0.orig/sig.c bash-4.0/sig.c
    old new  
    448448termsig_sighandler (sig)
    449449     int sig;
    450450{
     451  /* If we get called twice with the same signal before handling it,
     452     terminate right away. */
     453  if (
     454#ifdef SIGHUP
     455    sig != SIGHUP &&
     456#endif
     457#ifdef SIGINT
     458    sig != SIGINT &&
     459#endif
     460#ifdef SIGDANGER
     461    sig != SIGDANGER &&
     462#endif
     463#ifdef SIGPIPE
     464    sig != SIGPIPE &&
     465#endif
     466#ifdef SIGALRM
     467    sig != SIGALRM &&
     468#endif
     469#ifdef SIGTERM
     470    sig != SIGTERM &&
     471#endif
     472#ifdef SIGXCPU
     473    sig != SIGXCPU &&
     474#endif
     475#ifdef SIGXFSZ
     476    sig != SIGXFSZ &&
     477#endif
     478#ifdef SIGVTALRM
     479    sig != SIGVTALRM &&
     480#endif
     481#ifdef SIGLOST
     482    sig != SIGLOST &&
     483#endif
     484#ifdef SIGUSR1
     485    sig != SIGUSR1 &&
     486#endif
     487#ifdef SIGUSR2
     488   sig != SIGUSR2 &&
     489#endif
     490   sig == terminating_signal)
     491    terminate_immediately = 1;
     492
    451493  terminating_signal = sig;
    452494
    453495  /* XXX - should this also trigger when interrupt_immediately is set? */
  • subst.c

    diff -Naur bash-4.0.orig/subst.c bash-4.0/subst.c
    old new  
    8585
    8686/* Flags for the `pflags' argument to param_expand() */
    8787#define PF_NOCOMSUB     0x01    /* Do not perform command substitution */
     88#define PF_IGNUNBOUND   0x02    /* ignore unbound vars even if -u set */
    8889
    8990/* These defs make it easier to use the editor. */
    9091#define LBRACE          '{'
     
    222223static int skip_double_quoted __P((char *, size_t, int));
    223224static char *extract_delimited_string __P((char *, int *, char *, char *, char *, int));
    224225static char *extract_dollar_brace_string __P((char *, int *, int, int));
     226static int skip_matched_pair __P((const char *, int, int, int, int));
    225227
    226228static char *pos_params __P((char *, int, int, int));
    227229
     
    262264static int chk_atstar __P((char *, int, int *, int *));
    263265static int chk_arithsub __P((const char *, int));
    264266
    265 static WORD_DESC *parameter_brace_expand_word __P((char *, int, int));
     267static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int));
    266268static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
    267269static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
    268270static void parameter_brace_expand_error __P((char *, char *));
     
    13741376
    13751377#define CQ_RETURN(x) do { no_longjmp_on_fatal_error = 0; return (x); } while (0)
    13761378
     1379/* This function assumes s[i] == open; returns with s[ret] == close; used to
     1380   parse array subscripts.  FLAGS currently unused. */
     1381static int
     1382skip_matched_pair (string, start, open, close, flags)
     1383     const char *string;
     1384     int start, open, close, flags;
     1385{
     1386  int i, pass_next, backq, si, c, count;
     1387  size_t slen;
     1388  char *temp, *ss;
     1389  DECLARE_MBSTATE;
     1390
     1391  slen = strlen (string + start) + start;
     1392  no_longjmp_on_fatal_error = 1;
     1393
     1394  i = start + 1;                /* skip over leading bracket */
     1395  count = 1;
     1396  pass_next = backq = 0;
     1397  ss = (char *)string;
     1398  while (c = string[i])
     1399    {
     1400      if (pass_next)
     1401        {
     1402          pass_next = 0;
     1403          if (c == 0)
     1404            CQ_RETURN(i);
     1405          ADVANCE_CHAR (string, slen, i);
     1406          continue;
     1407        }
     1408      else if (c == '\\')
     1409        {
     1410          pass_next = 1;
     1411          i++;
     1412          continue;
     1413        }
     1414      else if (backq)
     1415        {
     1416          if (c == '`')
     1417            backq = 0;
     1418          ADVANCE_CHAR (string, slen, i);
     1419          continue;
     1420        }
     1421      else if (c == '`')
     1422        {
     1423          backq = 1;
     1424          i++;
     1425          continue;
     1426        }
     1427      else if (c == open)
     1428        {
     1429          count++;
     1430          i++;
     1431          continue;
     1432        }
     1433      else if (c == close)
     1434        {
     1435          count--;
     1436          if (count == 0)
     1437            break;
     1438          i++;
     1439          continue;
     1440        }
     1441      else if (c == '\'' || c == '"')
     1442        {
     1443          i = (c == '\'') ? skip_single_quoted (ss, slen, ++i)
     1444                          : skip_double_quoted (ss, slen, ++i);
     1445          /* no increment, the skip functions increment past the closing quote. */
     1446        }
     1447      else if (c == '$' && (string[i+1] == LPAREN || string[i+1] == LBRACE))
     1448        {
     1449          si = i + 2;
     1450          if (string[si] == '\0')
     1451            CQ_RETURN(si);
     1452
     1453          if (string[i+1] == LPAREN)
     1454            temp = extract_delimited_string (ss, &si, "$(", "(", ")", SX_NOALLOC|SX_COMMAND); /* ) */
     1455          else
     1456            temp = extract_dollar_brace_string (ss, &si, 0, SX_NOALLOC);
     1457          i = si;
     1458          if (string[i] == '\0')        /* don't increment i past EOS in loop */
     1459            break;
     1460          i++;
     1461          continue;
     1462        }
     1463      else
     1464        ADVANCE_CHAR (string, slen, i);
     1465    }
     1466
     1467  CQ_RETURN(i);
     1468}
     1469
     1470#if defined (ARRAY_VARS)
     1471int
     1472skipsubscript (string, start)
     1473     const char *string;
     1474     int start;
     1475{
     1476  return (skip_matched_pair (string, start, '[', ']', 0));
     1477}
     1478#endif
     1479
    13771480/* Skip characters in STRING until we find a character in DELIMS, and return
    13781481   the index of that character.  START is the index into string at which we
    13791482   begin.  This is similar in spirit to strpbrk, but it returns an index into
     
    50935196   the shell, e.g., "@", "$", "*", etc.  QUOTED, if non-zero, means that
    50945197   NAME was found inside of a double-quoted expression. */
    50955198static WORD_DESC *
    5096 parameter_brace_expand_word (name, var_is_special, quoted)
     5199parameter_brace_expand_word (name, var_is_special, quoted, pflags)
    50975200     char *name;
    5098      int var_is_special, quoted;
     5201     int var_is_special, quoted, pflags;
    50995202{
    51005203  WORD_DESC *ret;
    51015204  char *temp, *tt;
     
    51275230      strcpy (tt + 1, name);
    51285231
    51295232      ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
    5130                           (int *)NULL, (int *)NULL, 0);
     5233                          (int *)NULL, (int *)NULL, pflags);
    51315234      free (tt);
    51325235    }
    51335236#if defined (ARRAY_VARS)
     
    51885291  char *temp, *t;
    51895292  WORD_DESC *w;
    51905293
    5191   w = parameter_brace_expand_word (name, var_is_special, quoted);
     5294  w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
    51925295  t = w->word;
    51935296  /* Have to dequote here if necessary */
    51945297  if (t)
     
    52055308  if (t == 0)
    52065309    return (WORD_DESC *)NULL;
    52075310
    5208   w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted);
     5311  w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0);
    52095312  free (t);
    52105313
    52115314  return w;
     
    65566659  if (want_indir)
    65576660    tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
    65586661  else
    6559     tdesc = parameter_brace_expand_word (name, var_is_special, quoted);
     6662    tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
    65606663
    65616664  if (tdesc)
    65626665    {
     
    66646767      return &expand_wdesc_error;
    66656768
    66666769    case RBRACE:
    6667       if (var_is_set == 0 && unbound_vars_is_error)
     6770      if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1]))
    66686771        {
     6772          last_command_exit_value = EXECUTION_FAILURE;
    66696773          err_unboundvar (name);
    66706774          FREE (value);
    66716775          FREE (temp);
    66726776          free (name);
    6673           last_command_exit_value = EXECUTION_FAILURE;
    66746777          return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
    66756778        }
    66766779      break;
     
    68876990    case '*':           /* `$*' */
    68886991      list = list_rest_of_args ();
    68896992
    6890       if (list == 0 && unbound_vars_is_error)
     6993#if 0
     6994      /* According to austin-group posix proposal by Geoff Clare in
     6995         <20090505091501.GA10097@squonk.masqnet> of 5 May 2009:
     6996
     6997        "The shell shall write a message to standard error and
     6998         immediately exit when it tries to expand an unset parameter
     6999         other than the '@' and '*' special parameters."
     7000      */
     7001
     7002      if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
    68917003        {
    68927004          uerror[0] = '$';
    68937005          uerror[1] = '*';
    68947006          uerror[2] = '\0';
    6895           err_unboundvar (uerror);
    68967007          last_command_exit_value = EXECUTION_FAILURE;
     7008          err_unboundvar (uerror);
    68977009          return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
    68987010        }
     7011#endif
    68997012
    69007013      /* If there are no command-line arguments, this should just
    69017014         disappear if there are other characters in the expansion,
     
    69497062    case '@':           /* `$@' */
    69507063      list = list_rest_of_args ();
    69517064
    6952       if (list == 0 && unbound_vars_is_error)
     7065#if 0
     7066      /* According to austin-group posix proposal by Geoff Clare in
     7067         <20090505091501.GA10097@squonk.masqnet> of 5 May 2009:
     7068
     7069        "The shell shall write a message to standard error and
     7070         immediately exit when it tries to expand an unset parameter
     7071         other than the '@' and '*' special parameters."
     7072      */
     7073
     7074      if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
    69537075        {
    69547076          uerror[0] = '$';
    69557077          uerror[1] = '@';
    69567078          uerror[2] = '\0';
    6957           err_unboundvar (uerror);
    69587079          last_command_exit_value = EXECUTION_FAILURE;
     7080          err_unboundvar (uerror);
    69597081          return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
    69607082        }
     7083#endif
    69617084
    69627085      /* We want to flag the fact that we saw this.  We can't turn
    69637086         off quoting entirely, because other characters in the
  • bash-4.0

    diff -Naur bash-4.0.orig/trap.c bash-4.0/trap.c
    old new  
    755755        }
    756756
    757757      flags = SEVAL_NONINT|SEVAL_NOHIST;
    758       if (sig != DEBUG_TRAP && sig != RETURN_TRAP)
     758      if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
    759759        flags |= SEVAL_RESETLINE;
    760760      if (function_code == 0)
    761761        parse_and_execute (trap_command, tag, flags);
     
    798798run_debug_trap ()
    799799{
    800800  int trap_exit_value;
     801  pid_t save_pgrp;
     802  int save_pipe[2];
    801803
    802804  /* XXX - question:  should the DEBUG trap inherit the RETURN trap? */
    803805  trap_exit_value = 0;
    804806  if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
    805807    {
     808#if defined (JOB_CONTROL)
     809      save_pgrp = pipeline_pgrp;
     810      pipeline_pgrp = 0;
     811      save_pipeline (1);
     812#  if defined (PGRP_PIPE)
     813      save_pgrp_pipe (save_pipe, 1);
     814#  endif
     815      stop_making_children ();
     816#endif
     817
    806818      trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
     819
     820#if defined (JOB_CONTROL)
     821      pipeline_pgrp = save_pgrp;
     822      restore_pipeline (1);
     823#  if defined (PGRP_PIPE)
     824      close_pgrp_pipe ();
     825      restore_pgrp_pipe (save_pipe);
     826#  endif
     827      if (pipeline_pgrp > 0)
     828        give_terminal_to (pipeline_pgrp, 1);
     829      notify_and_cleanup ();
     830#endif
    807831     
    808832#if defined (DEBUGGER)
    809833      /* If we're in the debugger and the DEBUG trap returns 2 while we're in
Note: See TracBrowser for help on using the repository browser.