diff --git a/bash-2.03-manual.patch b/bash-2.03-manual.patch
index 6c3ac2d..23863cf 100644
--- a/bash-2.03-manual.patch
+++ b/bash-2.03-manual.patch
@@ -5,10 +5,10 @@
  3 files changed, 18 insertions(+), 2 deletions(-)
 
 --- doc/bash.1
-+++ doc/bash.1	2016-09-16 10:36:46.667901616 +0000
-@@ -121,6 +121,12 @@ processing, then commands are read from
- This option allows the positional parameters to be set
- when invoking an interactive shell.
++++ doc/bash.1	2018-11-29 08:09:41.735675837 +0000
+@@ -122,6 +122,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.
@@ -19,7 +19,7 @@
  .B \-D
  A list of all double-quoted strings preceded by \fB$\fP
  is printed on the standard output.
-@@ -7038,6 +7044,11 @@ Apply the following `\fBs\fP' modifier o
+@@ -7294,6 +7300,11 @@ Apply the following `\fBs\fP' modifier o
  .SH "SHELL BUILTIN COMMANDS"
  .\" start of bash_builtins
  .zZ
@@ -31,7 +31,7 @@
  .PP
  Unless otherwise noted, each builtin command documented in this
  section as accepting options preceded by
-@@ -10432,6 +10443,11 @@ process or job waited for.
+@@ -10768,6 +10779,11 @@ process or job waited for.
  .SH "RESTRICTED SHELL"
  .\" rbash.1
  .zY
@@ -44,7 +44,7 @@
  If
  .B bash
 --- doc/builtins.1
-+++ doc/builtins.1	2016-09-16 10:36:46.667901616 +0000
++++ doc/builtins.1	2018-11-29 08:09:41.735675837 +0000
 @@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim
  ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
  .SH BASH BUILTIN COMMANDS
@@ -54,7 +54,7 @@
  .SH SEE ALSO
  bash(1), sh(1)
 --- doc/rbash.1
-+++ doc/rbash.1	2016-09-16 10:36:46.667901616 +0000
++++ doc/rbash.1	2018-11-29 08:09:41.735675837 +0000
 @@ -3,6 +3,6 @@
  rbash \- restricted bash, see \fBbash\fR(1)
  .SH RESTRICTED SHELL
diff --git a/bash-3.0-evalexp.patch b/bash-3.0-evalexp.patch
index be31276..026ba43 100644
--- a/bash-3.0-evalexp.patch
+++ b/bash-3.0-evalexp.patch
@@ -3,8 +3,8 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 --- expr.c
-+++ expr.c	2004-07-30 14:39:48.000000000 +0000
-@@ -466,8 +466,8 @@ expassign ()
++++ expr.c	2018-11-29 08:10:59.542212175 +0000
+@@ -512,8 +512,8 @@ expassign ()
    value = expcond ();
    if (curtok == EQ || curtok == OP_ASSIGN)
      {
diff --git a/bash-3.0-warn-locale.patch b/bash-3.0-warn-locale.patch
index dac6dcf..61b71d5 100644
--- a/bash-3.0-warn-locale.patch
+++ b/bash-3.0-warn-locale.patch
@@ -3,7 +3,7 @@
  1 file changed, 13 insertions(+)
 
 --- locale.c
-+++ locale.c	2004-09-03 10:56:10.000000000 +0000
++++ locale.c	2018-09-20 08:06:23.732593807 +0000
 @@ -33,6 +33,10 @@
  #include "bashintl.h"
  #include "bashansi.h"
@@ -15,7 +15,7 @@
  #include "chartypes.h"
  #include <errno.h>
  
-@@ -76,6 +80,15 @@ void
+@@ -77,6 +81,15 @@ void
  set_default_locale ()
  {
  #if defined (HAVE_SETLOCALE)
diff --git a/bash-3.2-printf.patch b/bash-3.2-printf.patch
index 4fdedcb..d38d958 100644
--- a/bash-3.2-printf.patch
+++ b/bash-3.2-printf.patch
@@ -3,7 +3,7 @@
  1 file changed, 10 insertions(+), 1 deletion(-)
 
 --- builtins/printf.def
-+++ builtins/printf.def	2006-07-27 15:11:19.000000000 +0000
++++ builtins/printf.def	2018-11-29 08:11:53.901189708 +0000
 @@ -54,6 +54,7 @@ error occurs.
  $END
  
@@ -12,7 +12,7 @@
  
  #include "../bashtypes.h"
  
-@@ -654,12 +655,20 @@ printf_builtin (list)
+@@ -662,12 +663,20 @@ printf_builtin (list)
  	    case 'A':
  #endif
  	      {
diff --git a/bash-4.0-security.patch b/bash-4.0-security.patch
index 97ec52d..dce90e9 100644
--- a/bash-4.0-security.patch
+++ b/bash-4.0-security.patch
@@ -1,19 +1,19 @@
 ---
- variables.c |   27 +++++++++++++++++++++++++++
- 1 file changed, 27 insertions(+)
+ variables.c |   35 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 35 insertions(+)
 
 --- variables.c
-+++ variables.c	2016-09-14 08:51:32.306631046 +0000
-@@ -1300,6 +1300,7 @@ static unsigned long rseed = 1;
- static int last_random_value;
- static int seeded_subshell = 0;
++++ variables.c	2018-12-21 13:24:48.757352405 +0000
+@@ -1324,6 +1324,7 @@ static int seeded_subshell = 0;
+ #  define BASH_RAND_MAX	0x7fffffff	/* 32 bits */
+ #endif
  
 +#if !defined(linux)
- /* A linear congruential random number generator based on the example
-    one in the ANSI C standard.  This one isn't very good, but a more
-    complicated one is overkill. */
-@@ -1344,6 +1345,32 @@ seedrand ()
-   sbrand (tv.tv_sec ^ tv.tv_usec ^ getpid ());
+ /* Returns a pseudo-random number between 0 and 32767. */
+ static int
+ brand ()
+@@ -1380,6 +1381,40 @@ seedrand ()
+ #endif
  }
  
 +#else
@@ -23,7 +23,7 @@
 +{
 +  if (rseed == 0)
 +    seedrand ();
-+  return rand() & 32767;
++  return ((unsigned int)(rand() & BASH_RAND_MAX));	/* was % BASH_RAND_MAX+1 */
 +}
 +
 +static void
@@ -37,8 +37,16 @@
 +seedrand (void)
 +{
 +  struct timeval tv;
++#ifdef _EXTENDTHIS
++  SHELL_VAR *v;
++#endif
 +  gettimeofday (&tv, NULL);
++#ifdef _EXTENDTHIS
++  v = find_variable ("BASH_VERSION");
++  sbrand (tv.tv_sec ^ tv.tv_usec ^ getpid () ^ ((u_bits32_t)&v & 0x7fffffff));
++#else
 +  srand (tv.tv_sec ^ tv.tv_usec ^ getpid ());
++#endif
 +}
 +#endif
 +
diff --git a/bash-4.0-setlocale.dif b/bash-4.0-setlocale.dif
index ecb5c6f..8c8ccd7 100644
--- a/bash-4.0-setlocale.dif
+++ b/bash-4.0-setlocale.dif
@@ -3,8 +3,8 @@
  1 file changed, 16 insertions(+), 5 deletions(-)
 
 --- locale.c
-+++ locale.c	2008-11-25 13:41:50.000000000 +0000
-@@ -54,6 +54,7 @@ extern int dump_translatable_strings, du
++++ locale.c	2018-09-20 08:14:41.307485537 +0000
+@@ -55,6 +55,7 @@ extern int dump_translatable_strings, du
  
  /* The current locale when the program begins */
  static char *default_locale;
@@ -12,7 +12,7 @@
  
  /* The current domain for textdomain(3). */
  static char *default_domain;
-@@ -326,11 +327,21 @@ get_locale_var (var)
+@@ -339,11 +340,21 @@ get_locale_var (var)
    if (locale == 0 || *locale == 0)
      locale = lang;
    if (locale == 0 || *locale == 0)
diff --git a/bash-4.1-bash.bashrc.dif b/bash-4.1-bash.bashrc.dif
index 47c6025..a34409a 100644
--- a/bash-4.1-bash.bashrc.dif
+++ b/bash-4.1-bash.bashrc.dif
@@ -20,8 +20,8 @@
  1 file changed, 12 insertions(+), 3 deletions(-)
 
 --- doc/bash.1
-+++ doc/bash.1	2016-08-01 13:54:54.253999110 +0000
-@@ -329,6 +329,8 @@ and executes commands from the first one
++++ doc/bash.1	2018-09-20 08:16:12.073822864 +0000
+@@ -330,6 +330,8 @@ and executes commands from the first one
  The
  .B \-\-noprofile
  option may be used when the shell is started to inhibit this behavior.
@@ -30,7 +30,7 @@
  .PP
  When an interactive login shell exits,
  or a non-interactive login shell executes the \fBexit\fP builtin command,
-@@ -338,13 +340,19 @@ exists.
+@@ -339,13 +341,19 @@ exists.
  .PP
  When an interactive shell that is not a login shell is started,
  .B bash
@@ -52,7 +52,7 @@
  .PP
  When
  .B bash
-@@ -430,7 +438,8 @@ daemon, usually \fIrshd\fP, or the secur
+@@ -431,7 +439,8 @@ daemon, usually \fIrshd\fP, or the secur
  If
  .B bash
  determines it is being run in this fashion, it reads and executes
diff --git a/bash-4.1-completion.dif b/bash-4.1-completion.dif
index 4eaf602..1ff32c0 100644
--- a/bash-4.1-completion.dif
+++ b/bash-4.1-completion.dif
@@ -3,8 +3,8 @@
  1 file changed, 7 insertions(+)
 
 --- bashline.c
-+++ bashline.c	2016-09-14 08:54:09.315700369 +0000
-@@ -2029,6 +2029,13 @@ globword:
++++ bashline.c	2018-11-29 08:12:25.876588305 +0000
+@@ -2045,6 +2045,13 @@ globword:
  	    return ((char *)NULL);
  	}
  
diff --git a/bash-4.2-endpw.dif b/bash-4.2-endpw.dif
deleted file mode 100644
index 95d17c4..0000000
--- a/bash-4.2-endpw.dif
+++ /dev/null
@@ -1,176 +0,0 @@
----
- bashline.c                 |    1 +
- examples/loadables/finfo.c |   16 ++++++++++------
- examples/loadables/id.c    |   37 +++++++++++++++++++++++++------------
- lib/tilde/shell.c          |    9 +++++++++
- lib/tilde/tilde.c          |    1 +
- 5 files changed, 46 insertions(+), 18 deletions(-)
-
---- bashline.c
-+++ bashline.c	2011-11-21 12:41:19.831646479 +0000
-@@ -2485,6 +2485,7 @@ bash_groupname_completion_function (text
-     }
- 
-   value = savestring (grent->gr_name);
-+  endgrent ();
-   return (value);
- #endif
- }
---- examples/loadables/finfo.c
-+++ examples/loadables/finfo.c	2011-11-21 12:23:17.331147246 +0000
-@@ -290,6 +290,7 @@ struct stat *st;
- 	pw = getpwuid(st->st_uid);
- 	owner = pw ? pw->pw_name : "unknown";
- 	printf("Uid of owner: %d (%s)\n", (int) st->st_uid, owner);
-+	endpwent();
- 	gr = getgrgid(st->st_gid);
- 	owner = gr ? gr->gr_name : "unknown";
- 	printf("Gid of owner: %d (%s)\n", (int) st->st_gid, owner);
-@@ -298,6 +299,7 @@ struct stat *st;
- 	printf("File last access time: %s", ctime (&st->st_atime));
- 	printf("File last modify time: %s", ctime (&st->st_mtime));
- 	printf("File last status change time: %s", ctime (&st->st_ctime));
-+	endgrent();
- 	fflush(stdout);
- 	return(0);
- }
-@@ -366,16 +368,18 @@ int	flags;
- 	else if (flags & OPT_PMASK)
- 		printf("%o\n", getperm(st->st_mode) & pmask);
- 	else if (flags & OPT_UID) {
--		pw = getpwuid(st->st_uid);
--		if (flags & OPT_ASCII)
-+		if (flags & OPT_ASCII) {
-+			pw = getpwuid(st->st_uid);
- 			printf("%s\n", pw ? pw->pw_name : "unknown");
--		else
-+			endpwent();
-+		} else
- 			printf("%d\n", st->st_uid);
- 	} else if (flags & OPT_GID) {
--		gr = getgrgid(st->st_gid);
--		if (flags & OPT_ASCII)
-+		if (flags & OPT_ASCII) {
-+			gr = getgrgid(st->st_gid);
- 			printf("%s\n", gr ? gr->gr_name : "unknown");
--		else
-+			endgrent();
-+		} else
- 			printf("%d\n", st->st_gid);
- 	} else if (flags & OPT_SIZE)
- 		printf("%ld\n", (long) st->st_size);
---- examples/loadables/id.c
-+++ examples/loadables/id.c	2011-11-21 12:39:06.895646231 +0000
-@@ -42,6 +42,7 @@
- 
- #if !defined (HAVE_GETPW_DECLS)
- extern struct passwd *getpwuid ();
-+extern void endpwent ();
- #endif
- extern struct group *getgrgid ();
- 
-@@ -136,18 +137,26 @@ static int
- inituser (uname)
-      char *uname;
- {
--  struct passwd *pwd;
--
-   if (uname)
-     {
-+      struct passwd *pwd;
-+      int r;
-+
-+      r = 0;
-       pwd = getpwnam (uname);
-       if (pwd == 0)
- 	{
- 	  builtin_error ("%s: no such user", uname);
--	  return -1;
-+	  r = -1;
- 	}
--      ruid = euid = pwd->pw_uid;
--      rgid = egid = pwd->pw_gid;
-+      else
-+	{
-+	  ruid = euid = pwd->pw_uid;
-+	  rgid = egid = pwd->pw_gid;
-+	}
-+      endpwent ();
-+      if (r < 0)
-+	return r;
-     }
-   else
-     {
-@@ -172,11 +181,12 @@ id_pruser (uid)
-     {
-       pwd = getpwuid (uid);
-       if (pwd == NULL)
--        r = 1;
-+	r = 1;
-+      else
-+	printf ("%s", pwd->pw_name);
-+      endpwent ();
-     }
--  if (pwd)
--    printf ("%s", pwd->pw_name);
--  else
-+  if (pwd == NULL)
-     printf ("%u", (unsigned) uid);
-       
-   return r;
-@@ -197,11 +207,12 @@ id_prgrp (gid)
-       grp = getgrgid (gid);
-       if (grp == NULL)
- 	r = 1;
-+      else
-+	printf ("%s", grp->gr_name);
-+      endgrent ();
-     }
- 
--  if (grp)
--    printf ("%s", grp->gr_name);
--  else
-+  if (grp == NULL)
-     printf ("%u", (unsigned) gid);
- 
-   return r;
-@@ -307,6 +318,8 @@ id_prall (uname)
-       else
- 	printf ("(%s)", grp->gr_name);
-     }
-+  endpwent ();
-+  endgrent ();
- 
-   return r;
- }
---- lib/tilde/shell.c
-+++ lib/tilde/shell.c	2011-11-21 13:07:02.099146925 +0000
-@@ -45,9 +45,18 @@
- #include <pwd.h>
- 
- #if !defined (HAVE_GETPW_DECLS)
-+#  if defined (HAVE_GETPWUID)
- extern struct passwd *getpwuid ();
-+#  endif
-+#  if defined (HAVE_GETPWENT)
-+extern void endpwent ();
-+#  endif
- #endif /* !HAVE_GETPW_DECLS */
- 
-+#if !defined (savestring)
-+#  define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
-+#endif /* !savestring */
-+
- char *
- get_env_value (varname)
-      char *varname;
---- lib/tilde/tilde.c
-+++ lib/tilde/tilde.c	2011-11-11 13:10:07.000000000 +0000
-@@ -61,6 +61,7 @@ extern struct passwd *getpwuid PARAMS((u
- #  endif
- #  if defined (HAVE_GETPWNAM)
- extern struct passwd *getpwnam PARAMS((const char *));
-+extern void endpwent ();
- #  endif
- #endif /* !HAVE_GETPW_DECLS */
- 
diff --git a/bash-4.2-nscdunmap.dif b/bash-4.2-nscdunmap.dif
index 2c82925..e97979a 100644
--- a/bash-4.2-nscdunmap.dif
+++ b/bash-4.2-nscdunmap.dif
@@ -3,7 +3,7 @@
  1 file changed, 24 insertions(+)
 
 --- shell.c
-+++ shell.c	2016-09-14 08:54:32.971258862 +0000
++++ shell.c	2018-09-20 08:08:34.242204532 +0000
 @@ -43,6 +43,7 @@
  #endif
  
@@ -12,7 +12,7 @@
  #  include <unistd.h>
  #endif
  
-@@ -1751,6 +1752,28 @@ init_interactive_script ()
+@@ -1800,6 +1801,28 @@ init_interactive_script ()
  #endif
  }
  
@@ -41,7 +41,7 @@
  void
  get_current_user_info ()
  {
-@@ -1782,6 +1805,7 @@ get_current_user_info ()
+@@ -1831,6 +1854,7 @@ get_current_user_info ()
  #if defined (HAVE_GETPWENT)
        endpwent ();
  #endif
diff --git a/bash-4.3-2.4.4.patch b/bash-4.3-2.4.4.patch
index 417e863..38b09b5 100644
--- a/bash-4.3-2.4.4.patch
+++ b/bash-4.3-2.4.4.patch
@@ -8,8 +8,8 @@
  6 files changed, 17 insertions(+), 7 deletions(-)
 
 --- array.c
-+++ array.c	2017-01-27 17:45:42.364066849 +0000
-@@ -946,7 +946,7 @@ char	*s, *sep;
++++ array.c	2018-11-29 08:10:37.098634355 +0000
+@@ -965,7 +965,7 @@ char	*s, *sep;
   * To make a running version, compile -DTEST_ARRAY and link with:
   * 	xmalloc.o syntax.o lib/malloc/libmalloc.a lib/sh/libsh.a
   */
@@ -19,7 +19,7 @@
  int
  signal_is_trapped(s)
 --- examples/loadables/tee.c
-+++ examples/loadables/tee.c	2017-01-27 17:45:42.364066849 +0000
++++ examples/loadables/tee.c	2018-11-29 08:10:37.098634355 +0000
 @@ -35,6 +35,7 @@
  #include "bashansi.h"
  
@@ -38,8 +38,8 @@
  extern char *strerror ();
  
 --- hashlib.c
-+++ hashlib.c	2017-01-27 17:45:42.364066849 +0000
-@@ -382,7 +382,7 @@ hash_pstats (table, name)
++++ hashlib.c	2018-11-29 08:10:37.098634355 +0000
+@@ -391,7 +391,7 @@ hash_pstats (table, name)
  
  HASH_TABLE *table, *ntable;
  
@@ -49,10 +49,10 @@
  int
  signal_is_trapped (s)
 --- jobs.c
-+++ jobs.c	2017-01-27 17:45:42.364066849 +0000
-@@ -1962,6 +1962,15 @@ make_child (command, async_p)
-       pid_t mypid;
- 
++++ jobs.c	2018-11-29 08:10:37.102634281 +0000
+@@ -1999,6 +1999,15 @@ make_child (command, async_p)
+ 	 child process, go back and change callers who free `command' in
+ 	 the child process when this returns. */
        mypid = getpid ();
 +
 +      if (interrupt_state)
@@ -67,8 +67,8 @@
        /* Close default_buffered_input if it's > 0.  We don't close it if it's
  	 0 because that's the file descriptor used when redirecting input,
 --- sig.c
-+++ sig.c	2017-01-27 17:45:42.364066849 +0000
-@@ -98,10 +98,10 @@ sigset_t top_level_mask;
++++ sig.c	2018-11-29 08:10:37.102634281 +0000
+@@ -83,10 +83,10 @@ sigset_t top_level_mask;
  #endif /* JOB_CONTROL */
  
  /* When non-zero, we throw_to_top_level (). */
@@ -82,7 +82,7 @@
  #if defined (SIGWINCH)
  static SigHandler *old_winch = (SigHandler *)SIG_DFL;
 --- sig.h
-+++ sig.h	2017-01-27 17:45:42.364066849 +0000
++++ sig.h	2018-11-29 08:10:37.102634281 +0000
 @@ -109,8 +109,8 @@ do { \
  extern volatile sig_atomic_t sigwinch_received;
  extern volatile sig_atomic_t sigterm_received;
diff --git a/bash-4.3-SJIS.patch b/bash-4.3-SJIS.patch
new file mode 100644
index 0000000..9fbd91c
--- /dev/null
+++ b/bash-4.3-SJIS.patch
@@ -0,0 +1,328 @@
+---
+ bashintl.h          |    3 +++
+ builtins/printf.def |   21 +++++++++++++++++++++
+ builtins/read.def   |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ lib/sh/strtrans.c   |   21 +++++++++++++++++++++
+ locale.c            |   26 ++++++++++++++++++++++++++
+ parse.y             |   42 +++++++++++++++++++++++++++++++++++++++++-
+ 6 files changed, 163 insertions(+), 2 deletions(-)
+
+--- bashintl.h
++++ bashintl.h	2018-11-29 08:14:56.165762022 +0000
+@@ -43,6 +43,9 @@
+ #  undef HAVE_SETLOCALE
+ #endif
+ 
++int bash_mbcs_non_utf8;
++int bash_mb_cur_max;
++
+ #if !defined (HAVE_SETLOCALE)
+ #  define setlocale(cat, loc)
+ #endif
+--- builtins/printf.def
++++ builtins/printf.def	2018-11-29 08:18:21.445909015 +0000
+@@ -247,6 +247,8 @@ printf_builtin (list)
+ #if defined (HANDLE_MULTIBYTE)
+   char mbch[25];		/* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
+   int mbind, mblen;
++  size_t charlen;
++  mbstate_t mbs;
+ #endif
+ #if defined (ARRAY_VARS)
+   int arrayflags;
+@@ -334,6 +336,25 @@ printf_builtin (list)
+ 	  precision = fieldwidth = 0;
+ 	  have_fieldwidth = have_precision = 0;
+ 
++#if defined (HANDLE_MULTIBYTE)
++	  if (bash_mbcs_non_utf8)
++	    {
++	      memset (&mbs, 0, sizeof (mbs));
++	      charlen = mbrlen (fmt, bash_mb_cur_max, &mbs);
++	      if (charlen > 1 && charlen != (size_t)-2 && charlen != (size_t)-1)
++	        {
++	          while (charlen > 0)
++	            {
++	              PC (*fmt);
++	              fmt++;
++	              charlen--;
++	            }
++	          fmt--;
++	          continue;
++	        }
++	    }
++#endif
++
+ 	  if (*fmt == '\\')
+ 	    {
+ 	      fmt++;
+--- builtins/read.def
++++ builtins/read.def	2018-11-29 08:14:56.165762022 +0000
+@@ -188,6 +188,12 @@ read_builtin (list)
+   char c;
+   char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
+   char *e, *t, *t1, *ps2, *tofree;
++#if defined (HANDLE_MULTIBYTE)
++  static char mbch[25];
++  size_t charlen;
++  int mblen;
++  mbstate_t mbs;
++#endif
+   struct stat tsb;
+   SHELL_VAR *var;
+   TTYSTRUCT ttattrs, ttset;
+@@ -548,6 +554,7 @@ read_builtin (list)
+ #endif
+ 
+   ps2 = 0;
++  charlen = 0;
+   for (print_ps2 = eof = retval = 0;;)
+     {
+       CHECK_ALRM;
+@@ -589,14 +596,40 @@ read_builtin (list)
+ 
+       reading = 1;
+       CHECK_ALRM;
++#if defined (HANDLE_MULTIBYTE)
++      charlen = 0;
++      mblen = 0;
++      if (bash_mbcs_non_utf8)
++	{
++	  do
++	   {
++	     if (unbuffered_read)
++	       retval = posixly_correct ? zreadintr (fd, &c, 1) : zread (fd, &c, 1);
++	     else
++	       retval = posixly_correct ? zreadcintr (fd, &c) : zreadc (fd, &c);
++
++	     if (retval <= 0)
++	        break;
++
++	     mbch[mblen++] = c;
++	     memset (&mbs, 0, sizeof (mbs));
++	     charlen = mbrlen (mbch, mblen, &mbs);
++	   }
++	  while (charlen == (size_t)-2 && mblen < bash_mb_cur_max);
++	}
++      else
++	{
++#endif
+       if (unbuffered_read == 2)
+ 	retval = posixly_correct ? zreadintr (fd, &c, 1) : zreadn (fd, &c, nchars - nr);
+       else if (unbuffered_read)
+ 	retval = posixly_correct ? zreadintr (fd, &c, 1) : zread (fd, &c, 1);
+       else
+ 	retval = posixly_correct ? zreadcintr (fd, &c) : zreadc (fd, &c);
++#if defined (HANDLE_MULTIBYTE)
++	}
++#endif
+       reading = 0;
+-
+       if (retval <= 0)
+ 	{
+ 	  if (retval < 0 && errno == EINTR)
+@@ -639,6 +672,11 @@ read_builtin (list)
+ 	    }
+ 	}
+ 
++#if defined (HANDLE_MULTIBYTE)
++      if (bash_mbcs_non_utf8 && charlen > 1)
++	goto add_char;
++#endif
++
+       /* If the next character is to be accepted verbatim, a backslash
+ 	 newline pair still disappears from the input. */
+       if (pass_next)
+@@ -681,7 +719,19 @@ read_builtin (list)
+ 	}
+ 
+ add_char:
++#if defined (HANDLE_MULTIBYTE)
++      if (bash_mbcs_non_utf8 && charlen > 1)
++	{
++	   for (mblen = 0; mblen < charlen; mblen++)
++	     input_string[i++] = mbch[mblen];
++	}
++      else
++	{
++#endif
+       input_string[i++] = c;
++#if defined (HANDLE_MULTIBYTE)
++	}
++#endif
+       CHECK_ALRM;
+ 
+ #if defined (HANDLE_MULTIBYTE)
+--- lib/sh/strtrans.c
++++ lib/sh/strtrans.c	2018-11-29 08:14:56.165762022 +0000
+@@ -29,6 +29,7 @@
+ #include <chartypes.h>
+ 
+ #include "shell.h"
++#include "bashintl.h"
+ 
+ #include "shmbchar.h"
+ #include "shmbutil.h"
+@@ -55,6 +56,10 @@ ansicstr (string, len, flags, sawc, rlen
+   int c, temp;
+   char *ret, *r, *s;
+   unsigned long v;
++#if defined (HANDLE_MULTIBYTE)
++  size_t charlen;
++  mbstate_t mbs;
++#endif
+ 
+   if (string == 0 || *string == '\0')
+     return ((char *)NULL);
+@@ -69,6 +74,22 @@ ansicstr (string, len, flags, sawc, rlen
+ #endif
+   for (r = ret, s = string; s && *s; )
+     {
++#if defined (HANDLE_MULTIBYTE)
++      if (bash_mbcs_non_utf8)
++        {
++          memset (&mbs, 0, sizeof (mbs));
++          charlen = mbrlen (s, bash_mb_cur_max, &mbs);
++          if (charlen > 1 && charlen != (size_t)-2 && charlen != (size_t)-1)
++            {
++              while (charlen > 0)
++                {
++                  *r++ = *s++;
++                  charlen--;
++                }
++              continue;
++            }
++        }
++#endif
+       c = *s++;
+       if (c != '\\' || *s == '\0')
+ 	*r++ = c;
+--- locale.c
++++ locale.c	2018-11-29 08:14:56.165762022 +0000
+@@ -52,6 +52,7 @@ int locale_mb_cur_max;	/* value of MB_CU
+ int locale_shiftstates;
+ 
+ extern int dump_translatable_strings, dump_po_strings;
++extern int bash_mb_cur_max, bash_mbcs_non_utf8;
+ 
+ /* The current locale when the program begins */
+ static char *default_locale;
+@@ -76,6 +77,26 @@ static int reset_locale_vars __P((void))
+ static void locale_setblanks __P((void));
+ static int locale_isutf8 __P((char *));
+ 
++static void
++set_mbcs_values ()
++{
++  /* Enhance the performance. */
++#if defined (HANDLE_MULTIBYTE)
++  bash_mb_cur_max = MB_CUR_MAX;
++#  if defined (HAVE_LANGINFO_CODESET)
++  if (strcasestr (nl_langinfo (CODESET), "JIS") != 0 && bash_mb_cur_max == 2)
++    bash_mbcs_non_utf8 = 1;
++  else
++    bash_mbcs_non_utf8 = 0;
++#  else
++    bash_mbcs_non_utf8 = 0;
++#  endif
++#else
++  bash_mb_cur_max = 1;
++  bash_mbcs_non_utf8 = 0;
++#endif
++}
++
+ /* Set the value of default_locale and make the current locale the
+    system default locale.  This should be called very early in main(). */
+ void
+@@ -94,6 +115,8 @@ set_default_locale ()
+   default_locale = setlocale (LC_ALL, "");
+   if (default_locale)
+     default_locale = savestring (default_locale);
++
++  set_mbcs_values ();
+ #endif /* HAVE_SETLOCALE */
+   bindtextdomain (PACKAGE, LOCALEDIR);
+   textdomain (PACKAGE);
+@@ -150,6 +173,7 @@ set_default_locale_vars ()
+     setlocale (LC_TIME, lc_all);
+ #  endif /* LC_TIME */
+ 
++  set_mbcs_values ();
+ #endif /* HAVE_SETLOCALE */
+ 
+   val = get_string_value ("TEXTDOMAIN");
+@@ -240,6 +264,7 @@ set_locale_var (var, value)
+       if (lc_all == 0 || *lc_all == '\0')
+ 	{
+ 	  x = setlocale (LC_CTYPE, get_locale_var ("LC_CTYPE"));
++	  set_mbcs_values ();
+ 	  locale_setblanks ();
+ 	  locale_mb_cur_max = MB_CUR_MAX;
+ 	  /* if setlocale() returns NULL, the locale is not changed */
+@@ -388,6 +413,7 @@ reset_locale_vars ()
+   t = setlocale (LC_TIME, get_locale_var ("LC_TIME"));
+ #  endif
+ 
++  set_mbcs_values ();
+   locale_setblanks ();  
+   locale_mb_cur_max = MB_CUR_MAX;
+   if (x)
+--- parse.y
++++ parse.y	2018-11-29 08:14:56.165762022 +0000
+@@ -2005,7 +2005,12 @@ read_a_line (remove_quoted_newline)
+ {
+   static char *line_buffer = (char *)NULL;
+   static int buffer_size = 0;
+-  int indx, c, peekc, pass_next;
++  int indx, c, peekc, pass_next, chari;
++#if defined (HANDLE_MULTIBYTE)
++  size_t charlen;
++  mbstate_t mbs;
++  static char char_buffer[10];
++#endif
+ 
+ #if defined (READLINE)
+   if (no_line_editing && SHOULD_PROMPT ())
+@@ -2020,7 +2025,42 @@ read_a_line (remove_quoted_newline)
+       /* Allow immediate exit if interrupted during input. */
+       QUIT;
+ 
++#if defined (HANDLE_MULTIBYTE)
++      if (!bash_mbcs_non_utf8)
++        c = yy_getc ();
++      else
++        {
++          chari = 0;
++          charlen = 0;
++          while (chari < 10)
++            {
++              char_buffer[chari++] = c = yy_getc ();
++
++              if (c == EOF)
++                break;
++
++              memset (&mbs, 0, sizeof (mbs));
++              charlen = mbrlen (char_buffer, chari, &mbs);
++
++              if ((size_t)charlen != (size_t)-2 && (size_t)charlen != (size_t)-1)
++                break;
++            }
++
++          if (charlen != 1)
++            {
++              charlen = chari;
++              for (chari = 0; chari < charlen && char_buffer[chari] != EOF; chari++)
++                {
++	          RESIZE_MALLOCED_BUFFER (line_buffer, indx, 2, buffer_size, 128);
++	          line_buffer[indx++] = char_buffer[chari];
++                }
++              if (chari == charlen)
++                continue;
++            }
++        }
++#else
+       c = yy_getc ();
++#endif
+ 
+       /* Ignore null bytes in input. */
+       if (c == 0)
diff --git a/bash-4.3-extra-import-func.patch b/bash-4.3-extra-import-func.patch
index f2f09ca..ef701ba 100644
--- a/bash-4.3-extra-import-func.patch
+++ b/bash-4.3-extra-import-func.patch
@@ -1,21 +1,22 @@
 ---
  builtins/shopt.def |    2 ++
  doc/bash.1         |    7 +++++++
+ execute_cmd.h      |    1 +
  shell.c            |    2 ++
- variables.c        |    8 +++++++-
- 4 files changed, 18 insertions(+), 1 deletion(-)
+ variables.c        |    7 ++++++-
+ 5 files changed, 18 insertions(+), 1 deletion(-)
 
 --- builtins/shopt.def
-+++ builtins/shopt.def	2016-09-14 08:57:33.723885627 +0000
++++ builtins/shopt.def	2018-11-29 08:19:32.996571288 +0000
 @@ -90,6 +90,7 @@ extern int autocd;
  extern int glob_star;
  extern int glob_asciirange;
  extern int lastpipe_opt;
 +extern int import_functions;
  extern int inherit_errexit;
- 
- #if defined (EXTENDED_GLOB)
-@@ -200,6 +201,7 @@ static struct {
+ extern int localvar_inherit;
+ extern int localvar_unset;
+@@ -213,6 +214,7 @@ static struct {
    { "hostcomplete", &perform_hostname_completion, shopt_enable_hostname_completion },
  #endif
    { "huponexit", &hup_on_exit, (shopt_set_func_t *)NULL },
@@ -24,8 +25,8 @@
    { "interactive_comments", &interactive_comments, set_shellopts_after_change },
    { "lastpipe", &lastpipe_opt, (shopt_set_func_t *)NULL },
 --- doc/bash.1
-+++ doc/bash.1	2016-09-14 08:57:33.723885627 +0000
-@@ -244,6 +244,13 @@ The shell becomes restricted (see
++++ doc/bash.1	2018-11-29 08:19:33.000571213 +0000
+@@ -245,6 +245,13 @@ The shell becomes restricted (see
  .B "RESTRICTED SHELL"
  below).
  .TP
@@ -39,9 +40,19 @@
  .B \-\-verbose
  Equivalent to \fB\-v\fP.
  .TP
+--- execute_cmd.h
++++ execute_cmd.h	2018-11-29 08:19:33.000571213 +0000
+@@ -61,6 +61,7 @@ extern int evalnest, evalnest_max;
+ extern int sourcenest, sourcenest_max;
+ extern int stdin_redir;
+ extern int line_number_for_err_trap;
++extern int import_functions;
+ 
+ extern char *the_printed_command_except_trap;
+ 
 --- shell.c
-+++ shell.c	2016-09-14 08:57:33.723885627 +0000
-@@ -238,6 +238,7 @@ int posixly_correct = 1;	/* Non-zero mea
++++ shell.c	2018-11-29 08:19:33.000571213 +0000
+@@ -232,6 +232,7 @@ int posixly_correct = 1;	/* Non-zero mea
  #else
  int posixly_correct = 0;	/* Non-zero means posix.2 superset. */
  #endif
@@ -49,7 +60,7 @@
  
  /* Some long-winded argument names.  These are obviously new. */
  #define Int 1
-@@ -257,6 +258,7 @@ static const struct {
+@@ -251,6 +252,7 @@ static const struct {
    { "help", Int, &want_initial_help, (char **)0x0 },
    { "init-file", Charp, (int *)0x0, &bashrc_file },
    { "login", Int, &make_login_shell, (char **)0x0 },
@@ -58,16 +69,8 @@
    { "noprofile", Int, &no_profile, (char **)0x0 },
    { "norc", Int, &no_rc, (char **)0x0 },
 --- variables.c
-+++ variables.c	2016-09-14 08:57:33.723885627 +0000
-@@ -115,6 +115,7 @@ extern time_t shell_start_time;
- extern int assigning_in_environment;
- extern int executing_builtin;
- extern int funcnest_max;
-+extern int import_functions;
- 
- #if defined (READLINE)
- extern int no_line_editing;
-@@ -378,6 +379,11 @@ initialize_shell_variables (env, privmod
++++ variables.c	2018-11-29 08:19:33.000571213 +0000
+@@ -380,6 +380,11 @@ initialize_shell_variables (env, privmod
  	  tname = name + BASHFUNC_PREFLEN;	/* start of func name */
  	  tname[namelen] = '\0';		/* now tname == func name */
  
@@ -79,7 +82,7 @@
  	  string_length = strlen (string);
  	  temp_string = (char *)xmalloc (namelen + string_length + 2);
  
-@@ -392,7 +398,7 @@ initialize_shell_variables (env, privmod
+@@ -394,7 +399,7 @@ initialize_shell_variables (env, privmod
  	    parse_and_execute (temp_string, tname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD);
  	  else
  	    free (temp_string);		/* parse_and_execute does this */
diff --git a/bash-4.3-loadables.dif b/bash-4.3-loadables.dif
index b59e075..d75c01d 100644
--- a/bash-4.3-loadables.dif
+++ b/bash-4.3-loadables.dif
@@ -1,15 +1,15 @@
 ---
- examples/loadables/finfo.c   |   11 +++++------
+ examples/loadables/finfo.c   |    9 ++++-----
  examples/loadables/head.c    |    2 --
  examples/loadables/id.c      |    2 --
  examples/loadables/mkdir.c   |    2 +-
  examples/loadables/pathchk.c |    2 --
  examples/loadables/print.c   |    2 +-
  examples/loadables/tee.c     |    2 --
- 7 files changed, 7 insertions(+), 16 deletions(-)
+ 7 files changed, 6 insertions(+), 15 deletions(-)
 
 --- examples/loadables/finfo.c
-+++ examples/loadables/finfo.c	2016-03-08 12:24:51.061423424 +0000
++++ examples/loadables/finfo.c	2018-09-20 08:07:43.739129083 +0000
 @@ -102,7 +102,7 @@ int	argc;
  char	**argv;
  {
@@ -24,16 +24,15 @@
  			printf("%ld\n", st->st_ctime);
  	} else if (flags & OPT_DEV)
 -		printf("%d\n", st->st_dev);
-+		printf("%lu\n", (ulong)st->st_dev);
++		printf("%lu\n", (unsigned long)st->st_dev);
  	else if (flags & OPT_INO)
--		printf("%d\n", st->st_ino);
-+		printf("%lu\n", (ulong)st->st_ino);
+ 		printf("%lu\n", (unsigned long)st->st_ino);
  	else if (flags & OPT_FID)
--		printf("%d:%ld\n", st->st_dev, st->st_ino);
-+		printf("%lu:%lu\n", (ulong)st->st_dev, (ulong)st->st_ino);
+-		printf("%d:%lu\n", st->st_dev, (unsigned long)st->st_ino);
++		printf("%lu:%lu\n", (unsigned long)st->st_dev, (unsigned long)st->st_ino);
  	else if (flags & OPT_NLINK)
 -		printf("%d\n", st->st_nlink);
-+		printf("%lu\n", (ulong)st->st_nlink);
++		printf("%lu\n", (unsigned long)st->st_nlink);
  	else if (flags & OPT_LNKNAM) {
  #ifdef S_ISLNK
  		b = xmalloc(4096);
@@ -46,7 +45,7 @@
    v = make_builtin_argv (list, &c);
    r = finfo_main (c, v);
 --- examples/loadables/head.c
-+++ examples/loadables/head.c	2016-03-08 12:24:51.061423424 +0000
++++ examples/loadables/head.c	2018-09-20 08:07:43.739129083 +0000
 @@ -99,8 +99,6 @@ head_builtin (list)
    WORD_LIST *l;
    FILE *fp;
@@ -57,7 +56,7 @@
  
    reset_internal_getopt ();
 --- examples/loadables/id.c
-+++ examples/loadables/id.c	2016-03-08 12:24:51.061423424 +0000
++++ examples/loadables/id.c	2018-09-20 08:07:43.739129083 +0000
 @@ -64,8 +64,6 @@ static int id_flags;
  static uid_t ruid, euid;
  static gid_t rgid, egid;
@@ -68,8 +67,8 @@
  
  static int id_pruser ();
 --- examples/loadables/mkdir.c
-+++ examples/loadables/mkdir.c	2016-03-08 12:24:51.061423424 +0000
-@@ -167,7 +167,7 @@ make_path (path, nmode, parent_mode)
++++ examples/loadables/mkdir.c	2018-09-20 08:07:43.739129083 +0000
+@@ -170,7 +170,7 @@ make_path (path, nmode, parent_mode)
    while (*p == '/')
      p++;
  
@@ -79,8 +78,8 @@
        *p = '\0';
        if (stat (npath, &sb) != 0)
 --- examples/loadables/pathchk.c
-+++ examples/loadables/pathchk.c	2016-03-08 12:24:51.061423424 +0000
-@@ -291,10 +291,8 @@ validate_path (path, portability)
++++ examples/loadables/pathchk.c	2018-09-20 08:07:43.739129083 +0000
+@@ -292,10 +292,8 @@ validate_path (path, portability)
    if (*path == '\0')
      return 0;
  
@@ -92,7 +91,7 @@
    /* Figure out the parent of the first element in PATH.  */
    parent = xstrdup (*path == '/' ? "/" : ".");
 --- examples/loadables/print.c
-+++ examples/loadables/print.c	2016-03-08 12:24:51.061423424 +0000
++++ examples/loadables/print.c	2018-09-20 08:07:43.739129083 +0000
 @@ -77,7 +77,7 @@ print_builtin (list)
  {
    int c, r, nflag, raw, ofd, sflag;
@@ -103,7 +102,7 @@
  
    nflag = raw = sflag = 0;
 --- examples/loadables/tee.c
-+++ examples/loadables/tee.c	2016-03-08 12:24:51.061423424 +0000
++++ examples/loadables/tee.c	2018-09-20 08:07:43.739129083 +0000
 @@ -70,8 +70,6 @@ tee_builtin (list)
    FLIST *fl;
    char *buf, *bp;
diff --git a/bash-4.3-sigrestart.patch b/bash-4.3-sigrestart.patch
index 48c840d..eabdbbd 100644
--- a/bash-4.3-sigrestart.patch
+++ b/bash-4.3-sigrestart.patch
@@ -3,14 +3,17 @@
  1 file changed, 6 insertions(+)
 
 --- sig.c
-+++ sig.c	2017-01-27 17:46:46.602829901 +0000
-@@ -739,10 +739,16 @@ set_signal_handler (sig, handler)
++++ sig.c	2018-11-29 08:13:00.103944580 +0000
+@@ -761,6 +761,8 @@ set_signal_handler (sig, handler)
    if (sig == SIGCHLD)
      act.sa_flags |= SA_RESTART;		/* XXX */
  #endif
 +  if (handler == (trap_handler))
 +    act.sa_flags |= SA_NODEFER;		/* XXX */
-   /* If we're installing a SIGTERM handler for interactive shells, we want
+   /* Let's see if we can keep SIGWINCH from interrupting interruptible system
+      calls, like open(2)/read(2)/write(2) */
+ #if defined (SIGWINCH)
+@@ -771,6 +773,10 @@ set_signal_handler (sig, handler)
       it to be as close to SIG_IGN as possible. */
    if (sig == SIGTERM && handler == sigterm_sighandler)
      act.sa_flags |= SA_RESTART;		/* XXX */
diff --git a/bash-4.3-winch.dif b/bash-4.3-winch.dif
index fdf01fb..c39b4e9 100644
--- a/bash-4.3-winch.dif
+++ b/bash-4.3-winch.dif
@@ -3,8 +3,8 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 --- config-top.h
-+++ config-top.h	2016-09-14 08:55:30.170191343 +0000
-@@ -130,7 +130,7 @@
++++ config-top.h	2018-09-20 08:15:45.026318359 +0000
+@@ -142,7 +142,7 @@
  
  /* Define to 0 if you want the checkwinsize option off by default, 1 if you
     want it on. */
diff --git a/bash-4.4-patches.tar.bz2 b/bash-4.4-patches.tar.bz2
deleted file mode 100644
index 9522b6a..0000000
--- a/bash-4.4-patches.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8c161f78c916668078676da505aad2756202cbfee895d714091bfdc5c836e1fd
-size 12693
diff --git a/bash-4.4.tar.gz b/bash-4.4.tar.gz
deleted file mode 100644
index 305b178..0000000
--- a/bash-4.4.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb
-size 9377313
diff --git a/bash-5.0-patches.tar.bz2 b/bash-5.0-patches.tar.bz2
new file mode 100644
index 0000000..9e6e31f
--- /dev/null
+++ b/bash-5.0-patches.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:28f8e4be802a88908b064f6fce74cd04d5e5357fbe9d1844699d1898301cf3df
+size 237
diff --git a/bash-4.4.dif b/bash-5.0.dif
similarity index 82%
rename from bash-4.4.dif
rename to bash-5.0.dif
index c954c10..bd47107 100644
--- a/bash-4.4.dif
+++ b/bash-5.0.dif
@@ -5,7 +5,7 @@
  doc/bash.1         |    7 +++++--
  general.h          |    3 +++
  parse.y            |    2 +-
- shell.c            |    4 +++-
+ shell.c            |    6 +++++-
  support/bashbug.sh |    2 +-
  support/man2html.c |    1 +
  support/rlvers.sh  |    6 +++---
@@ -13,11 +13,11 @@
  tests/glob.tests   |    4 ++--
  tests/run-intl     |    2 +-
  tests/run-read     |    2 +-
- 14 files changed, 36 insertions(+), 22 deletions(-)
+ 14 files changed, 38 insertions(+), 22 deletions(-)
 
 --- Makefile.in
-+++ Makefile.in	2017-09-25 09:08:48.341515472 +0000
-@@ -447,7 +447,7 @@ SOURCES	 = $(CSOURCES) $(HSOURCES) $(BUI
++++ Makefile.in	2018-11-29 08:14:06.638693338 +0000
+@@ -456,7 +456,7 @@ SOURCES	 = $(CSOURCES) $(HSOURCES) $(BUI
  # headers in top-level source directory that get installed by install-headers
  INSTALLED_HEADERS = shell.h bashjmp.h command.h syntax.h general.h error.h \
  		    variables.h array.h assoc.h arrayfunc.h quit.h dispose_cmd.h \
@@ -27,8 +27,8 @@
  		    bashintl.h bashansi.h bashjmp.h alias.h hashlib.h \
  		    conftypes.h unwind_prot.h jobs.h siglist.h
 --- config-top.h
-+++ config-top.h	2017-09-25 09:08:06.210296290 +0000
-@@ -60,17 +60,21 @@
++++ config-top.h	2018-11-29 08:14:06.638693338 +0000
+@@ -60,10 +60,14 @@
     due to EPIPE. */
  /* #define DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS */
  
@@ -43,7 +43,8 @@
 +  "/usr/local/bin:" _PATH_DEFPATH ":."
  #endif
  
- /* The value for PATH when invoking `command -p'.  This is only used when
+ /* If you want to unconditionally set a value for PATH in every restricted
+@@ -74,7 +78,7 @@
     the Posix.2 confstr () function, or CS_PATH define are not present. */
  #ifndef STANDARD_UTILS_PATH
  #define STANDARD_UTILS_PATH \
@@ -52,7 +53,7 @@
  #endif
  
  /* Default primary and secondary prompt strings. */
-@@ -87,20 +91,20 @@
+@@ -91,20 +95,20 @@
  #define DEFAULT_BASHRC "~/.bashrc"
  
  /* System-wide .bashrc file for interactive shells. */
@@ -78,7 +79,7 @@
  /* Define if you want the case-capitalizing operators (~[~]) and the
     `capcase' variable attribute (declare -c). */
 --- doc/Makefile.in
-+++ doc/Makefile.in	2017-09-25 09:08:06.210296290 +0000
++++ doc/Makefile.in	2018-11-29 08:14:06.638693338 +0000
 @@ -154,7 +154,7 @@ BASHREF_FILES = $(srcdir)/bashref.texi $
  #	$(RM) $@
  #	-${TEXI2PDF} $<
@@ -89,8 +90,8 @@
  everything: all pdf
  
 --- doc/bash.1
-+++ doc/bash.1	2017-09-25 09:08:06.214296216 +0000
-@@ -5253,8 +5253,8 @@ file (the \fIinputrc\fP file).
++++ doc/bash.1	2018-11-29 08:14:06.638693338 +0000
+@@ -5443,8 +5443,8 @@ file (the \fIinputrc\fP file).
  The name of this file is taken from the value of the
  .SM
  .B INPUTRC
@@ -101,7 +102,7 @@
  When a program which uses the readline library starts up, the
  initialization file is read, and the key bindings and variables
  are set.
-@@ -10586,6 +10586,9 @@ The individual login shell cleanup file,
+@@ -10922,6 +10922,9 @@ The individual login shell cleanup file,
  .TP
  .FN ~/.inputrc
  Individual \fIreadline\fP initialization file
@@ -112,7 +113,7 @@
  .SH AUTHORS
  Brian Fox, Free Software Foundation
 --- general.h
-+++ general.h	2017-09-25 09:08:06.214296216 +0000
++++ general.h	2018-11-29 08:14:06.638693338 +0000
 @@ -21,10 +21,13 @@
  #if !defined (_GENERAL_H_)
  #define _GENERAL_H_
@@ -128,8 +129,8 @@
  #if defined (HAVE_SYS_RESOURCE_H) && defined (RLIMTYPE)
  #  if defined (HAVE_SYS_TIME_H)
 --- parse.y
-+++ parse.y	2017-09-25 09:08:06.214296216 +0000
-@@ -1426,7 +1426,7 @@ input_file_descriptor ()
++++ parse.y	2018-11-29 08:14:06.638693338 +0000
+@@ -1456,7 +1456,7 @@ input_file_descriptor ()
  
  #if defined (READLINE)
  char *current_readline_prompt = (char *)NULL;
@@ -139,7 +140,7 @@
  
  static int
 --- shell.c
-+++ shell.c	2017-09-25 09:08:06.214296216 +0000
++++ shell.c	2018-11-29 08:14:06.638693338 +0000
 @@ -45,6 +45,7 @@
  #if defined (HAVE_UNISTD_H)
  #  include <sys/types.h>
@@ -148,7 +149,7 @@
  #endif
  
  #include "bashintl.h"
-@@ -501,7 +502,7 @@ main (argc, argv, env)
+@@ -497,7 +498,7 @@ main (argc, argv, env)
    if (dump_translatable_strings)
      read_but_dont_execute = 1;
  
@@ -157,7 +158,7 @@
      disable_priv_mode ();
  
    /* Need to get the argument to a -c option processed in the
-@@ -1277,6 +1278,9 @@ disable_priv_mode ()
+@@ -1294,6 +1295,9 @@ disable_priv_mode ()
  {
    int e;
  
@@ -168,7 +169,7 @@
      {
        e = errno;
 --- support/bashbug.sh
-+++ support/bashbug.sh	2017-09-25 09:08:06.214296216 +0000
++++ support/bashbug.sh	2018-11-29 08:14:06.638693338 +0000
 @@ -1,4 +1,4 @@
 -#!/bin/sh -
 +#!/bin/bash -
@@ -176,7 +177,7 @@
  # bashbug - create a bug report and mail it to the bug address
  #
 --- support/man2html.c
-+++ support/man2html.c	2017-09-25 09:08:06.214296216 +0000
++++ support/man2html.c	2018-11-29 08:14:06.638693338 +0000
 @@ -78,6 +78,7 @@
  #include <time.h>
  #include <sys/time.h>
@@ -186,7 +187,7 @@
  #define NULL_TERMINATED(n) ((n) + 1)
  
 --- support/rlvers.sh
-+++ support/rlvers.sh	2017-09-25 09:08:06.214296216 +0000
++++ support/rlvers.sh	2018-11-29 08:14:06.638693338 +0000
 @@ -27,10 +27,10 @@ TDIR=$TMPDIR/rlvers
  
  # defaults
@@ -202,7 +203,7 @@
  # cannot rely on the presence of getopts
  while [ $# -gt 0 ]; do
 --- support/shobj-conf
-+++ support/shobj-conf	2017-09-25 09:08:06.214296216 +0000
++++ support/shobj-conf	2018-11-29 08:14:06.642693263 +0000
 @@ -126,10 +126,11 @@ sunos5*|solaris2*)
  linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
  	SHOBJ_CFLAGS=-fPIC
@@ -218,20 +219,20 @@
  
  freebsd2*)
 --- tests/glob.tests
-+++ tests/glob.tests	2017-09-25 09:08:06.214296216 +0000
-@@ -12,8 +12,8 @@ ${THIS_SH} ./glob1.sub
++++ tests/glob.tests	2018-11-29 08:14:06.642693263 +0000
+@@ -15,8 +15,8 @@ ${THIS_SH} ./glob3.sub
  
  MYDIR=$PWD	# save where we are
  
--TESTDIR=/tmp/glob-test
+-TESTDIR=$TMPDIR/glob-test-$$
 -mkdir $TESTDIR
-+TESTDIR=${TMPDIR:=/tmp}/glob-test
++TESTDIR=${TMPDIR:=/tmp}/glob-test-$$
 +mkdir -p $TESTDIR
  builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
  rm -rf *
  
 --- tests/run-intl
-+++ tests/run-intl	2017-09-25 09:08:06.214296216 +0000
++++ tests/run-intl	2018-11-29 08:14:06.642693263 +0000
 @@ -5,4 +5,4 @@ echo "warning: some of these tests will
  echo "warning: locales installed on your system." >&2
  
@@ -239,7 +240,7 @@
 -diff $AFLAG ${BASH_TSTOUT} intl.right && rm -f ${BASH_TSTOUT}
 +diff -w $AFLAG ${BASH_TSTOUT} intl.right && rm -f ${BASH_TSTOUT}
 --- tests/run-read
-+++ tests/run-read	2017-09-25 09:08:06.214296216 +0000
++++ tests/run-read	2018-11-29 08:14:06.642693263 +0000
 @@ -1,4 +1,4 @@
  echo "warning: please do not consider output differing only in the amount of" >&2
  echo "warning: white space to be an error." >&2
diff --git a/bash-5.0.tar.gz b/bash-5.0.tar.gz
new file mode 100644
index 0000000..0bcd795
--- /dev/null
+++ b/bash-5.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b4a80f2ac66170b2913efbfb9f2594f1f76c7b1afd11f799e22035d63077fb4d
+size 10135110
diff --git a/bash-memmove.patch b/bash-memmove.patch
deleted file mode 100644
index bdc299a..0000000
--- a/bash-memmove.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Author: Bernhard M. Wiedemann <bwiedemann suse de>
-Date: 2018-07-07
-
-strcpy can cause corruption when working on overlapping strings
-so we use memmove instead that handles this case correctly
-
-Index: bash-4.4/support/man2html.c
-===================================================================
---- bash-4.4.orig/support/man2html.c
-+++ bash-4.4/support/man2html.c
-@@ -1992,7 +1993,7 @@ unescape (char *c)
- 	while (i < l && c[i]) {
- 		if (c[i] == '\a') {
- 			if (c[i+1])
--				strcpy(c + i, c + i + 1);	/* should be memmove */
-+				memmove(c + i, c + i + 1, strlen(c + i));
- 			else {
- 				c[i] = '\0';
- 				break;
diff --git a/bash.changes b/bash.changes
index 638e333..4692631 100644
--- a/bash.changes
+++ b/bash.changes
@@ -1,3 +1,169 @@
+-------------------------------------------------------------------
+Wed Jan  9 12:47:04 UTC 2019 - Dr. Werner Fink <werner@suse.de>
+
+- Update to bash 5.0 (final)
+  a. Tilde expansion isn't performed on indexed array subscripts, even for
+     backwards compatibility.
+  b. The shell doesn't exit in posix mode if the eval builtin gets a parse
+     error when run by the command builtin.
+  c. Fixed a bug that caused a shell comment in an alias to not find the end
+     of the alias properly.
+  d. Reverted a change from April, 2018 that caused strings containing
+     backslashes to be flagged as glob patterns.
+- Modify patches
+  * bash-2.03-manual.patch
+  * bash-4.3-loadables.dif
+  * bash-5.0.dif
+
+-------------------------------------------------------------------
+Fri Dec 21 13:34:47 UTC 2018 - Dr. Werner Fink <werner@suse.de>
+
+- Update to bash 5.0 rc1
+  a. Fix to initial word completion detection code.
+  b. Fixed a bug that caused issues with assignment statements containing ^A in
+     the value assigned when IFS contains ^A.
+  c. Added a fallback to fnmatch() when strcoll can't correctly deal with
+     bracket expression character equivalence classes.
+  d. Fixed a bug that caused $BASH_COMMAND to contain the trap handler command
+     when running a trap handler containing [[ or (( commands.
+  e. Fixed a bug that caused nameref assignments in the temporary environment
+     to potentially create variables with invalid names.
+  f. Fixed a bug that caused `local -' to turn off alias expansion in scripts.
+  g. Fixed a parser issue with a command string containing EOF after an invalid
+     command as an argument to a special builtin not causing a posix-mode shell
+     to exit.
+  h. Made a slight change to the FNV-1 string hash algorithm used for associative
+     arrays (corrected the initial seed).
+  a. The `select' command now supports command forms without a word list
+     following `in'.
+
+-------------------------------------------------------------------
+Thu Nov 29 08:22:16 UTC 2018 - Dr. Werner Fink <werner@suse.de>
+
+- Update to bash 5.0 beta2
+  ii. Associative and indexed arrays now allow subscripts consisting solely of
+      whitespace.
+  jj. `checkwinsize' is now enabled by default.
+  kk. The `localvar_unset' shopt option is now visible and documented.
+  ll. The `progcomp_alias' shopt option is now visible and documented.
+  mm. The signal name processing code now understands `SIGRTMIN+n' all the way
+      up to SIGRTMAX.
+  nn. There is a new `seq' loadable builtin.
+  oo. Trap execution now honors the (internal) max invocations of `eval', since
+      traps are supposed to be executed as if using `eval'.
+  pp. The $_ variable doesn't change when the shell executes a command that forks.
+  qq. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
+      conforming applications aren't supposed to use them.
+  rr. POSIX mode now enables the `shift_verbose' option.
+- Modify patches
+  * bash-2.03-manual.patch
+  * bash-3.0-evalexp.patch
+  * bash-3.2-printf.patch
+  * bash-4.0-security.patch
+  * bash-4.1-completion.dif
+  * bash-4.3-2.4.4.patch
+  * bash-4.3-SJIS.patch
+  * bash-4.3-extra-import-func.patch
+  * bash-4.3-sigrestart.patch
+  * bash-5.0.dif
+- Add temporary upstream patch upstream.patch
+
+-------------------------------------------------------------------
+Thu Sep 20 08:56:46 UTC 2018 - Dr. Werner Fink <werner@suse.de>
+
+- Update to bash 5.0 beta
+  a. The `wait' builtin can now wait for the last process substitution created.
+  b. There is an EPOCHSECONDS variable, which expands to the time in seconds
+     since the Unix epoch.
+  c. There is an EPOCHREALTIME variable, which expands to the time in seconds
+     since the Unix epoch with microsecond granularity.
+  d. New loadable builtins: rm, stat, fdflags.
+  e. BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment.
+  f. When supplied a numeric argument, the shell-expand-line bindable readline
+     command does not perform quote removal and suppresses command and process
+     substitution.
+  g. `history -d' understands negative arguments: negative arguments offset from
+     the end of the history list.
+  h. The `name' argument to the `coproc' reserved word now undergoes word
+     expansion, so unique coprocs can be created in loops.
+  i. A nameref name resolution loop in a function now resolves to a variable by
+     that name in the global scope.
+  j. The `wait' builtin now has a `-f' option, which signfies to wait until the
+     specified job or process terminates, instead of waiting until it changes
+     state.
+  k. There is a define in config-top.h that allows the shell to use a static
+     value for $PATH, overriding whatever is in the environment at startup, for
+     use by the restricted shell.
+  l. Process substitution does not inherit the `v' option, like command
+     substitution.
+  m. If a non-interactive shell with job control enabled detects that a foreground
+     job died due to SIGINT, it acts as if it received the SIGINT.
+  n. The SIGCHLD trap is run once for each exiting child process even if job
+     control is not enabled when the shell is in Posix mode.
+  o. A new shopt option: localvar_inherit; if set, a local variable inherits the
+     value of a variable with the same name at the nearest preceding scope.
+  p. `bind -r' now checks whether a key sequence is bound before binding it to
+     NULL, to avoid creating keymaps for a multi-key sequence.
+  q. A numeric argument to the line editing `operate-and-get-next' command
+     specifies which history entry to use.
+  r. The positional parameters are now assigned before running the shell startup
+     files, so startup files can use $@.
+  s. There is a compile-time option that forces the shell to disable the check
+     for an inherited OLDPWD being a directory.
+  t. The `history' builtin can now delete ranges of history entries using
+     `-d start-end'.
+  u. The `vi-edit-and-execute-command' bindable readline command now puts readline
+     back in vi insertion mode after executing commands from the edited file.
+  v. The command completion code now matches aliases and shell function names
+     case-insensitively if the readline completion-ignore-case variable is set.
+  w. There is a new `assoc_expand_once' shell option that attempts to expand
+     associative array subscripts only once.
+  x. The shell only sets up BASH_ARGV and BASH_ARGC at startup if extended
+     debugging mode is active. The old behavior of unconditionally setting them
+     is available as part of the shell compatibility options.
+  y. The `umask' builtin now allows modes and masks greater than octal 777.
+  z. The `times' builtin now honors the current locale when printing a decimal
+     point.
+  aa. There is a new (disabled by default, undocumented) shell option to enable
+      and disable sending history to syslog at runtime.
+  bb. Bash no longer allows variable assignments preceding a special builtin that
+      changes variable attributes to propagate back to the calling environment
+      unless the compatibility level is 44 or lower.
+  cc. You can set the default value for $HISTSIZE at build time in config-top.h.
+  dd. The `complete' builtin now accepts a -I option that applies the completion
+      to the initial word on the line.
+  ee. The internal bash malloc now uses mmap (if available) to satisfy requests
+      greater than 128K bytes, so free can use mfree to return the pages to the
+      kernel.
+  ff. The shell doesn't automatically set BASH_ARGC and BASH_ARGV at startup
+      unless it's in debugging mode, as the documentation has always said, but
+      will dynamically create them if a script references them at the top level
+      without having enabled debugging mode.
+  gg. The localvar_inherit option will not attempt to inherit a value from a
+      variable of an incompatible type (indexed vs. associative arrays, for
+      example).
+  hh. The `globasciiranges' option is now enabled by default; it can be set to
+      off by default at configuration time.
+- Modify and port patches
+  * bash-2.03-manual.patch
+  * bash-3.0-evalexp.patch
+  * bash-3.0-warn-locale.patch
+  * bash-3.2-printf.patch
+  * bash-4.0-security.patch
+  * bash-4.0-setlocale.dif
+  * bash-4.1-bash.bashrc.dif
+  * bash-4.1-completion.dif
+  * bash-4.2-nscdunmap.dif
+  * bash-4.3-2.4.4.patch
+  * bash-4.3-extra-import-func.patch
+  * bash-4.3-loadables.dif
+  * bash-4.3-sigrestart.patch
+  * bash-4.3-winch.dif
+- Port and rename bash-4.4.dif which is now bash-5.0.dif
+- Delete not used patch bash-4.2-endpw.dif
+- Remove patch bash-memmove.patch now upstream
+- Add patch bash-4.3-SJIS.patch which is disabled by default
+
 -------------------------------------------------------------------
 Sat Jul  7 05:03:48 UTC 2018 - bwiedemann@suse.com
 
diff --git a/bash.spec b/bash.spec
index c6dbb09..c07740a 100644
--- a/bash.spec
+++ b/bash.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package bash
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,6 +17,7 @@
 
 
 %bcond_with     import_function
+%bcond_with     sjis
 
 Name:           bash
 BuildRequires:  audit-devel
@@ -28,11 +29,11 @@ BuildRequires:  ncurses-devel
 BuildRequires:  patchutils
 BuildRequires:  pkg-config
 # This has to be always the same version as included in the bash its self
-BuildRequires:  readline-devel == 7.0
+BuildRequires:  readline-devel == 8.0
 BuildRequires:  screen
 BuildRequires:  sed
 %define         bextend	 %nil
-Version:        4.4
+Version:        5.0
 Release:        0
 Summary:        The GNU Bourne-Again Shell
 License:        GPL-3.0-or-later
@@ -63,8 +64,6 @@ Patch2:         bash-4.0-security.patch
 Patch3:         bash-4.3-2.4.4.patch
 Patch4:         bash-3.0-evalexp.patch
 Patch5:         bash-3.0-warn-locale.patch
-# Disabled
-Patch6:         bash-4.2-endpw.dif
 Patch7:         bash-4.3-decl.patch
 Patch9:         bash-4.3-include-unistd.dif
 Patch10:        bash-3.2-printf.patch
@@ -77,13 +76,14 @@ Patch16:        bash-4.0-setlocale.dif
 # PATCH-EXTEND-SUSE bnc#828877 -- xterm resizing does not pass to all sub clients
 Patch18:        bash-4.3-winch.dif
 Patch40:        bash-4.1-bash.bashrc.dif
+# PATCH-FIX-SUSE For bsc#1065158 add support for broken Japanese locale Shift JIS
+Patch42:        bash-4.3-SJIS.patch
 Patch46:        man2html-no-timestamp.patch
 Patch47:        bash-4.3-perl522.patch
 # PATCH-FIX-SUSE
 Patch48:        bash-4.3-extra-import-func.patch
 # PATCH-EXTEND-SUSE Allow root to clean file system if filled up
 Patch49:        bash-4.3-pathtemp.patch
-Patch50:        bash-memmove.patch
 %global         _sysconfdir /etc
 %global         _incdir     %{_includedir}
 %global         _ldldir     /%{_lib}/bash
@@ -188,6 +188,11 @@ whoami	      Print out username of current user.
 
 
 %prep
+%if %{with sjis}
+echo -e '\033[1m\033[31mWarning: Shift JIS support is enabled\033[m'
+%else
+echo -e '\033[1m\032[31mShift JIS support disabled\033[m'
+%endif
 %setup -q -n bash-%{version}%{bextend} -b1
 typeset -i level
 for patch in ../bash-%{version}-patches/*; do
@@ -208,7 +213,6 @@ done
 %patch3  -p0 -b .2.4.4
 %patch4  -p0 -b .evalexp
 %patch5  -p0 -b .warnlc
-#%patch6  -p0 -b .endpw
 %patch7  -p0 -b .decl
 %patch9  -p0 -b .unistd
 %patch10 -p0 -b .printf
@@ -217,16 +221,19 @@ done
 %patch13 -p0 -b .nscdunmap
 %patch14 -p0 -b .sigrestart
 %patch16 -p0 -b .setlocale
-%patch18 -p0 -b .winch
+#%patch18 -p0 -b .winch
 %patch40 -p0 -b .bashrc
+%if %{with sjis}
+%patch42 -p0 -b .sjis
+%endif
 %patch46 -p0 -b .notimestamp
 %patch47 -p0 -b .perl522
 %if %{with import_function}
 %patch48 -b .eif
 %endif
 %patch49 -p0 -b .pthtmp
-%patch50 -p1 -b .mmv
 %patch0  -p0 -b .0
+
 # This has to be always the same version as included in the bash its self
 rl1=($(sed -rn '/RL_READLINE_VERSION/p' lib/readline/readline.h))
 rl2=($(sed -rn '/RL_READLINE_VERSION/p' /usr/include/readline/readline.h))
@@ -327,6 +334,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
   SYSMALLOC="
 	--without-gnu-malloc
 	--without-bash-malloc
+	--enable-mem-scramble
   "
   #
   # System readline library (comment out it not to be used)
@@ -343,6 +351,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
 	--libdir=%{_libdir}		\
 	--with-curses			\
 	--with-afs			\
+	--with-gnu-ld			\
 	$SYSMALLOC			\
 	--enable-minimal-config		\
 	--enable-arith-for-command	\
@@ -360,6 +369,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
 	--enable-job-control		\
 	--enable-net-redirections	\
 	--enable-process-substitution	\
+	--enable-glob-asciiranges-default \
 	--disable-strict-posix-default	\
 	--enable-separate-helpfiles=%{_datadir}/bash/helpfiles \
 	$READLINE
@@ -374,6 +384,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
 	--docdir=%{_docdir}/%{name}	\
 	--with-curses			\
 	--with-afs			\
+	--with-gnu-ld			\
 	$SYSMALLOC			\
 	--enable-job-control		\
 	--enable-net-redirections	\
@@ -386,14 +397,17 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
 	--enable-prompt-string-decoding	\
 	--enable-select			\
 	--enable-help-builtin		\
+	--enable-separate-helpfiles	\
 	--enable-array-variables	\
 	--enable-brace-expansion	\
 	--enable-command-timing		\
 	--enable-disabled-builtins	\
+	--enable-glob-asciiranges-default \
 	--disable-strict-posix-default	\
 	--enable-multibyte		\
 	--enable-separate-helpfiles=%{_datadir}/bash/helpfiles \
 	$READLINE
+  sed -rn '/Configuration feature settings controllable by autoconf/,/End of configuration settings controllable by autoconf/p' <  config.h
   profilecflags=CFLAGS="$CFLAGS"
 %if 0%{?do_profiling}
   profilecflags=CFLAGS="$CFLAGS %cflags_profile_generate"