summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/bash-aliases-repeat.diff28
-rw-r--r--debian/patches/bash-default-editor.diff35
-rw-r--r--debian/patches/bash50-001.diff145
-rw-r--r--debian/patches/bash50-002.diff88
-rw-r--r--debian/patches/bash50-003.diff188
-rw-r--r--debian/patches/bashbug-editor.diff12
-rw-r--r--debian/patches/bzero.diff13
-rw-r--r--debian/patches/deb-bash-config.diff56
-rw-r--r--debian/patches/deb-examples.diff16
-rw-r--r--debian/patches/exec-redirections-doc.diff29
-rw-r--r--debian/patches/input-err.diff15
-rw-r--r--debian/patches/man-arithmetic.diff16
-rw-r--r--debian/patches/man-bashlogout.diff14
-rw-r--r--debian/patches/man-bashrc.diff64
-rw-r--r--debian/patches/man-fignore.diff17
-rw-r--r--debian/patches/man-macro-warnings.diff53
-rw-r--r--debian/patches/man-nocaseglob.diff17
-rw-r--r--debian/patches/man-test.diff17
-rw-r--r--debian/patches/man-test2.diff40
-rw-r--r--debian/patches/man-vx-opts.diff19
-rw-r--r--debian/patches/no-brk-caching.diff47
-rw-r--r--debian/patches/po-de-fix.diff11
-rw-r--r--debian/patches/rbash-manpage.diff12
-rw-r--r--debian/patches/series25
-rw-r--r--debian/patches/use-system-texi2html.diff15
-rw-r--r--debian/patches/wait-builtin-avoid-hanging-on-inherited-children.diff26
26 files changed, 1018 insertions, 0 deletions
diff --git a/debian/patches/bash-aliases-repeat.diff b/debian/patches/bash-aliases-repeat.diff
new file mode 100644
index 0000000..e805473
--- /dev/null
+++ b/debian/patches/bash-aliases-repeat.diff
@@ -0,0 +1,28 @@
+# DP: Fix bug in Bash_aliases example.
+
+--- a/examples/startup-files/Bash_aliases
++++ b/examples/startup-files/Bash_aliases
+@@ -41,20 +41,20 @@
+ {
+ local count="$1" i;
+ shift;
+- for i in $(seq 1 "$count");
++ for i in $(_seq 1 "$count");
+ do
+ eval "$@";
+ done
+ }
+
+ # Subfunction needed by `repeat'.
+-seq ()
++_seq ()
+ {
+ local lower upper output;
+ lower=$1 upper=$2;
+
+ if [ $lower -ge $upper ]; then return; fi
+- while [ $lower -le $upper ];
++ while [ $lower -lt $upper ];
+ do
+ echo -n "$lower "
+ lower=$(($lower + 1))
diff --git a/debian/patches/bash-default-editor.diff b/debian/patches/bash-default-editor.diff
new file mode 100644
index 0000000..2287edd
--- /dev/null
+++ b/debian/patches/bash-default-editor.diff
@@ -0,0 +1,35 @@
+# DP: Use `command -v editor`, as an editor, if available.
+
+Index: b/bashline.c
+===================================================================
+--- a/bashline.c
++++ b/bashline.c
+@@ -927,8 +927,8 @@ operate_and_get_next (count, c)
+ command being entered (if no explicit argument is given), otherwise on
+ a command from the history file. */
+
+-#define VI_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-vi}}\""
+-#define EMACS_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-emacs}}\""
++#define VI_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-$(command -v editor || echo vi)}}\""
++#define EMACS_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-$(command -v editor || echo emacs)}}\""
+ #define POSIX_VI_EDIT_COMMAND "fc -e vi"
+
+ static int
+Index: b/builtins/fc.def
+===================================================================
+--- a/builtins/fc.def
++++ b/builtins/fc.def
+@@ -161,11 +161,11 @@ set_verbose_flag ()
+ }
+
+ /* String to execute on a file that we want to edit. */
+-#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-vi}}"
++#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-$(command -v editor || echo vi)}}"
+ #if defined (STRICT_POSIX)
+ # define POSIX_FC_EDIT_COMMAND "${FCEDIT:-ed}"
+ #else
+-# define POSIX_FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-ed}}"
++# define POSIX_FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-$(command -v editor || echo ed)}}"
+ #endif
+
+ int
diff --git a/debian/patches/bash50-001.diff b/debian/patches/bash50-001.diff
new file mode 100644
index 0000000..53602ec
--- /dev/null
+++ b/debian/patches/bash50-001.diff
@@ -0,0 +1,145 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.0
+Patch-ID: bash50-001
+
+Bug-Reported-by: axel@freakout.de
+Bug-Reference-ID: <201901082050.x08KoShS006731@bongo.freakout.de>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00079.html
+
+Bug-Description:
+
+Under certain circumstances, the glob expansion code did not remove
+backslashes escaping characters in directory names (or portions of a
+pattern preceding a slash).
+
+--- a/bashline.c
++++ b/bashline.c
+@@ -231,6 +231,7 @@ static int bash_possible_variable_comple
+ static int bash_complete_command __P((int, int));
+ static int bash_possible_command_completions __P((int, int));
+
++static int completion_glob_pattern __P((char *));
+ static char *glob_complete_word __P((const char *, int));
+ static int bash_glob_completion_internal __P((int));
+ static int bash_glob_complete_word __P((int, int));
+@@ -1741,7 +1742,7 @@ bash_default_completion (text, start, en
+
+ /* This could be a globbing pattern, so try to expand it using pathname
+ expansion. */
+- if (!matches && glob_pattern_p (text))
++ if (!matches && completion_glob_pattern ((char *)text))
+ {
+ matches = rl_completion_matches (text, glob_complete_word);
+ /* A glob expression that matches more than one filename is problematic.
+@@ -1850,7 +1851,7 @@ command_word_completion_function (hint_t
+ glob_matches = (char **)NULL;
+ }
+
+- globpat = glob_pattern_p (hint_text);
++ globpat = completion_glob_pattern ((char *)hint_text);
+
+ /* If this is an absolute program name, do not check it against
+ aliases, reserved words, functions or builtins. We must check
+@@ -3713,6 +3714,61 @@ bash_complete_command_internal (what_to_
+ return bash_specific_completion (what_to_do, command_word_completion_function);
+ }
+
++static int
++completion_glob_pattern (string)
++ char *string;
++{
++ register int c;
++ char *send;
++ int open;
++
++ DECLARE_MBSTATE;
++
++ open = 0;
++ send = string + strlen (string);
++
++ while (c = *string++)
++ {
++ switch (c)
++ {
++ case '?':
++ case '*':
++ return (1);
++
++ case '[':
++ open++;
++ continue;
++
++ case ']':
++ if (open)
++ return (1);
++ continue;
++
++ case '+':
++ case '@':
++ case '!':
++ if (*string == '(') /*)*/
++ return (1);
++ continue;
++
++ case '\\':
++ if (*string == 0)
++ return (0);
++ }
++
++ /* Advance one fewer byte than an entire multibyte character to
++ account for the auto-increment in the loop above. */
++#ifdef HANDLE_MULTIBYTE
++ string--;
++ ADVANCE_CHAR_P (string, send - string);
++ string++;
++#else
++ ADVANCE_CHAR_P (string, send - string);
++#endif
++ }
++ return (0);
++}
++
+ static char *globtext;
+ static char *globorig;
+
+@@ -3877,7 +3933,7 @@ bash_vi_complete (count, key)
+ t = substring (rl_line_buffer, p, rl_point);
+ }
+
+- if (t && glob_pattern_p (t) == 0)
++ if (t && completion_glob_pattern (t) == 0)
+ rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
+ FREE (t);
+
+--- a/lib/glob/glob_loop.c
++++ b/lib/glob/glob_loop.c
+@@ -54,17 +54,11 @@ INTERNAL_GLOB_PATTERN_P (pattern)
+ continue;
+
+ case L('\\'):
+-#if 0
+ /* Don't let the pattern end in a backslash (GMATCH returns no match
+ if the pattern ends in a backslash anyway), but otherwise return 1,
+ since the matching engine uses backslash as an escape character
+ and it can be removed. */
+ return (*p != L('\0'));
+-#else
+- /* The pattern may not end with a backslash. */
+- if (*p++ == L('\0'))
+- return 0;
+-#endif
+ }
+
+ return 0;
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
+ looks for to find the patch level (for the sccs version string). */
+
+-#define PATCHLEVEL 0
++#define PATCHLEVEL 1
+
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/debian/patches/bash50-002.diff b/debian/patches/bash50-002.diff
new file mode 100644
index 0000000..6da7452
--- /dev/null
+++ b/debian/patches/bash50-002.diff
@@ -0,0 +1,88 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.0
+Patch-ID: bash50-002
+
+Bug-Reported-by: Ante Peric <synthmeat@gmail.com>
+Bug-Reference-ID: <B7E3B567-2467-4F7B-B6B9-CA4E75A9C93F@gmail.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00095.html
+
+Bug-Description:
+
+When an alias value ends with an unquoted literal tab (not part of a quoted
+string or comment), alias expansion cannot correctly detect the end of the
+alias value after expanding it.
+
+--- a/parse.y
++++ b/parse.y
+@@ -2557,12 +2557,14 @@ next_alias_char:
+ if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE &&
+ pushed_string_list->flags != PSH_DPAREN &&
+ (parser_state & PST_COMMENT) == 0 &&
++ (parser_state & PST_ENDALIAS) == 0 && /* only once */
+ shell_input_line_index > 0 &&
+- shell_input_line[shell_input_line_index-1] != ' ' &&
++ shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
+ shell_input_line[shell_input_line_index-1] != '\n' &&
+ shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
+ (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
+ {
++ parser_state |= PST_ENDALIAS;
+ return ' '; /* END_ALIAS */
+ }
+ #endif
+@@ -2571,6 +2573,7 @@ pop_alias:
+ /* This case works for PSH_DPAREN as well */
+ if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
+ {
++ parser_state &= ~PST_ENDALIAS;
+ pop_string ();
+ uc = shell_input_line[shell_input_line_index];
+ if (uc)
+--- a/parser.h
++++ b/parser.h
+@@ -47,6 +47,7 @@
+ #define PST_REPARSE 0x040000 /* re-parsing in parse_string_to_word_list */
+ #define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */
+ #define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */
++#define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */
+
+ /* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
+ struct dstack {
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
+ looks for to find the patch level (for the sccs version string). */
+
+-#define PATCHLEVEL 1
++#define PATCHLEVEL 2
+
+ #endif /* _PATCHLEVEL_H_ */
+--- a/y.tab.c
++++ b/y.tab.c
+@@ -4873,12 +4873,14 @@ next_alias_char:
+ if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE &&
+ pushed_string_list->flags != PSH_DPAREN &&
+ (parser_state & PST_COMMENT) == 0 &&
++ (parser_state & PST_ENDALIAS) == 0 && /* only once */
+ shell_input_line_index > 0 &&
+- shell_input_line[shell_input_line_index-1] != ' ' &&
++ shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
+ shell_input_line[shell_input_line_index-1] != '\n' &&
+ shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
+ (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
+ {
++ parser_state |= PST_ENDALIAS;
+ return ' '; /* END_ALIAS */
+ }
+ #endif
+@@ -4887,6 +4889,7 @@ pop_alias:
+ /* This case works for PSH_DPAREN as well */
+ if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
+ {
++ parser_state &= ~PST_ENDALIAS;
+ pop_string ();
+ uc = shell_input_line[shell_input_line_index];
+ if (uc)
diff --git a/debian/patches/bash50-003.diff b/debian/patches/bash50-003.diff
new file mode 100644
index 0000000..58b0aae
--- /dev/null
+++ b/debian/patches/bash50-003.diff
@@ -0,0 +1,188 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.0
+Patch-ID: bash50-003
+
+Bug-Reported-by: Andrew Church <achurch+bash@achurch.org>
+Bug-Reference-ID: <5c534aa2.04371@msgid.achurch.org>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00276.html
+
+Bug-Description:
+
+There are several incompatibilities in how bash-5.0 processes pathname
+expansion (globbing) of filename arguments that have backslashes in the
+directory portion.
+
+--- a/bashline.c
++++ b/bashline.c
+@@ -3752,7 +3752,7 @@ completion_glob_pattern (string)
+ continue;
+
+ case '\\':
+- if (*string == 0)
++ if (*string++ == 0)
+ return (0);
+ }
+
+--- a/lib/glob/glob.c
++++ b/lib/glob/glob.c
+@@ -1061,7 +1061,7 @@ glob_filename (pathname, flags)
+ char *directory_name, *filename, *dname, *fn;
+ unsigned int directory_len;
+ int free_dirname; /* flag */
+- int dflags;
++ int dflags, hasglob;
+
+ result = (char **) malloc (sizeof (char *));
+ result_size = 1;
+@@ -1110,9 +1110,12 @@ glob_filename (pathname, flags)
+ free_dirname = 1;
+ }
+
++ hasglob = 0;
+ /* If directory_name contains globbing characters, then we
+- have to expand the previous levels. Just recurse. */
+- if (directory_len > 0 && glob_pattern_p (directory_name))
++ have to expand the previous levels. Just recurse.
++ If glob_pattern_p returns != [0,1] we have a pattern that has backslash
++ quotes but no unquoted glob pattern characters. We dequote it below. */
++ if (directory_len > 0 && (hasglob = glob_pattern_p (directory_name)) == 1)
+ {
+ char **directories, *d, *p;
+ register unsigned int i;
+@@ -1175,7 +1178,7 @@ glob_filename (pathname, flags)
+ if (d[directory_len - 1] == '/')
+ d[directory_len - 1] = '\0';
+
+- directories = glob_filename (d, dflags);
++ directories = glob_filename (d, dflags|GX_RECURSE);
+
+ if (free_dirname)
+ {
+@@ -1332,6 +1335,20 @@ only_filename:
+ free (directory_name);
+ return (NULL);
+ }
++ /* If we have a directory name with quoted characters, and we are
++ being called recursively to glob the directory portion of a pathname,
++ we need to dequote the directory name before returning it so the
++ caller can read the directory */
++ if (directory_len > 0 && hasglob == 2 && (flags & GX_RECURSE) != 0)
++ {
++ dequote_pathname (directory_name);
++ directory_len = strlen (directory_name);
++ }
++
++ /* We could check whether or not the dequoted directory_name is a
++ directory and return it here, returning the original directory_name
++ if not, but we don't do that yet. I'm not sure it matters. */
++
+ /* Handle GX_MARKDIRS here. */
+ result[0] = (char *) malloc (directory_len + 1);
+ if (result[0] == NULL)
+--- a/lib/glob/glob.h
++++ b/lib/glob/glob.h
+@@ -30,6 +30,7 @@
+ #define GX_NULLDIR 0x100 /* internal -- no directory preceding pattern */
+ #define GX_ADDCURDIR 0x200 /* internal -- add passed directory name */
+ #define GX_GLOBSTAR 0x400 /* turn on special handling of ** */
++#define GX_RECURSE 0x800 /* internal -- glob_filename called recursively */
+
+ extern int glob_pattern_p __P((const char *));
+ extern char **glob_vector __P((char *, char *, int));
+--- a/lib/glob/glob_loop.c
++++ b/lib/glob/glob_loop.c
+@@ -26,10 +26,10 @@ INTERNAL_GLOB_PATTERN_P (pattern)
+ {
+ register const GCHAR *p;
+ register GCHAR c;
+- int bopen;
++ int bopen, bsquote;
+
+ p = pattern;
+- bopen = 0;
++ bopen = bsquote = 0;
+
+ while ((c = *p++) != L('\0'))
+ switch (c)
+@@ -55,13 +55,22 @@ INTERNAL_GLOB_PATTERN_P (pattern)
+
+ case L('\\'):
+ /* Don't let the pattern end in a backslash (GMATCH returns no match
+- if the pattern ends in a backslash anyway), but otherwise return 1,
+- since the matching engine uses backslash as an escape character
+- and it can be removed. */
+- return (*p != L('\0'));
++ if the pattern ends in a backslash anyway), but otherwise note that
++ we have seen this, since the matching engine uses backslash as an
++ escape character and it can be removed. We return 2 later if we
++ have seen only backslash-escaped characters, so interested callers
++ know they can shortcut and just dequote the pathname. */
++ if (*p != L('\0'))
++ {
++ p++;
++ bsquote = 1;
++ continue;
++ }
++ else /* (*p == L('\0')) */
++ return 0;
+ }
+
+- return 0;
++ return bsquote ? 2 : 0;
+ }
+
+ #undef INTERNAL_GLOB_PATTERN_P
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
+ looks for to find the patch level (for the sccs version string). */
+
+-#define PATCHLEVEL 2
++#define PATCHLEVEL 3
+
+ #endif /* _PATCHLEVEL_H_ */
+--- a/pathexp.c
++++ b/pathexp.c
+@@ -65,11 +65,11 @@ unquoted_glob_pattern_p (string)
+ {
+ register int c;
+ char *send;
+- int open;
++ int open, bsquote;
+
+ DECLARE_MBSTATE;
+
+- open = 0;
++ open = bsquote = 0;
+ send = string + strlen (string);
+
+ while (c = *string++)
+@@ -100,7 +100,14 @@ unquoted_glob_pattern_p (string)
+ can be removed by the matching engine, so we have to run it through
+ globbing. */
+ case '\\':
+- return (*string != 0);
++ if (*string != '\0' && *string != '/')
++ {
++ bsquote = 1;
++ string++;
++ continue;
++ }
++ else if (*string == 0)
++ return (0);
+
+ case CTLESC:
+ if (*string++ == '\0')
+@@ -117,7 +124,8 @@ unquoted_glob_pattern_p (string)
+ ADVANCE_CHAR_P (string, send - string);
+ #endif
+ }
+- return (0);
++
++ return (bsquote ? 2 : 0);
+ }
+
+ /* Return 1 if C is a character that is `special' in a POSIX ERE and needs to
diff --git a/debian/patches/bashbug-editor.diff b/debian/patches/bashbug-editor.diff
new file mode 100644
index 0000000..3b751b6
--- /dev/null
+++ b/debian/patches/bashbug-editor.diff
@@ -0,0 +1,12 @@
+# DP: send bug reports to Debian bash maintainer too.
+
+--- a/support/bashbug.sh
++++ b/support/bashbug.sh
+@@ -117,6 +117,7 @@
+ esac ;;
+ esac
+
++BUGBASH="${BUGBASH},bash@packages.debian.org"
+ BUGADDR="${1-$BUGBASH}"
+
+ if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
diff --git a/debian/patches/bzero.diff b/debian/patches/bzero.diff
new file mode 100644
index 0000000..653ed3d
--- /dev/null
+++ b/debian/patches/bzero.diff
@@ -0,0 +1,13 @@
+--- a/lib/sh/oslib.c
++++ b/lib/sh/oslib.c
+@@ -180,8 +180,8 @@
+ # endif
+ void
+ bzero (s, n)
+- char *s;
+- int n;
++ void *s;
++ size_t n;
+ {
+ register int i;
+ register char *r;
diff --git a/debian/patches/deb-bash-config.diff b/debian/patches/deb-bash-config.diff
new file mode 100644
index 0000000..619f47f
--- /dev/null
+++ b/debian/patches/deb-bash-config.diff
@@ -0,0 +1,56 @@
+# DP: Changed compile time configuration options:
+# DP:
+# DP: - Set the default path to comply with Debian policy
+# DP:
+# DP: - Enable System-wide .bashrc file for interactive shells.
+# DP:
+# DP: - Enable System-wide .bash.logout file for interactive shells.
+# DP:
+# DP: - make non-interactive shells begun with argv[0][0] == '-'
+# DP: run the startup files when not in posix mode.
+# DP:
+# DP: - try to check whether bash is being run by sshd and source
+# DP: the .bashrc if so (like the rshd behavior).
+# DP:
+# DP: - don't define a default DEFAULT_MAIL_DIRECTORY, because it
+# DP: can cause a timeout on NFS mounts.
+
+Index: b/config-bot.h
+===================================================================
+--- a/config-bot.h
++++ b/config-bot.h
+@@ -200,4 +200,4 @@
+ /******************************************************************/
+
+ /* If you don't want bash to provide a default mail file to check. */
+-/* #undef DEFAULT_MAIL_DIRECTORY */
++#undef DEFAULT_MAIL_DIRECTORY
+Index: b/config-top.h
+===================================================================
+--- a/config-top.h
++++ b/config-top.h
+@@ -91,20 +91,20 @@
+ #define DEFAULT_BASHRC "~/.bashrc"
+
+ /* System-wide .bashrc file for interactive shells. */
+-/* #define SYS_BASHRC "/etc/bash.bashrc" */
++#define SYS_BASHRC "/etc/bash.bashrc"
+
+ /* System-wide .bash_logout for login shells. */
+-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
++#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
+
+ /* Define this to make non-interactive shells begun with argv[0][0] == '-'
+ run the startup files when not in posix mode. */
+-/* #define NON_INTERACTIVE_LOGIN_SHELLS */
++#define NON_INTERACTIVE_LOGIN_SHELLS
+
+ /* Define this if you want bash to try to check whether it's being run by
+ sshd and source the .bashrc if so (like the rshd behavior). This checks
+ for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
+ which can be fooled under certain not-uncommon circumstances. */
+-/* #define SSH_SOURCE_BASHRC */
++#define SSH_SOURCE_BASHRC
+
+ /* Define if you want the case-capitalizing operators (~[~]) and the
+ `capcase' variable attribute (declare -c). */
diff --git a/debian/patches/deb-examples.diff b/debian/patches/deb-examples.diff
new file mode 100644
index 0000000..807256c
--- /dev/null
+++ b/debian/patches/deb-examples.diff
@@ -0,0 +1,16 @@
+# DP: document readline header location on Debian systems
+
+Index: b/examples/loadables/README
+===================================================================
+--- a/examples/loadables/README
++++ b/examples/loadables/README
+@@ -38,6 +38,9 @@ rest of the example builtins. It's inten
+ that can be modified or included to help you build your own loadables
+ without having to search for the right CFLAGS and LDFLAGS.
+
++On Debian GNU/Linux systems, the bash headers are in /usr/include/bash.
++The appropriate options are already set in the example Makefile.
++
+ basename.c Return non-directory portion of pathname.
+ cat.c cat(1) replacement with no options - the way cat was intended.
+ dirname.c Return directory portion of pathname.
diff --git a/debian/patches/exec-redirections-doc.diff b/debian/patches/exec-redirections-doc.diff
new file mode 100644
index 0000000..d033511
--- /dev/null
+++ b/debian/patches/exec-redirections-doc.diff
@@ -0,0 +1,29 @@
+Index: b/doc/bash.1
+===================================================================
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -3914,6 +3914,10 @@ A failure to open or create a file cause
+ Redirections using file descriptors greater than 9 should be used with
+ care, as they may conflict with file descriptors the shell uses
+ internally.
++.PP
++Note that the
++.B exec
++builtin command can make redirections take effect in the current shell.
+ .SS Redirecting Input
+ .PP
+ Redirection of input causes the file whose name results from
+Index: b/doc/bashref.texi
+===================================================================
+--- a/doc/bashref.texi
++++ b/doc/bashref.texi
+@@ -2743,6 +2743,9 @@ Redirections using file descriptors grea
+ care, as they may conflict with file descriptors the shell uses
+ internally.
+
++Note that the @code{exec} builtin command can make redirections take
++effect in the current shell.
++
+ @subsection Redirecting Input
+ Redirection of input causes the file whose name results from
+ the expansion of @var{word}
diff --git a/debian/patches/input-err.diff b/debian/patches/input-err.diff
new file mode 100644
index 0000000..874d3e2
--- /dev/null
+++ b/debian/patches/input-err.diff
@@ -0,0 +1,15 @@
+# DP: Define PGRP_PIPE to avoid race condition.
+
+Index: b/input.c
+===================================================================
+--- a/input.c
++++ b/input.c
+@@ -517,7 +517,7 @@ b_fill_buffer (bp)
+ if (nr == 0)
+ bp->b_flag |= B_EOF;
+ else
+- bp->b_flag |= B_ERROR;
++ fatal_error("error reading input file: %s", strerror(errno));
+ return (EOF);
+ }
+
diff --git a/debian/patches/man-arithmetic.diff b/debian/patches/man-arithmetic.diff
new file mode 100644
index 0000000..8489316
--- /dev/null
+++ b/debian/patches/man-arithmetic.diff
@@ -0,0 +1,16 @@
+# DP: document deprecated syntax for arithmetic evaluation.
+
+Index: b/doc/bash.1
+===================================================================
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -3392,6 +3392,9 @@ and the substitution of the result. The
+ \fB$((\fP\fIexpression\fP\fB))\fP
+ .RE
+ .PP
++The old format \fB$[\fP\fIexpression\fP\fB]\fP is deprecated and will
++be removed in upcoming versions of bash.
++.PP
+ The
+ .I expression
+ is treated as if it were within double quotes, but a double quote
diff --git a/debian/patches/man-bashlogout.diff b/debian/patches/man-bashlogout.diff
new file mode 100644
index 0000000..31cae04
--- /dev/null
+++ b/debian/patches/man-bashlogout.diff
@@ -0,0 +1,14 @@
+# DP: document /etc/bash.bashrc in bash man page
+
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -10897,6 +10897,9 @@ The systemwide initialization file, exec
+ .FN /etc/bash.bashrc
+ The systemwide per-interactive-shell startup file
+ .TP
++.FN /etc/bash.bash.logout
++The systemwide login shell cleanup file, executed when a login shell exits
++.TP
+ .FN ~/.bash_profile
+ The personal initialization file, executed for login shells
+ .TP
diff --git a/debian/patches/man-bashrc.diff b/debian/patches/man-bashrc.diff
new file mode 100644
index 0000000..55ad888
--- /dev/null
+++ b/debian/patches/man-bashrc.diff
@@ -0,0 +1,64 @@
+# DP: document /etc/bash.bashrc in bash man page
+
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -187,7 +187,9 @@ Display a usage message on standard outp
+ .PD
+ Execute commands from
+ .I file
+-instead of the standard personal initialization file
++instead of the system wide initialization file
++.I /etc/bash.bashrc
++and the standard personal initialization file
+ .I ~/.bashrc
+ if the shell is interactive (see
+ .SM
+@@ -218,7 +220,9 @@ reads these files when it is invoked as
+ below).
+ .TP
+ .B \-\-norc
+-Do not read and execute the personal initialization file
++Do not read and execute the system wide initialization file
++.I /etc/bash.bashrc
++and the personal initialization file
+ .I ~/.bashrc
+ if the shell is interactive.
+ This option is on by default if the shell is invoked as
+@@ -333,13 +337,15 @@ exists.
+ .PP
+ When an interactive shell that is not a login shell is started,
+ .B bash
+-reads and executes commands from \fI~/.bashrc\fP, if that file exists.
++reads and executes commands from \fI/etc/bash.bashrc\fP and \fI~/.bashrc\fP,
++if these files exist.
+ This may be inhibited by using the
+ .B \-\-norc
+ option.
+ The \fB\-\-rcfile\fP \fIfile\fP option will force
+ .B bash
+-to read and execute commands from \fIfile\fP instead of \fI~/.bashrc\fP.
++to read and execute commands from \fIfile\fP instead of
++\fI/etc/bash.bashrc\fP and \fI~/.bashrc\fP.
+ .PP
+ When
+ .B bash
+@@ -425,7 +431,8 @@ daemon, usually \fIrshd\fP, or the secur
+ If
+ .B bash
+ determines it is being run in this fashion, it reads and executes
+-commands from \fI~/.bashrc\fP, if that file exists and is readable.
++commands from \fI~/.bashrc\fP and \fI~/.bashrc\fP, if these files
++exist and are readable.
+ It will not do this if invoked as \fBsh\fP.
+ The
+ .B \-\-norc
+@@ -10887,6 +10894,9 @@ The \fBbash\fP executable
+ .FN /etc/profile
+ The systemwide initialization file, executed for login shells
+ .TP
++.FN /etc/bash.bashrc
++The systemwide per-interactive-shell startup file
++.TP
+ .FN ~/.bash_profile
+ The personal initialization file, executed for login shells
+ .TP
diff --git a/debian/patches/man-fignore.diff b/debian/patches/man-fignore.diff
new file mode 100644
index 0000000..8fa51f3
--- /dev/null
+++ b/debian/patches/man-fignore.diff
@@ -0,0 +1,17 @@
+# DP: bash(1): mention quoting when assigning to FIGNORE
+
+Index: b/doc/bash.1
+===================================================================
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -2115,7 +2115,9 @@ A filename whose suffix matches one of t
+ is excluded from the list of matched filenames.
+ A sample value is
+ .if t \f(CW".o:~"\fP.
+-.if n ".o:~".
++.if n ".o:~"
++(Quoting is needed when assigning a value to this variable,
++which contains tildes).
+ .TP
+ .B FUNCNEST
+ If set to a numeric value greater than 0, defines a maximum function
diff --git a/debian/patches/man-macro-warnings.diff b/debian/patches/man-macro-warnings.diff
new file mode 100644
index 0000000..a92b71d
--- /dev/null
+++ b/debian/patches/man-macro-warnings.diff
@@ -0,0 +1,53 @@
+# DP: Move definition of the macro "FN" out of the region of the "ig"
+# DP: macro. Define macros and registers "zZ" and "zY".
+
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -8,6 +8,22 @@
+ .\" Last Change: Fri Dec 7 09:48:47 EST 2018
+ .\"
+ .\" bash_builtins, strip all but Built-Ins section
++.de zZ
++..
++.de zY
++..
++.\"
++.\" File Name macro. This used to be `.PN', for Path Name,
++.\" but Sun doesn't seem to like that very much.
++.\"
++.de FN
++\fI\|\\$1\|\fP
++..
++.\" Number register zZ is defined in bash-builtins(7)
++.\" Number register zY is defined in rbash(1)
++.\" This man-page is included in them
++.if !rzZ .nr zZ 0 \" avoid a warning about an undefined register
++.if !rzY .nr zY 0 \" avoid a warning about an undefined register
+ .if \n(zZ=1 .ig zZ
+ .if \n(zY=1 .ig zY
+ .TH BASH 1 "2018 December 7" "GNU Bash 5.0"
+@@ -36,13 +52,6 @@
+ .\" .el \\*(]X\h|\\n()Iu+\\n()Ru\c
+ .\" .}f
+ .\" ..
+-.\"
+-.\" File Name macro. This used to be `.PN', for Path Name,
+-.\" but Sun doesn't seem to like that very much.
+-.\"
+-.de FN
+-\fI\|\\$1\|\fP
+-..
+ .SH NAME
+ bash \- GNU Bourne-Again SHell
+ .SH SYNOPSIS
+@@ -2417,8 +2426,8 @@ and is set by the administrator who inst
+ .BR bash .
+ A common value is
+ .na
+-.if t \f(CW/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin\fP.
+-.if n ``/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.
++.if t \f(CW/usr/local/bin:\:/usr/local/sbin:\:/usr/bin:\:/usr/sbin:\:/bin:\:/sbin\fP.
++.if n ``/usr/local/bin:\:/usr/local/sbin:\:/usr/bin:\:/usr/sbin:\:/bin:\:/sbin''.
+ .ad
+ .TP
+ .B POSIXLY_CORRECT
diff --git a/debian/patches/man-nocaseglob.diff b/debian/patches/man-nocaseglob.diff
new file mode 100644
index 0000000..97991df
--- /dev/null
+++ b/debian/patches/man-nocaseglob.diff
@@ -0,0 +1,17 @@
+# DP: Clarify documentation about case-insensitive pathname expansion
+
+Index: b/doc/bash.1
+===================================================================
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -3567,6 +3567,10 @@ If the shell option
+ .B nocaseglob
+ is enabled, the match is performed without regard to the case
+ of alphabetic characters.
++Note that when using range expressions like
++[a-z] (see below), letters of the other case may be included,
++depending on the setting of
++.B LC_COLLATE.
+ When a pattern is used for pathname expansion,
+ the character
+ .B ``.''
diff --git a/debian/patches/man-test.diff b/debian/patches/man-test.diff
new file mode 100644
index 0000000..ca7a5a1
--- /dev/null
+++ b/debian/patches/man-test.diff
@@ -0,0 +1,17 @@
+# DP: document conditional file expressions acting on the target of
+# DP: symbolic links as well (except -h, -L).
+
+Index: b/builtins/test.def
+===================================================================
+--- a/builtins/test.def
++++ b/builtins/test.def
+@@ -64,6 +64,9 @@ File operators:
+
+ FILE1 -ef FILE2 True if file1 is a hard link to file2.
+
++All file operators except -h and -L are acting on the target of a symbolic
++link, not on the symlink itself, if FILE is a symbolic link.
++
+ String operators:
+
+ -z STRING True if string is empty.
diff --git a/debian/patches/man-test2.diff b/debian/patches/man-test2.diff
new file mode 100644
index 0000000..1833a7a
--- /dev/null
+++ b/debian/patches/man-test2.diff
@@ -0,0 +1,40 @@
+# DP: Document handling of parameters of the test builtin.
+
+--- a/builtins/test.def
++++ b/builtins/test.def
+@@ -100,6 +100,9 @@ Arithmetic binary operators return true
+ less-than, less-than-or-equal, greater-than, or greater-than-or-equal
+ than ARG2.
+
++See the bash manual page bash(1) for the handling of parameters (i.e.
++missing parameters).
++
+ Exit Status:
+ Returns success if EXPR evaluates to true; fails if EXPR evaluates to
+ false or an invalid argument is given.
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -726,6 +726,10 @@ as primaries.
+ .if n .sp 1
+ When used with \fB[[\fP, the \fB<\fP and \fB>\fP operators sort
+ lexicographically using the current locale.
++.PP
++See the description of the \fItest\fP builtin command (section SHELL
++BUILTIN COMMANDS below) for the handling of parameters (i.e.
++missing parameters).
+ .if t .sp 0.5
+ .if n .sp 1
+ When the \fB==\fP and \fB!=\fP operators are used, the string to the
+--- a/doc/bashref.texi
++++ b/doc/bashref.texi
+@@ -6855,6 +6855,10 @@ The @code{test} command uses ASCII order
+ Unless otherwise specified, primaries that operate on files follow symbolic
+ links and operate on the target of the link, rather than the link itself.
+
++See the description of the @code{test} builtin command (section
++@pxref{Bash Builtins} below) for the handling of parameters
++(i.e. missing parameters).
++
+ @table @code
+ @item -a @var{file}
+ True if @var{file} exists.
diff --git a/debian/patches/man-vx-opts.diff b/debian/patches/man-vx-opts.diff
new file mode 100644
index 0000000..9354fe6
--- /dev/null
+++ b/debian/patches/man-vx-opts.diff
@@ -0,0 +1,19 @@
+# DP: document -v / -x options
+
+Index: b/doc/bash.1
+===================================================================
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -131,6 +131,12 @@ This option allows the positional parame
+ when invoking an interactive shell or when reading input
+ through a pipe.
+ .TP
++.B \-v
++Print shell input lines as they are read.
++.TP
++.B \-x
++Print commands and their arguments as they are executed.
++.TP
+ .B \-D
+ A list of all double-quoted strings preceded by \fB$\fP
+ is printed on the standard output.
diff --git a/debian/patches/no-brk-caching.diff b/debian/patches/no-brk-caching.diff
new file mode 100644
index 0000000..dc4ba85
--- /dev/null
+++ b/debian/patches/no-brk-caching.diff
@@ -0,0 +1,47 @@
+# DP: Don't cache the value of brk between sbrk calls.
+
+--- a/lib/malloc/malloc.c
++++ b/lib/malloc/malloc.c
+@@ -227,8 +227,6 @@
+ static int pagebucket; /* bucket for requests a page in size */
+ static int maxbuck; /* highest bucket receiving allocation request. */
+
+-static char *memtop; /* top of heap */
+-
+ static const unsigned long binsizes[NBUCKETS] = {
+ 8UL, 16UL, 32UL, 64UL, 128UL, 256UL, 512UL, 1024UL, 2048UL, 4096UL,
+ 8192UL, 16384UL, 32768UL, 65536UL, 131072UL, 262144UL, 524288UL,
+@@ -538,7 +536,6 @@
+ siz = binsize (nu);
+ /* Should check for errors here, I guess. */
+ sbrk (-siz);
+- memtop -= siz;
+
+ #ifdef MALLOC_STATS
+ _mstats.nsbrk++;
+@@ -633,8 +630,6 @@
+ if ((long)mp == -1)
+ goto morecore_done;
+
+- memtop += sbrk_amt;
+-
+ /* shouldn't happen, but just in case -- require 8-byte alignment */
+ if ((long)mp & MALIGN_MASK)
+ {
+@@ -684,7 +679,7 @@
+ Some of this partial page will be wasted space, but we'll use as
+ much as we can. Once we figure out how much to advance the break
+ pointer, go ahead and do it. */
+- memtop = curbrk = sbrk (0);
++ curbrk = sbrk (0);
+ sbrk_needed = pagesz - ((long)curbrk & (pagesz - 1)); /* sbrk(0) % pagesz */
+ if (sbrk_needed < 0)
+ sbrk_needed += pagesz;
+@@ -699,7 +694,6 @@
+ curbrk = sbrk (sbrk_needed);
+ if ((long)curbrk == -1)
+ return -1;
+- memtop += sbrk_needed;
+
+ /* Take the memory which would otherwise be wasted and populate the most
+ popular bin (2 == 32 bytes) with it. Add whatever we need to curbrk
diff --git a/debian/patches/po-de-fix.diff b/debian/patches/po-de-fix.diff
new file mode 100644
index 0000000..f9b5354
--- /dev/null
+++ b/debian/patches/po-de-fix.diff
@@ -0,0 +1,11 @@
+--- a/po/de.po
++++ b/po/de.po
+@@ -2985,7 +2985,7 @@ msgstr ""
+ "Führt ein einfaches Kommando aus oder zeigt Informationen über Kommandos "
+ "an.\n"
+ "\n"
+-" Führt das Kommando mit den angegebeneb Argumenten aus, ohne\n"
++" Führt das Kommando mit den angegebenen Argumenten aus, ohne\n"
+ " Shell-Funktion nachzuschlagen oder zeigt Informationen über die\n"
+ " Kommandos an. Dadurch können auch dann Kommandos ausgeführt\n"
+ " werden, wenn eine Shell-Funktion gleichen Namens existiert.\n"
diff --git a/debian/patches/rbash-manpage.diff b/debian/patches/rbash-manpage.diff
new file mode 100644
index 0000000..0103e61
--- /dev/null
+++ b/debian/patches/rbash-manpage.diff
@@ -0,0 +1,12 @@
+# DP: doc/rbash.1: fix bash(1) reference
+
+--- a/doc/rbash.1
++++ b/doc/rbash.1
+@@ -3,6 +3,6 @@
+ rbash \- restricted bash, see \fBbash\fR(1)
+ .SH RESTRICTED SHELL
+ .nr zY 1
+-.so bash.1
++.so man1/bash.1
+ .SH SEE ALSO
+ bash(1)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..151fc2b
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,25 @@
+bash50-001.diff
+bash50-002.diff
+bash50-003.diff
+bashbug-editor.diff
+deb-bash-config.diff
+deb-examples.diff
+man-arithmetic.diff
+man-fignore.diff
+man-bashrc.diff
+man-bashlogout.diff
+man-nocaseglob.diff
+man-test.diff
+man-test2.diff
+rbash-manpage.diff
+bash-default-editor.diff
+input-err.diff
+exec-redirections-doc.diff
+bash-aliases-repeat.diff
+# no-brk-caching.diff
+use-system-texi2html.diff
+bzero.diff
+man-macro-warnings.diff
+po-de-fix.diff
+man-vx-opts.diff
+wait-builtin-avoid-hanging-on-inherited-children.diff
diff --git a/debian/patches/use-system-texi2html.diff b/debian/patches/use-system-texi2html.diff
new file mode 100644
index 0000000..274d9e2
--- /dev/null
+++ b/debian/patches/use-system-texi2html.diff
@@ -0,0 +1,15 @@
+Index: b/doc/Makefile.in
+===================================================================
+--- a/doc/Makefile.in
++++ b/doc/Makefile.in
+@@ -70,8 +70,8 @@
+ TEX = tex
+
+ MAKEINFO = makeinfo
+-TEXI2DVI = ${SUPPORT_SRCDIR}/texi2dvi
+-TEXI2HTML = ${SUPPORT_SRCDIR}/texi2html
++TEXI2DVI = texi2dvi
++TEXI2HTML = texi2html
+ MAN2HTML = ${BUILD_DIR}/support/man2html
+ HTMLPOST = ${srcdir}/htmlpost.sh
+ INFOPOST = ${srcdir}/infopost.sh
diff --git a/debian/patches/wait-builtin-avoid-hanging-on-inherited-children.diff b/debian/patches/wait-builtin-avoid-hanging-on-inherited-children.diff
new file mode 100644
index 0000000..32daf39
--- /dev/null
+++ b/debian/patches/wait-builtin-avoid-hanging-on-inherited-children.diff
@@ -0,0 +1,26 @@
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+Date: Mon, 15 Apr 2019 18:26:33 -0400
+Subject: wait builtin: avoid hanging on inherited children
+
+in https://lists.gnu.org/archive/html/bug-bash/2019-04/msg00096.html,
+Chet Ramey proposes this fix to avoid the wait builtin hanging on
+previously unknown children.
+
+This addresses debian bug #920455.
+---
+ jobs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/jobs.c b/jobs.c
+index ce2bdf2..2c24537 100644
+--- a/jobs.c
++++ b/jobs.c
+@@ -2488,7 +2488,7 @@ wait_for_background_pids ()
+ r = wait_for (last_procsub_child->pid);
+ wait_procsubs ();
+ reap_procsubs ();
+-#if 1
++#if 0
+ /* We don't want to wait indefinitely if we have stopped children. */
+ /* XXX - should add a loop that goes through the list of process
+ substitutions and waits for each proc in turn before this code. */