summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/bash-aliases-repeat.diff28
-rw-r--r--debian/patches/bash-default-editor.diff31
-rw-r--r--debian/patches/bash51-001.diff62
-rw-r--r--debian/patches/bash51-002.diff43
-rw-r--r--debian/patches/bash51-003.diff41
-rw-r--r--debian/patches/bash51-004.diff112
-rw-r--r--debian/patches/bash51-014.diff26
-rw-r--r--debian/patches/bashbug-editor.diff12
-rw-r--r--debian/patches/bzero.diff13
-rw-r--r--debian/patches/deb-bash-config.diff52
-rw-r--r--debian/patches/deb-examples.diff16
-rw-r--r--debian/patches/exec-redirections-doc.diff25
-rw-r--r--debian/patches/input-err.diff15
-rw-r--r--debian/patches/man-arithmetic.diff14
-rw-r--r--debian/patches/man-bashlogout.diff14
-rw-r--r--debian/patches/man-bashrc.diff64
-rw-r--r--debian/patches/man-fignore.diff15
-rw-r--r--debian/patches/man-macro-warnings.diff53
-rw-r--r--debian/patches/man-nocaseglob.diff15
-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/rbash-manpage.diff12
-rw-r--r--debian/patches/series25
-rw-r--r--debian/patches/use-system-texi2html.diff15
26 files changed, 826 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..d76ef89
--- /dev/null
+++ b/debian/patches/bash-default-editor.diff
@@ -0,0 +1,31 @@
+# DP: Use `command -v editor`, as an editor, if available.
+
+--- a/bashline.c
++++ b/bashline.c
+@@ -921,8 +921,8 @@ hostnames_matching (text)
+ 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
+--- a/builtins/fc.def
++++ b/builtins/fc.def
+@@ -171,11 +171,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/bash51-001.diff b/debian/patches/bash51-001.diff
new file mode 100644
index 0000000..8f700c3
--- /dev/null
+++ b/debian/patches/bash51-001.diff
@@ -0,0 +1,62 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.1
+Patch-ID: bash51-001
+
+Bug-Reported-by: Fazal Majid <fazal@majid.org>
+Bug-Reference-ID: <DEAB7D2C-C626-450C-B2E5-281AFF2D26D4@majid.org>
+Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00000.html
+
+Bug-Description:
+
+There is a missing dependency on a constructed file, which can cause highly
+parellel builds to fail.
+
+--- a/builtins/Makefile.in
++++ b/builtins/Makefile.in
+@@ -361,7 +361,7 @@ evalstring.o: $(topdir)/dispose_cmd.h $(
+ evalstring.o: $(topdir)/externs.h $(topdir)/jobs.h $(topdir)/builtins.h
+ evalstring.o: $(topdir)/flags.h $(topdir)/input.h $(topdir)/execute_cmd.h
+ evalstring.o: $(topdir)/bashhist.h $(srcdir)/common.h
+-evalstring.o: $(topdir)/trap.h $(topdir)/redir.h ../pathnames.h
++evalstring.o: $(topdir)/trap.h $(topdir)/redir.h ../pathnames.h ./builtext.h
+ #evalstring.o: $(topdir)/y.tab.h
+ getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
+ getopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h $(topdir)/command.h
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -1315,6 +1315,7 @@ bashline.o: trap.h flags.h assoc.h $(BAS
+ bashline.o: $(DEFSRC)/common.h $(GLOB_LIBSRC)/glob.h alias.h
+ bashline.o: pcomplete.h ${BASHINCDIR}/chartypes.h input.h
+ bashline.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
++bashline.o: ${DEFDIR}/builtext.h
+ bracecomp.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
+ bracecomp.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h
+ bracecomp.o: command.h ${BASHINCDIR}/stdc.h error.h
+@@ -1435,6 +1436,7 @@ builtins/evalstring.o: quit.h unwind_pro
+ builtins/evalstring.o: dispose_cmd.h make_cmd.h subst.h externs.h
+ builtins/evalstring.o: jobs.h builtins.h flags.h input.h execute_cmd.h
+ builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h pathnames.h
++builtins/evalstring.o: ${DEFDIR}/builtext.h
+ builtins/getopt.o: config.h ${BASHINCDIR}/memalloc.h
+ builtins/getopt.o: shell.h syntax.h bashjmp.h command.h general.h xmalloc.h error.h
+ builtins/getopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -1,6 +1,6 @@
+ /* patchlevel.h -- current bash patch level */
+
+-/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
++/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+@@ -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/bash51-002.diff b/debian/patches/bash51-002.diff
new file mode 100644
index 0000000..7f6820e
--- /dev/null
+++ b/debian/patches/bash51-002.diff
@@ -0,0 +1,43 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.1
+Patch-ID: bash51-002
+
+Bug-Reported-by: oguzismailuysal@gmail.com
+Bug-Reference-ID: <CAH7i3LoHFUa4aSF5-AD2r80HG-p-YzD_9ZxomarZkhP8NMq63g@mail.gmail.com>
+Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00037.html
+
+Bug-Description:
+
+If there are no jobs, and the `-n' and `-p' options are both supplied to
+`wait', bash can assign a value to the variable name specified with `-p'
+instead of leaving it unset.
+
+--- a/builtins/wait.def
++++ b/builtins/wait.def
+@@ -213,11 +213,11 @@ wait_builtin (list)
+ }
+
+ status = wait_for_any_job (wflags, &pstat);
+- if (status < 0)
+- status = 127;
+-
+ if (vname && status >= 0)
+ bind_var_to_int (vname, pstat.pid);
++
++ if (status < 0)
++ status = 127;
+ if (list)
+ unset_waitlist ();
+ WAIT_RETURN (status);
+--- 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_ */
diff --git a/debian/patches/bash51-003.diff b/debian/patches/bash51-003.diff
new file mode 100644
index 0000000..8d4600f
--- /dev/null
+++ b/debian/patches/bash51-003.diff
@@ -0,0 +1,41 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.1
+Patch-ID: bash51-003
+
+Bug-Reported-by: oguzismailuysal@gmail.com
+Bug-Reference-ID: <CAH7i3LpG91BnNcDtaTUm2Ph7a+PnJkuh6nAc87cVL7_38tOaMQ@mail.gmail.com>
+Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00050.html
+
+Bug-Description:
+
+Bash does not put a command substitution process that is started to perform an
+expansion in a child process into the right process group where it can receive
+keyboard-generated signals.
+
+--- 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/subst.c
++++ b/subst.c
+@@ -6356,8 +6356,10 @@ command_substitute (string, quoted, flag
+
+ #if defined (JOB_CONTROL)
+ old_pipeline_pgrp = pipeline_pgrp;
+- /* Don't reset the pipeline pgrp if we're already a subshell in a pipeline. */
+- if ((subshell_environment & SUBSHELL_PIPE) == 0)
++ /* Don't reset the pipeline pgrp if we're already a subshell in a pipeline or
++ we've already forked to run a disk command (and are expanding redirections,
++ for example). */
++ if ((subshell_environment & (SUBSHELL_FORK|SUBSHELL_PIPE)) == 0)
+ pipeline_pgrp = shell_pgrp;
+ cleanup_the_pipeline ();
+ #endif /* JOB_CONTROL */
diff --git a/debian/patches/bash51-004.diff b/debian/patches/bash51-004.diff
new file mode 100644
index 0000000..6ffc3bb
--- /dev/null
+++ b/debian/patches/bash51-004.diff
@@ -0,0 +1,112 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.1
+Patch-ID: bash51-004
+
+Bug-Reported-by: oguzismailuysal@gmail.com
+Bug-Reference-ID: <CAH7i3LoHGmwaghDpCWRUfcY04gQmeDTH3RiG=bf2b=KbU=gyhw@mail.gmail.com>
+Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00039.html
+
+Bug-Description:
+
+If a key-value compound array assignment to an associative array is supplied
+as an assignment statement argument to the `declare' command that declares the
+array, the assignment doesn't perform the correct word expansions.
+
+This patch makes key-value assignment and subscript assignment perform the
+same expansions when they're supplied as an argument to `declare'.
+
+--- a/arrayfunc.c
++++ b/arrayfunc.c
+@@ -597,6 +597,27 @@ assign_assoc_from_kvlist (var, nlist, h,
+ free (aval);
+ }
+ }
++
++/* Return non-zero if L appears to be a key-value pair associative array
++ compound assignment. */
++int
++kvpair_assignment_p (l)
++ WORD_LIST *l;
++{
++ return (l && (l->word->flags & W_ASSIGNMENT) == 0 && l->word->word[0] != '['); /*]*/
++}
++
++char *
++expand_and_quote_kvpair_word (w)
++ char *w;
++{
++ char *t, *r;
++
++ t = w ? expand_assignment_string_to_string (w, 0) : 0;
++ r = sh_single_quote (t ? t : "");
++ free (t);
++ return r;
++}
+ #endif
+
+ /* Callers ensure that VAR is not NULL. Associative array assignments have not
+@@ -640,7 +661,7 @@ assign_compound_array_list (var, nlist,
+ last_ind = (a && (flags & ASS_APPEND)) ? array_max_index (a) + 1 : 0;
+
+ #if ASSOC_KVPAIR_ASSIGNMENT
+- if (assoc_p (var) && nlist && (nlist->word->flags & W_ASSIGNMENT) == 0 && nlist->word->word[0] != '[') /*]*/
++ if (assoc_p (var) && kvpair_assignment_p (nlist))
+ {
+ iflags = flags & ~ASS_APPEND;
+ assign_assoc_from_kvlist (var, nlist, nhash, iflags);
+--- a/arrayfunc.h
++++ b/arrayfunc.h
+@@ -67,6 +67,9 @@ extern SHELL_VAR *assign_array_var_from_
+ extern char *expand_and_quote_assoc_word PARAMS((char *, int));
+ extern void quote_compound_array_list PARAMS((WORD_LIST *, int));
+
++extern int kvpair_assignment_p PARAMS((WORD_LIST *));
++extern char *expand_and_quote_kvpair_word PARAMS((char *));
++
+ extern int unbind_array_element PARAMS((SHELL_VAR *, char *, int));
+ extern int skipsubscript PARAMS((const char *, int, int));
+
+--- 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 3
++#define PATCHLEVEL 4
+
+ #endif /* _PATCHLEVEL_H_ */
+--- a/subst.c
++++ b/subst.c
+@@ -11604,6 +11604,7 @@ expand_oneword (value, flags)
+ {
+ WORD_LIST *l, *nl;
+ char *t;
++ int kvpair;
+
+ if (flags == 0)
+ {
+@@ -11618,11 +11619,21 @@ expand_oneword (value, flags)
+ {
+ /* Associative array */
+ l = parse_string_to_word_list (value, 1, "array assign");
++#if ASSOC_KVPAIR_ASSIGNMENT
++ kvpair = kvpair_assignment_p (l);
++#endif
++
+ /* For associative arrays, with their arbitrary subscripts, we have to
+ expand and quote in one step so we don't have to search for the
+ closing right bracket more than once. */
+ for (nl = l; nl; nl = nl->next)
+ {
++#if ASSOC_KVPAIR_ASSIGNMENT
++ if (kvpair)
++ /* keys and values undergo the same set of expansions */
++ t = expand_and_quote_kvpair_word (nl->word->word);
++ else
++#endif
+ if ((nl->word->flags & W_ASSIGNMENT) == 0)
+ t = sh_single_quote (nl->word->word ? nl->word->word : "");
+ else
diff --git a/debian/patches/bash51-014.diff b/debian/patches/bash51-014.diff
new file mode 100644
index 0000000..47dfe35
--- /dev/null
+++ b/debian/patches/bash51-014.diff
@@ -0,0 +1,26 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 5.1
+Patch-ID: bash51-014
+
+Bug-Reported-by: platon7pronko@gmail.com
+Bug-Reference-ID:
+Bug-Reference-URL: https://savannah.gnu.org/patch/?10035
+
+Bug-Description:
+
+Bash may produce corrupted input if a multibyte character spans a 512-byte
+boundary while reading the output of a command substitution.
+
+--- a/subst.c
++++ b/subst.c
+@@ -6242,7 +6242,7 @@ read_comsub (fd, quoted, flags, rflag)
+ /* read a multibyte character from buf */
+ /* punt on the hard case for now */
+ memset (&ps, '\0', sizeof (mbstate_t));
+- mblen = mbrtowc (&wc, bufp-1, bufn+1, &ps);
++ mblen = mbrtowc (&wc, bufp-1, bufn, &ps);
+ if (MB_INVALIDCH (mblen) || mblen == 0 || mblen == 1)
+ istring[istring_index++] = c;
+ else
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..c6f5142
--- /dev/null
+++ b/debian/patches/deb-bash-config.diff
@@ -0,0 +1,52 @@
+# 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.
+
+--- a/config-bot.h
++++ b/config-bot.h
+@@ -204,4 +204,4 @@
+ /******************************************************************/
+
+ /* If you don't want bash to provide a default mail file to check. */
+-/* #undef DEFAULT_MAIL_DIRECTORY */
++#undef DEFAULT_MAIL_DIRECTORY
+--- 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-toggling 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..a4e63e5
--- /dev/null
+++ b/debian/patches/exec-redirections-doc.diff
@@ -0,0 +1,25 @@
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -3999,6 +3999,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
+ Redirection of input causes the file whose name results from
+ the expansion of
+--- a/doc/bashref.texi
++++ b/doc/bashref.texi
+@@ -2794,6 +2794,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..8fc83f2
--- /dev/null
+++ b/debian/patches/man-arithmetic.diff
@@ -0,0 +1,14 @@
+# DP: document deprecated syntax for arithmetic evaluation.
+
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -3481,6 +3481,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..c89da10
--- /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
+@@ -11215,6 +11215,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..79c5598
--- /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
+@@ -11205,6 +11212,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..633515f
--- /dev/null
+++ b/debian/patches/man-fignore.diff
@@ -0,0 +1,15 @@
+# DP: bash(1): mention quoting when assigning to FIGNORE
+
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -2174,7 +2174,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..dd216a1
--- /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: Wed Sep 23 09:28:31 EDT 2020
+ .\"
+ .\" 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 "2020 October 29" "GNU Bash 5.1"
+@@ -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
+@@ -2473,8 +2482,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..d886dc8
--- /dev/null
+++ b/debian/patches/man-nocaseglob.diff
@@ -0,0 +1,15 @@
+# DP: Clarify documentation about case-insensitive pathname expansion
+
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -3653,6 +3653,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..07a5556
--- /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
+@@ -725,6 +725,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
+@@ -6954,6 +6954,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/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..79f764c
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,25 @@
+bash51-001.diff
+bash51-002.diff
+bash51-003.diff
+bash51-004.diff
+bash51-014.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
+man-vx-opts.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