%bcond_without tests # do not perform "make test"
#
%define ver 4.0
-%define patchlevel 17
+%define patchlevel 24
%define rel 1
Summary: GNU Bourne Again Shell (bash)
Summary(fr.UTF-8): Le shell Bourne Again de GNU
--- /dev/null
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-018
+
+Bug-Reported-by: Dan Price <dp@eng.sun.com>
+Bug-Reference-ID: <20090324171502.GA20582@eng.sun.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00184.html
+
+Bug-Description:
+
+A missing include file results in an empty function definition and a no-op
+when checking whether or not the window size has changed.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/sh/winsize.c 2008-08-12 13:53:51.000000000 -0400
+--- lib/sh/winsize.c 2009-04-06 10:44:20.000000000 -0400
+***************
+*** 31,44 ****
+ #include <sys/ioctl.h>
+
+! #if !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
+! /* For struct winsize on SCO */
+! /* sys/ptem.h has winsize but needs mblk_t from sys/stream.h */
+! # if defined (HAVE_SYS_PTEM_H) && defined (TIOCGWINSZ) && defined (SIGWINCH)
+! # if defined (HAVE_SYS_STREAM_H)
+! # include <sys/stream.h>
+! # endif
+ # include <sys/ptem.h>
+! # endif /* HAVE_SYS_PTEM_H && TIOCGWINSZ && SIGWINCH */
+! #endif /* !STRUCT_WINSIZE_IN_SYS_IOCTL */
+
+ #include <stdio.h>
+--- 31,57 ----
+ #include <sys/ioctl.h>
+
+! /* Try to find the definitions of `struct winsize' and TIOGCWINSZ */
+!
+! #if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
+! # include <sys/ioctl.h>
+! #endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
+!
+! #if defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
+! # include <termios.h>
+! #endif /* STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
+!
+! /* Not in either of the standard places, look around. */
+! #if !defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
+! # if defined (HAVE_SYS_STREAM_H)
+! # include <sys/stream.h>
+! # endif /* HAVE_SYS_STREAM_H */
+! # if defined (HAVE_SYS_PTEM_H) /* SVR4.2, at least, has it here */
+ # include <sys/ptem.h>
+! # define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
+! # endif /* HAVE_SYS_PTEM_H */
+! # if defined (HAVE_SYS_PTE_H) /* ??? */
+! # include <sys/pte.h>
+! # endif /* HAVE_SYS_PTE_H */
+! #endif /* !STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
+
+ #include <stdio.h>
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 17
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 18
+
+ #endif /* _PATCHLEVEL_H_ */
--- /dev/null
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-019
+
+Bug-Reported-by: Oleksiy Melnyk <lex@upc.ua>
+Bug-Reference-ID: <20090224142233.D2FEFC004@floyd.upc.ua>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00200.html
+
+Bug-Description:
+
+Using an external command as part of the DEBUG trap when job control is
+enabled causes pipelines to misbehave. The problem has to do with process
+groups assigned to the pipeline and terminal.
+
+Patch:
+
+*** ../bash-4.0-patched/jobs.c 2009-01-29 17:09:49.000000000 -0500
+--- jobs.c 2009-04-17 21:08:20.000000000 -0400
+***************
+*** 443,447 ****
+ the_pipeline = saved_pipeline;
+ already_making_children = saved_already_making_children;
+! if (discard)
+ discard_pipeline (old_pipeline);
+ }
+--- 443,447 ----
+ the_pipeline = saved_pipeline;
+ already_making_children = saved_already_making_children;
+! if (discard && old_pipeline)
+ discard_pipeline (old_pipeline);
+ }
+***************
+*** 4203,4205 ****
+--- 4204,4225 ----
+ }
+
++ void
++ save_pgrp_pipe (p, clear)
++ int *p;
++ int clear;
++ {
++ p[0] = pgrp_pipe[0];
++ p[1] = pgrp_pipe[1];
++ if (clear)
++ pgrp_pipe[0] = pgrp_pipe[1] = -1;
++ }
++
++ void
++ restore_pgrp_pipe (p)
++ int *p;
++ {
++ pgrp_pipe[0] = p[0];
++ pgrp_pipe[1] = p[1];
++ }
++
+ #endif /* PGRP_PIPE */
+*** ../bash-4.0-patched/jobs.h 2009-01-04 14:32:29.000000000 -0500
+--- jobs.h 2009-04-17 15:07:51.000000000 -0400
+***************
+*** 236,239 ****
+--- 236,241 ----
+
+ extern void close_pgrp_pipe __P((void));
++ extern void save_pgrp_pipe __P((int *, int));
++ extern void restore_pgrp_pipe __P((int *));
+
+ #if defined (JOB_CONTROL)
+*** ../bash-4.0-patched/trap.c 2009-01-16 17:07:53.000000000 -0500
+--- trap.c 2009-04-17 22:22:36.000000000 -0400
+***************
+*** 799,802 ****
+--- 799,804 ----
+ {
+ int trap_exit_value;
++ pid_t save_pgrp;
++ int save_pipe[2];
+
+ /* XXX - question: should the DEBUG trap inherit the RETURN trap? */
+***************
+*** 804,808 ****
+--- 806,832 ----
+ if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
+ {
++ #if defined (JOB_CONTROL)
++ save_pgrp = pipeline_pgrp;
++ pipeline_pgrp = 0;
++ save_pipeline (1);
++ # if defined (PGRP_PIPE)
++ save_pgrp_pipe (save_pipe, 1);
++ # endif
++ stop_making_children ();
++ #endif
++
+ trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
++
++ #if defined (JOB_CONTROL)
++ pipeline_pgrp = save_pgrp;
++ restore_pipeline (1);
++ # if defined (PGRP_PIPE)
++ close_pgrp_pipe ();
++ restore_pgrp_pipe (save_pipe);
++ # endif
++ if (pipeline_pgrp > 0)
++ give_terminal_to (pipeline_pgrp, 1);
++ notify_and_cleanup ();
++ #endif
+
+ #if defined (DEBUGGER)
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 18
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 19
+
+ #endif /* _PATCHLEVEL_H_ */
--- /dev/null
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-020
+
+Bug-Reported-by: Nicolai Lissner <nlissne@linux01.org>
+Bug-Reference-ID: <20090412020510.GA29658@lilith>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00104.html
+
+Bug-Description:
+
+If a SIGWINCH arrives while bash is performing redisplay, multi-line prompts
+are displayed incorrectly due to the display code being called recursively.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/readline/readline.h 2009-01-04 14:32:33.000000000 -0500
+--- lib/readline/readline.h 2009-04-13 08:47:00.000000000 -0400
+***************
+*** 815,820 ****
+ #define RL_STATE_MULTIKEY 0x200000 /* reading multiple-key command */
+ #define RL_STATE_VICMDONCE 0x400000 /* entered vi command mode at least once */
+
+! #define RL_STATE_DONE 0x800000 /* done; accepted line */
+
+ #define RL_SETSTATE(x) (rl_readline_state |= (x))
+--- 815,821 ----
+ #define RL_STATE_MULTIKEY 0x200000 /* reading multiple-key command */
+ #define RL_STATE_VICMDONCE 0x400000 /* entered vi command mode at least once */
++ #define RL_STATE_REDISPLAYING 0x800000 /* updating terminal display */
+
+! #define RL_STATE_DONE 0x1000000 /* done; accepted line */
+
+ #define RL_SETSTATE(x) (rl_readline_state |= (x))
+*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000 -0500
+--- lib/readline/display.c 2009-04-13 08:29:54.000000000 -0400
+***************
+*** 513,516 ****
+--- 513,517 ----
+ data structures. */
+ _rl_block_sigint ();
++ RL_SETSTATE (RL_STATE_REDISPLAYING);
+
+ if (!rl_display_prompt)
+***************
+*** 1237,1240 ****
+--- 1238,1242 ----
+ }
+
++ RL_UNSETSTATE (RL_STATE_REDISPLAYING);
+ _rl_release_sigint ();
+ }
+*** ../bash-4.0-patched/lib/readline/terminal.c 2009-01-04 14:32:34.000000000 -0500
+--- lib/readline/terminal.c 2009-04-13 08:43:00.000000000 -0400
+***************
+*** 356,360 ****
+ if (CUSTOM_REDISPLAY_FUNC ())
+ rl_forced_update_display ();
+! else
+ _rl_redisplay_after_sigwinch ();
+ }
+--- 356,360 ----
+ if (CUSTOM_REDISPLAY_FUNC ())
+ rl_forced_update_display ();
+! else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
+ _rl_redisplay_after_sigwinch ();
+ }
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 19
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 20
+
+ #endif /* _PATCHLEVEL_H_ */
--- /dev/null
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-021
+
+Bug-Reported-by: Matt Zyzik <matt.zyzik@nyu.edu>
+Bug-Reference-ID: <20090319015542.696F62B8E8@ice.filescope.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00149.html
+
+Bug-Description:
+
+When not in a locale supporting multibyte characters, readline will occasionally
+not erase characters between the cursor position and the end of the line
+when killing text backwards.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000 -0500
+--- lib/readline/display.c 2009-04-14 14:00:18.000000000 -0400
+***************
+*** 1775,1779 ****
+ adjust col_lendiff based on the difference between _rl_last_c_pos
+ and _rl_screenwidth */
+! if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth))
+ #endif
+ {
+--- 1775,1779 ----
+ adjust col_lendiff based on the difference between _rl_last_c_pos
+ and _rl_screenwidth */
+! if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
+ #endif
+ {
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 20
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 21
+
+ #endif /* _PATCHLEVEL_H_ */
--- /dev/null
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-022
+
+Bug-Reported-by: Bernd Eggink <monoped@sudrala.de>
+Bug-Reference-ID: <49E65407.5010206@sudrala.de>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00118.html
+
+Bug-Description:
+
+When parsing case statements in command substitutions, the shell did not
+note that a newline is a shell metacharacter and can legally be followed
+by a reserved word (e.g., `esac').
+
+Patch:
+
+*** ../bash-4.0-patched/parse.y 2009-03-08 21:24:47.000000000 -0400
+--- parse.y 2009-04-15 22:27:56.000000000 -0400
+***************
+*** 3355,3359 ****
+
+ /* Meta-characters that can introduce a reserved word. Not perfect yet. */
+! if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch))
+ {
+ /* Add this character. */
+--- 3375,3379 ----
+
+ /* Meta-characters that can introduce a reserved word. Not perfect yet. */
+! if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && (shellmeta(ch) || ch == '\n'))
+ {
+ /* Add this character. */
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 21
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 22
+
+ #endif /* _PATCHLEVEL_H_ */
--- /dev/null
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-023
+
+Bug-Reported-by: Andreas Schwab <schwab@linux-m68k.org>
+Bug-Reference-ID: <m21vrhhx08.fsf@igel.home>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00160.html
+
+Bug-Description:
+
+If the prompt length exactly matches the screen width, and the prompt ends
+with invisible characters, readline positions the cursor incorrectly.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000 -0500
+--- lib/readline/display.c 2009-04-25 21:42:18.000000000 -0400
+***************
+*** 1895,1898 ****
+--- 1897,1904 ----
+ woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
+ cpos = _rl_last_c_pos;
++
++ if (cpos == 0 && cpos == new)
++ return;
++
+ #if defined (HANDLE_MULTIBYTE)
+ /* If we have multibyte characters, NEW is indexed by the buffer point in
+***************
+*** 1908,1914 ****
+ desired display position. */
+ if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
+! (prompt_physical_chars > _rl_screenwidth &&
+ _rl_last_v_pos == prompt_last_screen_line &&
+! wrap_offset >= woff &&
+ new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
+ /* XXX last comparison might need to be >= */
+--- 1914,1920 ----
+ desired display position. */
+ if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
+! (prompt_physical_chars >= _rl_screenwidth &&
+ _rl_last_v_pos == prompt_last_screen_line &&
+! wrap_offset >= woff && dpos >= woff &&
+ new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
+ /* XXX last comparison might need to be >= */
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 22
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 23
+
+ #endif /* _PATCHLEVEL_H_ */
--- /dev/null
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-024
+
+Bug-Reported-by: Matt Zyzik <matt.zyzik@nyu.edu>
+Bug-Reference-ID: <20090405205428.4FDEA1C7175@ice.filescope.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00021.html
+
+Bug-Description:
+
+When using the ** globbing operator, bash will incorrectly add an extra
+directory name when the preceding directory name ends with `*' or an empty
+string when there is no preceding directory name.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/glob/glob.c 2009-01-04 14:32:30.000000000 -0500
+--- lib/glob/glob.c 2009-04-28 10:22:29.000000000 -0400
+***************
+*** 357,361 ****
+ if (ep)
+ *ep = 0;
+! if (r)
+ free (r);
+ return (struct globval *)0;
+--- 357,361 ----
+ if (ep)
+ *ep = 0;
+! if (r && r != &glob_error_return)
+ free (r);
+ return (struct globval *)0;
+***************
+*** 666,671 ****
+ }
+
+! /* compat: if GX_ALLDIRS, add the passed directory also */
+! if (add_current)
+ {
+ sdlen = strlen (dir);
+--- 666,672 ----
+ }
+
+! /* compat: if GX_ALLDIRS, add the passed directory also, but don't add an
+! empty directory name. */
+! if (add_current && (flags & GX_NULLDIR) == 0)
+ {
+ sdlen = strlen (dir);
+***************
+*** 679,686 ****
+ nextlink->next = lastlink;
+ lastlink = nextlink;
+! if (flags & GX_NULLDIR)
+! nextname[0] = '\0';
+! else
+! bcopy (dir, nextname, sdlen + 1);
+ ++count;
+ }
+--- 680,684 ----
+ nextlink->next = lastlink;
+ lastlink = nextlink;
+! bcopy (dir, nextname, sdlen + 1);
+ ++count;
+ }
+***************
+*** 943,947 ****
+ register unsigned int l;
+
+! array = glob_dir_to_array (directories[i], temp_results, flags);
+ l = 0;
+ while (array[l] != NULL)
+--- 941,950 ----
+ register unsigned int l;
+
+! /* If we're expanding **, we don't need to glue the directory
+! name to the results; we've already done it in glob_vector */
+! if ((dflags & GX_ALLDIRS) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0')
+! array = temp_results;
+! else
+! array = glob_dir_to_array (directories[i], temp_results, flags);
+ l = 0;
+ while (array[l] != NULL)
+***************
+*** 960,964 ****
+
+ /* Note that the elements of ARRAY are not freed. */
+! free ((char *) array);
+ }
+ }
+--- 963,968 ----
+
+ /* Note that the elements of ARRAY are not freed. */
+! if (array != temp_results)
+! free ((char *) array);
+ }
+ }
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 23
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 24
+
+ #endif /* _PATCHLEVEL_H_ */