Sync from SUSE:SLFO:Main bash revision a69d6f7a42754b16cf813d5870d3a7ce

This commit is contained in:
Adrian Schröter 2024-05-03 11:15:47 +02:00
commit 16648e46f9
35 changed files with 5929 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

6
baselibs.conf Normal file
View File

@ -0,0 +1,6 @@
targettype x86 package bash
+^/usr/bin/bash$
+^/usr/bin/sh$
+^/bin/bash$
+^/bin/sh$
prereq -glibc-x86

65
bash-2.03-manual.patch Normal file
View File

@ -0,0 +1,65 @@
---
doc/bash.1 | 16 ++++++++++++++++
doc/builtins.1 | 2 +-
doc/rbash.1 | 2 +-
3 files changed, 18 insertions(+), 2 deletions(-)
--- doc/bash.1
+++ 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.
+.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.
@@ -7667,6 +7673,11 @@ Apply the following `\fBs\fP' modifier o
.SH "SHELL BUILTIN COMMANDS"
.\" start of bash_builtins
.zZ
+.if !dFN \{\
+.de FN
+\fI\|\\$1\|\fP
+..
+.\}
.PP
Unless otherwise noted, each builtin command documented in this
section as accepting options preceded by
@@ -11543,6 +11554,11 @@ process or job waited for.
.SH "RESTRICTED SHELL"
.\" rbash.1
.zY
+.if !dFN \{\
+.de FN
+\fI\|\\$1\|\fP
+..
+.\}
.PP
If
.B bash
--- doc/builtins.1
+++ 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
.nr zZ 1
-.so bash.1
+.so /usr/share/man/man1/bash.1
.SH SEE ALSO
bash(1), sh(1)
--- doc/rbash.1
+++ 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
.nr zY 1
-.so bash.1
+.so /usr/share/man/man1/bash.1
.SH SEE ALSO
bash(1)

17
bash-3.0-evalexp.patch Normal file
View File

@ -0,0 +1,17 @@
---
expr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- expr.c
+++ expr.c 2018-11-29 08:10:59.542212175 +0000
@@ -514,8 +514,8 @@ expassign ()
value = expcond ();
if (curtok == EQ || curtok == OP_ASSIGN)
{
- int special, op;
- intmax_t lvalue;
+ int special, op = -1;
+ intmax_t lvalue = 0;
special = curtok == OP_ASSIGN;

View File

@ -0,0 +1,33 @@
---
locale.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- locale.c
+++ locale.c 2018-09-20 08:06:23.732593807 +0000
@@ -33,6 +33,10 @@
#include "bashintl.h"
#include "bashansi.h"
#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
#include "chartypes.h"
#include <errno.h>
@@ -79,6 +83,15 @@ void
set_default_locale ()
{
#if defined (HAVE_SETLOCALE)
+ struct stat st;
+
+ if (stat("/usr/lib/locale/locale-archive", &st) == 0 && st.st_size == 0) {
+ errno = EINVAL;
+ sys_error("set_default_locale: broken locale");
+ fprintf (stderr, "%s: Please remove /usr/lib/locale/locale-archive\n",
+ get_name_for_error());
+ sleep(1);
+ }
default_locale = setlocale (LC_ALL, "");
if (default_locale)
default_locale = savestring (default_locale);

49
bash-3.2-printf.patch Normal file
View File

@ -0,0 +1,49 @@
---
builtins/printf.def | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- builtins/printf.def
+++ builtins/printf.def 2022-06-22 06:26:14.069158235 +0000
@@ -56,6 +56,7 @@ error occurs.
$END
#include <config.h>
+#include <locale.h>
#include "../bashtypes.h"
@@ -702,7 +703,7 @@ printf_builtin (list)
case 'A':
#endif
{
- char *f;
+ char *f, *lce = getenv("LC_NUMERIC"), *lcl = setlocale(LC_NUMERIC, NULL);
if (use_Lmod || posixly_correct == 0)
{
@@ -710,7 +711,12 @@ printf_builtin (list)
p = getfloatmax ();
f = mklong (start, "L", 1);
+
+ if (lce && lcl) setlocale(LC_NUMERIC, lce);
+
PF (f, p);
+
+ if (lce && lcl) setlocale(LC_NUMERIC, lcl);
}
else /* posixly_correct */
{
@@ -718,7 +724,12 @@ printf_builtin (list)
p = getdouble ();
f = mklong (start, "", 0);
+
+ if (lce && lcl) setlocale(LC_NUMERIC, lce);
+
PF (f, p);
+
+ if (lce && lcl) setlocale(LC_NUMERIC, lcl);
}
break;

41
bash-4.0-setlocale.dif Normal file
View File

@ -0,0 +1,41 @@
---
locale.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
--- locale.c
+++ locale.c 2018-09-20 08:14:41.307485537 +0000
@@ -57,6 +57,7 @@ extern int dump_translatable_strings, du
/* The current locale when the program begins */
static char *default_locale;
+static char fallback[128];
/* The current domain for textdomain(3). */
static char *default_domain;
@@ -361,11 +362,21 @@ get_locale_var (var)
if (locale == 0 || *locale == 0)
locale = lang;
if (locale == 0 || *locale == 0)
-#if 0
- locale = default_locale; /* system-dependent; not really portable. should it be "C"? */
-#else
- locale = "";
-#endif
+ {
+ char *ptr;
+ if (default_locale && *default_locale && (ptr = strstr(default_locale, var)) && (ptr = strchr(ptr, '=')) && ++ptr)
+ {
+ memset (fallback, 0, sizeof(fallback));
+ strncpy(fallback, ptr, sizeof(fallback)-1);
+
+ if ((ptr = strchr(fallback, ';')))
+ *ptr = '\0';
+
+ locale = fallback;
+ }
+ else
+ locale = default_locale; /* system-dependent; not really portable. should it be "C"? */
+ }
return (locale);
}

65
bash-4.1-bash.bashrc.dif Normal file
View File

@ -0,0 +1,65 @@
|BNC#577221 - Non-login, interactive bash executes /etc/bash.bashrc
| yet not documented
|
|Jared Hudson 2010-02-04 22:47:01 UTC
|
|bash-3.2-147.4.1 executes /etc/bash.bashrc when invoking an interactive,
|non-login shell yet this is not documented. The man page should mention
|this in its INVOCATION section. I've checked the source code and it's
|hard coded to execute /etc/bash.bashrc (SYS_BASHRC macro)
|
|BSC#959755 - man page on bash needs some clarification.
|
|Werner Fink 2016-08-01 12:40:06 UTC
|
|Make clear that the files /etc/profile as well as /etc/bash.bashrc may source
|other files as well even if the bash does not.
|
---
doc/bash.1 | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
--- doc/bash.1
+++ doc/bash.1 2022-06-22 06:31:11.283670836 +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.
+Please note that the file \fI/etc/profile\fP includes an autodetection shell
+code wether it has to source \fI/etc/bash.bashrc\fP as well as \fI~/.bashrc\fP.
.PP
When an interactive login shell exits,
or a non-interactive login shell executes the \fBexit\fP builtin command,
@@ -339,13 +341,19 @@ 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.
-This may be inhibited by using the
+reads and executes commands from \fI/etc/bash.bashrc\fP then \fI~/.bashrc\fP
+when those files exist and are readable. 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.
+Please note that the file \fI/etc/bash.bashrc\fP includes an autodetection shell
+code wether it is used for by a remote OpenSSH SSH client like
+.BR ssh (1)
+or
+.BR slogin (1)
+to source the local \fI/etc/profile\fP if not already done.
.PP
When
.B bash
@@ -432,8 +440,8 @@ or the secure shell daemon \fIsshd\fP.
If
.B bash
determines it is being run non-interactively in this fashion,
-it reads and executes commands from \fI~/.bashrc\fP,
-if that file exists and is readable.
+it reads and executes commands from \fI/etc/bash.bashrc\fP then
+\fI~/.bashrc\fP, when those files exists and are readable.
It will not do this if invoked as \fBsh\fP.
The
.B \-\-norc

20
bash-4.1-completion.dif Normal file
View File

@ -0,0 +1,20 @@
---
bashline.c | 7 +++++++
1 file changed, 7 insertions(+)
--- bashline.c
+++ bashline.c 2018-11-29 08:12:25.876588305 +0000
@@ -2206,6 +2206,13 @@ globword:
return ((char *)NULL);
}
+ if (GLOB_FAILED (glob_matches) || glob_matches == 0)
+ {
+ glob_ignore_case = old_glob_ignore_case;
+ glob_matches = (char **)NULL;
+ return ((char *)NULL);
+ }
+
while (val = glob_matches[local_index++])
{
if (executable_or_directory (val))

BIN
bash-4.2-history-myown.dif.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

51
bash-4.2-nscdunmap.dif Normal file
View File

@ -0,0 +1,51 @@
---
shell.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
--- shell.c
+++ shell.c 2018-09-20 08:08:34.242204532 +0000
@@ -43,6 +43,7 @@
#endif
#if defined (HAVE_UNISTD_H)
+# include <sys/types.h>
# include <unistd.h>
#endif
@@ -1888,6 +1893,28 @@ init_interactive_script ()
#endif
}
+static void
+maybe_unmap_nscd (void)
+{
+ unsigned long start, end, off;
+ char path[PATH_MAX];
+ FILE *maps;
+
+ if (getppid() != 1)
+ return;
+ if ((maps = fopen("/proc/self/maps", "r")) == NULL)
+ return;
+
+ while (fscanf(maps, "%lx-%lx %*s %lx %*x:%*x %*lu %s", &start, &end, &off, &path[0]) == 4)
+ {
+ if (strncmp(path, "/var/run/nscd/", 14) != 0)
+ continue;
+ munmap((void*)start, end - start);
+ }
+
+ fclose(maps);
+}
+
void
get_current_user_info ()
{
@@ -1919,6 +1946,7 @@ get_current_user_info ()
#if defined (HAVE_GETPWENT)
endpwent ();
#endif
+ maybe_unmap_nscd ();
}
}

122
bash-4.3-2.4.4.patch Normal file
View File

@ -0,0 +1,122 @@
---
array.c | 2 +-
examples/loadables/tee.c | 3 ++-
hashlib.c | 4 ++--
jobs.c | 9 +++++++++
sig.c | 4 ++--
sig.h | 4 ++--
trap.c | 2 +-
trap.h | 2 +-
8 files changed, 20 insertions(+), 10 deletions(-)
--- array.c
+++ array.c 2020-10-12 16:00:37.207185803 +0000
@@ -1095,7 +1095,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
*/
-int interrupt_immediately = 0;
+volatile sig_atomic_t interrupt_immediately = 0;
int
signal_is_trapped(s)
--- examples/loadables/tee.c
+++ examples/loadables/tee.c 2020-10-12 16:00:37.267184666 +0000
@@ -35,6 +35,7 @@
#include "bashansi.h"
#include <stdio.h>
+#include <signal.h>
#include <errno.h>
#include "builtins.h"
@@ -56,7 +57,7 @@ static FLIST *tee_flist;
#define TEE_BUFSIZE 8192
-extern int interrupt_immediately;
+extern volatile sig_atomic_t interrupt_immediately;
extern char *strerror ();
--- hashlib.c
+++ hashlib.c 2020-10-12 16:02:31.677016331 +0000
@@ -473,8 +473,8 @@ hash_pstats (table, name)
HASH_TABLE *table, *ntable;
-int interrupt_immediately = 0;
-int running_trap = 0;
+volatile sig_atomic_t interrupt_immediately = 0;
+volatile sig_atomic_t running_trap = 0;
int
signal_is_trapped (s)
--- jobs.c
+++ jobs.c 2020-10-12 16:00:37.267184666 +0000
@@ -2212,6 +2212,15 @@ make_child (command, flags)
child process, go back and change callers who free `command' in
the child process when this returns. */
mypid = getpid ();
+
+ if (interrupt_state)
+ {
+ struct timeval tv;
+ struct rusage rx;
+ (void) gettimeofday(&tv, NULL);
+ (void) getrusage(RUSAGE_SELF, &rx);
+ }
+
#if defined (BUFFERED_INPUT)
/* 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 2020-10-12 16:00:37.267184666 +0000
@@ -84,10 +84,10 @@ sigset_t top_level_mask;
#endif /* JOB_CONTROL */
/* When non-zero, we throw_to_top_level (). */
-int interrupt_immediately = 0;
+volatile sig_atomic_t interrupt_immediately = 0;
/* When non-zero, we call the terminating signal handler immediately. */
-int terminate_immediately = 0;
+volatile sig_atomic_t terminate_immediately = 0;
#if defined (SIGWINCH)
static SigHandler *old_winch = (SigHandler *)SIG_DFL;
--- sig.h
+++ sig.h 2020-10-12 16:03:44.403637781 +0000
@@ -105,8 +105,8 @@ do { \
extern volatile sig_atomic_t sigwinch_received;
extern volatile sig_atomic_t sigterm_received;
-extern int interrupt_immediately; /* no longer used */
-extern int terminate_immediately;
+extern volatile sig_atomic_t interrupt_immediately; /* no longer used */
+extern volatile sig_atomic_t terminate_immediately;
/* Functions from sig.c. */
extern sighandler termsig_sighandler PARAMS((int));
--- trap.c
+++ trap.c 2020-10-12 16:08:10.102600477 +0000
@@ -111,7 +111,7 @@ int pending_traps[NSIG];
Used in execute_cmd.c and builtins/common.c to clean up when
parse_and_execute does not return normally after executing the
trap command (e.g., when `return' is executed in the trap command). */
-int running_trap;
+volatile sig_atomic_t running_trap;
/* Set to last_command_exit_value before running a trap. */
int trap_saved_exit_value;
--- trap.h
+++ trap.h 2020-10-12 16:05:57.105122164 +0000
@@ -62,7 +62,7 @@ extern char *trap_list[];
extern int trapped_signal_received;
extern int wait_signal_received;
-extern int running_trap;
+extern volatile sig_atomic_t running_trap;
extern int trap_saved_exit_value;
extern int suppress_debug_trap_verbose;

328
bash-4.3-SJIS.patch Normal file
View File

@ -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)

14
bash-4.3-decl.patch Normal file
View File

@ -0,0 +1,14 @@
---
support/printenv.c | 1 +
1 file changed, 1 insertion(+)
--- support/printenv.c
+++ support/printenv.c 2014-04-17 09:46:25.874236036 +0000
@@ -31,6 +31,7 @@
#include "bashansi.h"
#include <stdio.h> /* puts */
+#include <string.h>
extern char **environ;
int

View File

@ -0,0 +1,93 @@
---
builtins/shopt.def | 2 ++
doc/bash.1 | 7 +++++++
execute_cmd.h | 1 +
shell.c | 2 ++
variables.c | 7 ++++++-
5 files changed, 18 insertions(+), 1 deletion(-)
--- builtins/shopt.def
+++ 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;
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 },
+ { "import-functions", &import_functions, (shopt_set_func_t *)NULL },
{ "inherit_errexit", &inherit_errexit, (shopt_set_func_t *)NULL },
{ "interactive_comments", &interactive_comments, set_shellopts_after_change },
{ "lastpipe", &lastpipe_opt, (shopt_set_func_t *)NULL },
--- doc/bash.1
+++ 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
+.B \-\-import\-functions
+This shell is patched in such a way that shell functions in the inported environment
+will not be expanded due several security issues (e.g. CVE\-2014\-6271). This option
+can be used to enable this. It is also possible to use the
+.B shopt
+builtin to do this.
+.TP
.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 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
+int import_functions = IMPORT_FUNCTIONS_DEF; /* Import functions from environment */
/* Some long-winded argument names. These are obviously new. */
#define Int 1
@@ -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 },
+ { "import-functions", Int, &import_functions, (char **)0x0 },
{ "noediting", Int, &no_line_editing, (char **)0x0 },
{ "noprofile", Int, &no_profile, (char **)0x0 },
{ "norc", Int, &no_rc, (char **)0x0 },
--- variables.c
+++ 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 */
+ if (!import_functions && !interactive_shell) {
+ report_error (_("Skipping importing function definition for `%s': --import-functions required."), tname);
+ goto reval;
+ }
+
string_length = strlen (string);
temp_string = (char *)xmalloc (namelen + string_length + 2);
@@ -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 */
-
+ reval:
if (temp_var = find_function (tname))
{
VSETATTR (temp_var, (att_exported|att_imported));

View File

@ -0,0 +1,16 @@
---
shell.h | 3 +++
1 file changed, 3 insertions(+)
--- shell.h
+++ shell.h 2016-03-08 10:22:38.169929522 +0000
@@ -22,6 +22,9 @@
#include "config.h"
#endif
+#include <sys/types.h>
+#include <unistd.h>
+
#include "bashjmp.h"
#include "command.h"

97
bash-4.3-loadables.dif Normal file
View File

@ -0,0 +1,97 @@
---
examples/loadables/finfo.c | 3 +--
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, 3 insertions(+), 12 deletions(-)
--- examples/loadables/finfo.c
+++ examples/loadables/finfo.c 2018-09-20 08:07:43.739129083 +0000
@@ -108,7 +108,7 @@ int argc;
char **argv;
{
register int i;
- int mode, flags, opt;
+ int flags, opt;
sh_optind = 0; /* XXX */
prog = base_pathname(argv[0]);
@@ -396,7 +396,6 @@ finfo_builtin(list)
{
int c, r;
char **v;
- WORD_LIST *l;
v = make_builtin_argv (list, &c);
r = finfo_main (c, v);
--- examples/loadables/head.c
+++ examples/loadables/head.c 2018-09-20 08:07:43.739129083 +0000
@@ -101,8 +101,6 @@ head_builtin (list)
WORD_LIST *l;
FILE *fp;
- char *t;
-
munge_list (list); /* change -num into -n num */
reset_internal_getopt ();
--- examples/loadables/id.c
+++ 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;
-static char *id_user;
-
static int inituser ();
static int id_pruser ();
--- examples/loadables/mkdir.c
+++ 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++;
- while (p = strchr (p, '/'))
+ while ((p = strchr (p, '/')))
{
*p = '\0';
if (stat (npath, &sb) != 0)
--- examples/loadables/pathchk.c
+++ 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;
-#ifdef lint
/* Suppress `used before initialized' warning. */
exists = 0;
-#endif
/* Figure out the parent of the first element in PATH. */
parent = xstrdup (*path == '/' ? "/" : ".");
--- examples/loadables/print.c
+++ 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;
intmax_t lfd;
- char **v, *pfmt, *arg;
+ char *pfmt;
WORD_LIST *l;
nflag = raw = sflag = 0;
--- examples/loadables/tee.c
+++ examples/loadables/tee.c 2018-09-20 08:07:43.739129083 +0000
@@ -70,8 +70,6 @@ tee_builtin (list)
FLIST *fl;
char *buf, *bp;
- char *t;
-
reset_internal_getopt ();
append = nointr = 0;
tee_flist = (FLIST *)NULL;

97
bash-4.3-pathtemp.patch Normal file
View File

@ -0,0 +1,97 @@
---
lib/sh/tmpfile.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
--- lib/sh/tmpfile.c
+++ lib/sh/tmpfile.c 2018-01-24 12:38:42.410481352 +0000
@@ -36,6 +36,14 @@
#include <stdio.h>
#include <errno.h>
+#if defined(__linux__)
+# include <sys/statfs.h>
+# include <unistd.h>
+# ifndef TMPFS_MAGIC
+# define TMPFS_MAGIC 0x01021994
+# endif
+#endif
+
#include <shell.h>
#ifndef errno
@@ -65,6 +73,8 @@ static unsigned long filenum = 1L;
static char *
get_sys_tmpdir ()
{
+ static int doshm;
+
if (sys_tmpdir)
return sys_tmpdir;
@@ -91,6 +101,31 @@ get_sys_tmpdir ()
return sys_tmpdir;
}
+#if defined(__linux__)
+static int
+emergency_sys_tmpdir ()
+{
+ static char *shm = "/dev/shm";
+ static size_t pgsz;
+ struct statfs fs;
+ static int doshm;
+
+ if (getuid() != 0)
+ return 0;
+
+ if (doshm)
+ return 0;
+
+ doshm++;
+
+ if (statfs(shm, &fs) < 0 || fs.f_type != TMPFS_MAGIC || eaccess(shm, W_OK|X_OK))
+ return 0;
+
+ sys_tmpdir = shm;
+ return 1;
+}
+#endif
+
static char *
get_tmpdir (flags)
int flags;
@@ -194,7 +229,8 @@ sh_mktmpfd (nameroot, flags, namep)
{
char *filename, *tdir, *lroot;
int fd, tdlen;
-
+
+enospace:
filename = (char *)xmalloc (PATH_MAX + 1);
tdir = get_tmpdir (flags);
tdlen = strlen (tdir);
@@ -217,6 +253,10 @@ sh_mktmpfd (nameroot, flags, namep)
free (filename);
filename = NULL;
}
+
+ if (fd < 0 && errno == ENOSPC && emergency_sys_tmpdir())
+ goto enospace;
+
if (namep)
*namep = filename;
return fd;
@@ -235,6 +275,13 @@ sh_mktmpfd (nameroot, flags, namep)
}
while (fd < 0 && errno == EEXIST);
+ if (fd < 0 && errno == ENOSPC && emergency_sys_tmpdir())
+ {
+ free (filename);
+ filename = NULL;
+ goto enospace;
+ }
+
if (namep)
*namep = filename;
else

31
bash-4.3-perl522.patch Normal file
View File

@ -0,0 +1,31 @@
From: coolo@suse.com
perl 5.22 makes the long deprecated defined(@array) an hard
error
---
support/texi2html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- support/texi2html
+++ support/texi2html 2016-03-08 11:49:40.596622296 +0000
@@ -4855,9 +4855,9 @@ sub update_sec_num {
my $ret;
$level--; # here we start at 0
- if ($name =~ /^appendix/ || defined(@appendix_sec_num)) {
+ if ($name =~ /^appendix/ || @appendix_sec_num) {
# appendix style
- if (defined(@appendix_sec_num)) {
+ if (@appendix_sec_num) {
&incr_sec_num($level, @appendix_sec_num);
} else {
@appendix_sec_num = ('A', 0, 0, 0);
@@ -4865,7 +4865,7 @@ sub update_sec_num {
$ret = join('.', @appendix_sec_num[0..$level]);
} else {
# normal style
- if (defined(@normal_sec_num))
+ if (@normal_sec_num)
{
&incr_sec_num($level, @normal_sec_num);
}

26
bash-4.3-sigrestart.patch Normal file
View File

@ -0,0 +1,26 @@
---
sig.c | 6 ++++++
1 file changed, 6 insertions(+)
--- sig.c
+++ sig.c 2018-11-29 08:13:00.103944580 +0000
@@ -814,6 +814,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 */
/* Let's see if we can keep SIGWINCH from interrupting interruptible system
calls, like open(2)/read(2)/write(2) */
#if defined (SIGWINCH)
@@ -826,6 +826,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 */
+ else if (handler == (termsig_sighandler))
+ act.sa_flags |= SA_NODEFER; /* XXX */
+ if (sig == SIGTSTP || sig == SIGTTOU || sig == SIGTTIN || sig == SIGCONT)
+ act.sa_flags |= SA_NODEFER; /* XXX */
sigemptyset (&act.sa_mask);
sigemptyset (&oact.sa_mask);

15
bash-4.3-winch.dif Normal file
View File

@ -0,0 +1,15 @@
---
config-top.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- config-top.h
+++ 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. */
-#define CHECKWINSIZE_DEFAULT 0
+#define CHECKWINSIZE_DEFAULT 1
/* Define to 1 if you want to optimize for sequential array assignment when
using indexed arrays, 0 if you want bash-4.2 behavior, which favors

BIN
bash-5.2-patches.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

240
bash-5.2.dif Normal file
View File

@ -0,0 +1,240 @@
---
Makefile.in | 2 +-
config-top.h | 16 ++++++++++------
doc/Makefile.in | 2 +-
doc/bash.1 | 7 +++++--
general.h | 3 +++
parse.y | 2 +-
shell.c | 6 +++++-
support/man2html.c | 1 +
support/rlvers.sh | 6 +++---
support/shobj-conf | 5 +++--
tests/glob.tests | 4 ++--
tests/run-intl | 2 +-
tests/run-read | 2 +-
13 files changed, 37 insertions(+), 21 deletions(-)
--- Makefile.in
+++ Makefile.in 2022-06-22 06:38:20.511747259 +0000
@@ -466,7 +466,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 \
- make_cmd.h subst.h sig.h externs.h builtins.h \
+ make_cmd.h subst.h sig.h externs.h builtins.h bashline.h \
bashtypes.h xmalloc.h config-top.h config-bot.h \
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 2022-04-28 11:55:03.660248012 +0000
@@ -60,10 +60,14 @@
due to EPIPE. */
/* #define DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS */
+#ifndef _PATH_DEFPATH
+# include <paths.h>
+#endif
+
/* The default value of the PATH variable. */
#ifndef DEFAULT_PATH_VALUE
#define DEFAULT_PATH_VALUE \
- "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:."
+ "/usr/local/bin:" _PATH_DEFPATH ":."
#endif
/* 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 \
- "/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc"
+ _PATH_STDPATH
#endif
/* The default path for enable -f */
@@ -97,20 +101,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). */
--- doc/Makefile.in
+++ doc/Makefile.in 2022-04-28 11:53:04.334380153 +0000
@@ -153,7 +153,7 @@ BASHREF_FILES = $(srcdir)/bashref.texi $
# $(RM) $@
# -${TEXI2PDF} $<
-all: ps info dvi text html $(MAN2HTML)
+all: info html $(MAN2HTML)
nodvi: ps info text html
everything: all pdf
--- doc/bash.1
+++ doc/bash.1 2022-06-22 06:37:14.908958305 +0000
@@ -5745,8 +5745,8 @@ file (the \fIinputrc\fP file).
The name of this file is taken from the value of the
.SM
.B INPUTRC
-variable. If that variable is unset, the default is
-.IR ~/.inputrc .
+environment variable. If that variable is unset, readline will read both
+.IR /etc/inputrc " and " ~/.inputrc .
If that file does not exist or cannot be read, the ultimate default is
.IR /etc/inputrc .
When a program which uses the readline library starts up, the
@@ -11706,6 +11706,9 @@ command history
.TP
.FN ~/.inputrc
Individual \fIreadline\fP initialization file
+.TP
+.FN /etc/inputrc
+System \fBreadline\fP initialization file
.PD
.SH AUTHORS
Brian Fox, Free Software Foundation
--- general.h
+++ general.h 2022-04-28 11:53:04.334380153 +0000
@@ -21,10 +21,13 @@
#if !defined (_GENERAL_H_)
#define _GENERAL_H_
+#include <time.h>
+#include <sys/types.h>
#include "stdc.h"
#include "bashtypes.h"
#include "chartypes.h"
+#include "bashline.h"
#if defined (HAVE_SYS_RESOURCE_H) && defined (RLIMTYPE)
# if defined (HAVE_SYS_TIME_H)
--- parse.y
+++ parse.y 2022-04-28 11:53:04.334380153 +0000
@@ -1498,7 +1498,7 @@ input_file_descriptor ()
#if defined (READLINE)
char *current_readline_prompt = (char *)NULL;
-char *current_readline_line = (char *)NULL;
+unsigned char *current_readline_line = (unsigned char *)NULL;
int current_readline_line_index = 0;
static int
--- shell.c
+++ shell.c 2022-04-28 11:56:12.623015117 +0000
@@ -45,6 +45,7 @@
#if defined (HAVE_UNISTD_H)
# include <sys/types.h>
# include <unistd.h>
+# include <grp.h>
#endif
#include "bashintl.h"
@@ -511,7 +512,7 @@ main (argc, argv, env)
read_but_dont_execute = 1;
#endif
- if (running_setuid && privileged_mode == 0)
+ if (running_setuid && privileged_mode == 0 /* && act_like_sh == 0 */)
disable_priv_mode ();
/* Need to get the argument to a -c option processed in the
@@ -1341,6 +1342,9 @@ disable_priv_mode ()
{
int e;
+ if (!current_user.user_name)
+ get_current_user_info();
+ initgroups (current_user.user_name, current_user.gid);
#if HAVE_SETRESUID
if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0)
#else
--- support/man2html.c
+++ support/man2html.c 2022-04-28 11:53:04.338380081 +0000
@@ -78,6 +78,7 @@
#include <time.h>
#include <sys/time.h>
#include <errno.h>
+#include <unistd.h>
#define NULL_TERMINATED(n) ((n) + 1)
--- support/rlvers.sh
+++ support/rlvers.sh 2022-04-28 11:53:04.338380081 +0000
@@ -27,10 +27,10 @@ TDIR=$TMPDIR/rlvers
# defaults
CC=cc
-RL_LIBDIR=/usr/local/lib
-RL_INCDIR=/usr/local/include
+RL_LIBDIR=/lib
+RL_INCDIR=/usr/include
-TERMCAP_LIB="-ltermcap"
+echo 'int main () { return 0; }' | gcc -ltinfo -o /dev/null -xc - > /dev/null 2>&1 && TERMCAP_LIB="-ltinfo" || TERMCAP_LIB="-lncurses"
# cannot rely on the presence of getopts
while [ $# -gt 0 ]; do
--- support/shobj-conf
+++ support/shobj-conf 2022-04-28 11:57:29.117647038 +0000
@@ -126,10 +126,11 @@ sunos5*|solaris2*)
linux*-*|gnu*-*|k*bsd*-gnu-*|midnightbsd*|freebsd*|dragonfly*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
- SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+ SHOBJ_LDFLAGS='-shared'
- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
+ SHLIB_XLDFLAGS='-Wl,-rpath-link,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ echo 'int main () { return 0; }' | gcc -ltinfo -o /dev/null -xc - > /dev/null 2>&1 && SHLIB_LIBS=-ltinfo || SHLIB_LIBS=-lncurses
;;
# Darwin/MacOS X
--- tests/glob.tests
+++ tests/glob.tests 2022-04-28 11:53:04.338380081 +0000
@@ -34,8 +34,8 @@ ${THIS_SH} ./glob10.sub
MYDIR=$PWD # save where we are
-TESTDIR=$TMPDIR/glob-test-$$
-mkdir $TESTDIR
+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 2022-04-28 11:58:22.140698412 +0000
@@ -2,4 +2,4 @@
( diff -a ./intl.right ./intl.right >/dev/null 2>&1 ) && AFLAG=-a
${THIS_SH} ./intl.tests > ${BASH_TSTOUT}
-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 2022-04-28 11:53:04.338380081 +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
${THIS_SH} ./read.tests > ${BASH_TSTOUT} 2>&1
-diff ${BASH_TSTOUT} read.right && rm -f ${BASH_TSTOUT}
+diff -w ${BASH_TSTOUT} read.right && rm -f ${BASH_TSTOUT}

BIN
bash-5.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
bash-5.2.tar.gz.sig Normal file

Binary file not shown.

5
bash-rpmlintrc Normal file
View File

@ -0,0 +1,5 @@
addFilter(".*shared-library-without-dependency-information.*")
addFilter(".*zero-length.*/etc/skel/\..*")
addFilter(".*call-to-mktemp.*/usr/bin/bash.*")
addFilter(".*W:.*patch-not-applied.*Patch.*:.*bash-4\.3-winch\.dif.*")
addFilter(".*W:.*macro-in-comment.*%patch.*")

3627
bash.changes Normal file

File diff suppressed because it is too large Load Diff

25
bash.keyring Normal file
View File

@ -0,0 +1,25 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGiBEEOsGwRBACFa0A1oa71HSZLWxAx0svXzhOZNQZOzqHmSuGOG92jIpQpr8Dp
vgRh40YpAwdcXb8QG1J5yGAKeevNE1zCFaA725vGSdHUyypHouV0xoWwukYO6qly
yX+2BZU+okBUqoWQkoWxiYaCSfzB2Ln7pmdys1fJhcgBKf3VjWCjd2XJTwCgoFJO
wyBFJdugjfwjSoRSwDOIMf0D/iQKqlWhIO1LGpMrGX0il0/x4zj0NAcSwAk7LaPZ
bN4UPjn5pqGEHBlf1+xDDQCkAoZ/VqESGZragl4VqJfxBr29Ag0UDvNbUbXoxQsA
Rdero1M8GiAIRc50hj7HXFoERwenbNDJL86GPLAQOTGOCa4W2o29nFfFjQrsrrYH
zVtyA/9oyKvTeEMJ7NA3VJdWcmn7gOu0FxEmSNhSoV1T4vP21Wf7f5niCCRKQLNy
Uy0wEApQi4tSysdz+AbgAc0b/bHYVzIf2uO2lIEZQNNt+3g2bmXgloWmW5fsm/di
50Gm1l1Na63d3RZ00SeFQos6WEwLUHEB0yp6KXluXLLIZitEJIheBBAWCAAGBQJa
Xm/3AAoJEBu4nAYCNnRJGPQBAM2cca3+cMUKWtSTxt4gYWBbV+ORFbJtbprOmukg
QNnEAQDrFDHtP9Wzo+R+0O7xUXjrkem0HcZmUKQPTim61wDRDbQaQ2hldCBSYW1l
eSA8Y2hldEBjd3J1LmVkdT6IZgQTEQIAHgUCQQ6wbAIbAwYLCQgHAwIDFQIDAxYC
AQIeAQIXgAASCRC7WGnwZOp0qwdlR1BHAAEBzs0An30UTMW8N1jOoJzNcXoopeLt
g3k4AJ9pwNiyhlyeezLsSMFkvTPAbBv+wbkBDQRBDrBvEAQAkK6TAOKBEM+EC4j6
V/7o/riVZqcgU5cid2qG9TXdwNtD9a3kvA/ObZBO93sX59wc6Bnwo4VJxsOmMlpG
rAjJsxNwg3QHakEtf8LXRbVpj5xStdmBdQZUhIQyalo/2/TZq5OijtddUQcL5cs7
0hTv/FpT3wUvr2Xr8rjF41IFEz8AAwcD/A0CZEGlzIrT5WCBnl6xBog/8vKiUCba
rByat3d1mL6DbizvKNXQRTC9E/vEdENAWCQCjr75Bu55xT8n3SXGtWdDC5xmZ/P3
OBYORP8yl8H8I1FIosWOFirbIeYdZPq8SPD1HL+EXo9zSiHVrrZRJ19ooCKKbSdX
HFCY+aJG+0KZiFEEGBECAAkFAkEOsG8CGwwAEgkQu1hp8GTqdKsHZUdQRwABAeNw
AJ9mWRUIPBrP81M71zLe3r2halU83ACdHB7SqT9Yv+B+EffjrGHkHccVsU0=
=PsQ4
-----END PGP PUBLIC KEY BLOCK-----

642
bash.spec Normal file
View File

@ -0,0 +1,642 @@
#
# spec file for package bash
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500
%bcond_with alternatives
%else
%bcond_without alternatives
%endif
# Unicode tests do alloc to much memory
%bcond_with altarray
%define rl_major 8
%define rl_version 8.2
%define bextend %{nil}
%define bversion 5.2
%define bpatchlvl %(bash %{_sourcedir}/get_version_number.sh %{_sourcedir})
%global _incdir %{_includedir}
%global _ldldir %{_libdir}/bash
%global _minsh 0
%bcond_with import_function
%bcond_with sjis
Name: bash
Version: %{bversion}.%{bpatchlvl}
Release: 0
Summary: The GNU Bourne-Again Shell
# The package bash-completion is a source of
# bugs which will hit at most this package
#Recommends: bash-completion
License: GPL-3.0-or-later
Group: System/Shells
URL: https://www.gnu.org/software/bash/bash.html
# Git: https://git.savannah.gnu.org/cgit/bash.git
Source0: https://ftp.gnu.org/gnu/bash/bash-%{bversion}%{bextend}.tar.gz
Source1: bash-%{bversion}-patches.tar.bz2
Source2: get_version_number.sh
Source4: run-tests
Source5: dot.bashrc
Source6: dot.profile
Source7: bash-rpmlintrc
Source8: baselibs.conf
# Remember unsafe method, compare with
# https://lists.gnu.org/archive/html/bug-bash/2011-03/msg00070.html
# https://lists.gnu.org/archive/html/bug-bash/2011-03/msg00071.html
# https://lists.gnu.org/archive/html/bug-bash/2011-03/msg00073.html
Source9: bash-4.2-history-myown.dif.bz2
Source10: https://ftp.gnu.org/gnu/bash/bash-%{bversion}%{bextend}.tar.gz.sig
# GPG key 7C0135FB088AAF6C66C650B9BB5869F064EA74AB Chet Ramey
Source11: bash.keyring
Patch0: bash-%{bversion}.dif
Patch1: bash-2.03-manual.patch
Patch3: bash-4.3-2.4.4.patch
Patch4: bash-3.0-evalexp.patch
Patch5: bash-3.0-warn-locale.patch
Patch7: bash-4.3-decl.patch
Patch9: bash-4.3-include-unistd.dif
Patch10: bash-3.2-printf.patch
Patch11: bash-4.3-loadables.dif
Patch12: bash-4.1-completion.dif
Patch13: bash-4.2-nscdunmap.dif
Patch14: bash-4.3-sigrestart.patch
# PATCH-FIX-UPSTREAM bnc#382214 -- disabled due bnc#806628 by -DBNC382214=0
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
# PATCH-FIX-SUSE
Patch50: quotes-man2html.patch
BuildRequires: autoconf
BuildRequires: bison
BuildRequires: fdupes
BuildRequires: glibc-locale
BuildRequires: glibc-locale-base
BuildRequires: makeinfo
BuildRequires: patchutils
BuildRequires: pkgconfig
BuildRequires: screen
BuildRequires: sed
%if %{with alternatives}
BuildRequires: update-alternatives
%endif
BuildRequires: pkgconfig(audit)
BuildRequires: pkgconfig(ncurses)
# This has to be always the same version as included in the bash its self
BuildRequires: pkgconfig(readline) = 8.2
%if %{with alternatives}
Requires(post): update-alternatives
Requires(post): libreadline%{rl_major} = %{rl_version}
Requires(preun):update-alternatives
%endif
Requires: libreadline%{rl_major} = %{rl_version}
Suggests: bash-doc = %{version}
Suggests: command-not-found
Provides: /bin/bash
%if %{with alternatives}
Provides: /bin/sh
%else
Suggests: bash-sh
%endif
%description
Bash is an sh-compatible command interpreter that executes commands
read from standard input or from a file. Bash incorporates useful
features from the Korn and C shells (ksh and csh). Bash is intended to
be a conformant implementation of the IEEE Posix Shell and Tools
specification (IEEE Working Group 1003.2).
%package doc
Summary: Documentation how to Use the GNU Bourne-Again Shell
Group: Documentation/HTML
Supplements: (bash and patterns-base-documentation)
Provides: bash:%{_infodir}/bash.info.gz
BuildArch: noarch
%description doc
This package contains the documentation for using the bourne shell
interpreter Bash.
%lang_package
%if %{without alternatives}
%package sh
Summary: Handle behaviour of /bin/sh
Group: System/Shells
Provides: alternative(sh)
Conflicts: alternative(sh)
PreReq: bash = %{version}
BuildArch: noarch
%description sh
Use bash as /bin/sh implementation.
%endif
%package devel
Summary: Include Files mandatory for Development of bash loadable builtins
Group: Development/Languages/C and C++
%description devel
This package contains the C header files for writing loadable new
builtins for the interpreter Bash. Use the output of the command
`pkg-config bash --cflags' on the compilers command line.
%package loadables
Summary: Loadable bash builtins
Group: System/Shells
%description loadables
This package contains the examples for the ready-to-dynamic-load
builtins found in the source tar ball of the bash:
basename Return non-directory portion of pathname.
cut cut(1) replacement.
dirname Return directory portion of pathname.
finfo Print file info.