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.
getconf POSIX.2 getconf utility.
head Copy first part of files.
id POSIX.2 user identity.
ln Make links.
logname Print login name of current user.
mkdir Make directories.
pathchk Check pathnames for validity and portability.
print Loadable ksh-93 style print builtin.
printenv Minimal builtin clone of BSD printenv(1).
push Anyone remember TOPS-20?
realpath Canonicalize pathnames, resolving symlinks.
rmdir Remove directory.
sleep sleep for fractions of a second.
strftime Loadable builtin interface to strftime(3).
sync Sync the disks by forcing pending filesystem writes to
complete.
tee Duplicate standard input.
tty Return terminal name.
uname Print system information.
unlink Remove a directory entry.
whoami Print out username of current user.
%if 0%{?suse_version} >= 1550
%package legacybin
Summary: Legacy usrmove helper files
Group: System/Shells
Requires: bash = %{version}-%{release}
Requires: this-is-only-for-build-envs
Conflicts: rpmlib(X-CheckUnifiedSystemdir)
BuildArch: noarch
%description legacybin
Legacy usrmove helper files for the build system. Do not install.
%endif
%prep
%if %{with sjis}
%{warn:Shift JIS support is enabled}
%else
%{echo:Shift JIS support disabled}
%endif
%setup -q -n bash-%{bversion}%{bextend} -b1
typeset -i level
set +x
for patch in ../bash-%{bversion}-patches/*-*[0-9]; do
test -e $patch || break
let level=0 || true
file=$(lsdiff --files=1 $patch)
if test ! -e $file ; then
file=${file#*/}
let level++ || true
fi
test -e $file || exit 1
sed -ri '/^\*\*\* \.\./{ s@\.\./bash-%{bversion}[^/]*/@@ }' $patch
echo Patch $patch
patch -s -p$level < $patch
done
set -x
%patch1 -b .manual
%patch3 -b .2.4.4
%patch4 -b .evalexp
%patch5 -b .warnlc
%patch7 -b .decl
%patch9 -b .unistd
%patch10 -b .printf
%patch11 -b .plugins
%patch12 -b .completion
%patch13 -b .nscdunmap
%patch14 -b .sigrestart
%patch16 -b .setlocale
#%patch18 -p0 -b .winch
%patch40 -b .bashrc
%if %{with sjis}
%patch42 -b .sjis
%endif
%patch46 -b .notimestamp
%patch47 -b .perl522
%if %{with import_function}
%patch48 -b .eif
%endif
%patch49 -b .pthtmp
%patch50 -b .qd
%patch0
# 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' %{_includedir}/readline/readline.h))
test ${rl1[2]} = ${rl2[2]} || exit 1
# Sometimes we face major ABI change(s) but only a minor version change
rl1=($(sed -rn '/RL_VERSION_MAJOR/p' lib/readline/readline.h))
test ${rl1[2]} = %{rl_major} || exit 1
rl2=($(sed -rn '/RL_VERSION_MINOR/p' lib/readline/readline.h))
test ${rl1[2]}.${rl2[2]} = %{rl_version} || exit 1
%if 0%{?qemu_user_space_build}
# Something in qemu clobbers the signal mask to block SIGALRM during the
# execution of this test, causing it to hang. Skip it.
echo exit 0 > tests/read7.sub
%endif
%build
LANG=POSIX
LC_ALL=$LANG
unset LC_CTYPE
SCREENDIR=$(mktemp -d ${PWD}/screen.XXXXXX) || exit 1
SCREENRC=${SCREENDIR}/bash
export SCREENRC SCREENDIR
exec 0< /dev/null
SCREENLOG=${SCREENDIR}/log
cat > $SCREENRC<<-EOF
deflogin off
deflog on
logfile $SCREENLOG
logfile flush 1
logtstamp off
log on
setsid on
scrollback 0
silence on
utf8 on
EOF
HOSTTYPE=%{_target_cpu}
VENDOR=%{_target_vendor}
OSTYPE=%{_target_os}
MACHTYPE=${HOSTTYPE}-${VENDOR}-${OSTYPE}
export LANG LC_ALL HOSTTYPE VENDOR OSTYPE MACHTYPE
cflags ()
{
local flag=$1; shift
local var=$1; shift
test -n "${flag}" -a -n "${var}" || return
case "${!var}" in
*${flag}*) return
esac
set -o noclobber
case "$flag" in
-Wl,*)
if echo 'int main () { return 0; }' | \
${CC:-gcc} -Werror $flag -o /dev/null -xc - > /dev/null 2>&1 ; then
eval $var=\${$var:+\$$var\ }$flag
fi
;;
*)
if ${CC:-gcc} -Werror ${flag/#-Wno-/-W} -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
eval $var=\${$var:+\$$var\ }$flag
fi
if ${CXX:-g++} -Werror ${flag/#-Wno-/-W} -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then
eval $var=\${$var:+\$$var\ }$flag
fi
esac
set +o noclobber
}
LARGEFILE="$(getconf LFS_CFLAGS)"
CFLAGS="%{optflags} $LARGEFILE -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g"
LDFLAGS=""
#
# Never ever put -DMUST_UNBLOCK_CHLD herein as this breaks bash
#
cflags -Wuninitialized CFLAGS
cflags -Wextra CFLAGS
cflags -Wno-unprototyped-calls CFLAGS
cflags -Wno-switch-enum CFLAGS
cflags -Wno-unused-variable CFLAGS
cflags -Wno-unused-parameter CFLAGS
cflags -Wno-parentheses CFLAGS
cflags -ftree-loop-linear CFLAGS
cflags -pipe CFLAGS
cflags -DBNC382214=0 CFLAGS
cflags -DIMPORT_FUNCTIONS_DEF=0 CFLAGS
cflags -Wl,--as-needed LDFLAGS
cflags -Wl,-O2 LDFLAGS
cflags -Wl,-rpath,%{_ldldir} LDFLAGS
# /proc is required for correct configuration
test -d /dev/fd || { echo "/proc is not mounted!" >&2; exit 1; }
CC=gcc
%if %{_minsh}
cflags -Os CFLAGS
# cflags -U_FORTIFY_SOURCE CFLAGS
# cflags -funswitch-loops CFLAGS
# cflags -ftree-loop-im CFLAGS
# cflags -ftree-loop-ivcanon CFLAGS
# cflags -fprefetch-loop-arrays CFLAGS
# cflags -fno-stack-protector CFLAGS
# cflags -fno-unwind-tables CFLAGS
# cflags -fno-asynchronous-unwind-tables CFLAGS
%endif
CFLAGS="$CFLAGS -DDEFAULT_LOADABLE_BUILTINS_PATH='\"%{_libdir}/%{name}\"'"
CC_FOR_BUILD="$CC"
CFLAGS_FOR_BUILD="$CFLAGS"
export CC_FOR_BUILD CFLAGS_FOR_BUILD CFLAGS LDFLAGS CC
autoconf
#
# We have a malloc with our glibc
#
SYSMALLOC="
--without-gnu-malloc
--without-bash-malloc
--enable-mem-scramble
"
#
# System readline library (comment out it not to be used)
#
READLINE="
--with-installed-readline
"
bash support/mkconffiles -v
%if %{_minsh}
./configure --build=%{_target_cpu}-suse-linux \
--prefix=%{_prefix} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--libdir=%{_libdir} \
--with-curses \
--with-afs \
--with-gnu-ld \
$SYSMALLOC \
--enable-minimal-config \
--enable-arith-for-command \
--enable-array-variables \
--disable-alt-array-implementation \
--enable-brace-expansion \
--enable-casemod-attributes \
--enable-casemod-expansion \
--enable-command-timing \
--enable-cond-command \
--enable-cond-regexp \
--enable-coprocesses \
--enable-directory-stack \
--enable-dparen-arithmetic \
--enable-extended-glob \
--enable-job-control \
--enable-net-redirections \
--enable-process-substitution \
--enable-glob-asciiranges-default \
--disable-strict-posix-default \
--enable-separate-helpfiles=%{_datadir}/bash/helpfiles \
$READLINE
%make_build Program=sh sh
%make_build distclean
%endif
./configure --build=%{_target_cpu}-suse-linux \
--prefix=%{_prefix} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--libdir=%{_libdir} \
--docdir=%{_docdir}/%{name} \
--with-curses \
--with-afs \
--with-gnu-ld \
$SYSMALLOC \
--enable-threads=posix \
--enable-job-control \
--enable-net-redirections \
--enable-alias \
--enable-readline \
--enable-history \
--enable-bang-history \
--enable-directory-stack \
--enable-process-substitution \
--enable-prompt-string-decoding \
--enable-select \
--enable-help-builtin \
--enable-separate-helpfiles \
--enable-array-variables \
%if %{with altarray}
--enable-alt-array-implementation \
%else
--disable-alt-array-implementation \
%endif
--enable-brace-expansion \
--enable-command-timing \
--enable-disabled-builtins \
--enable-glob-asciiranges-default \
--enable-translatable-strings \
--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}"
%endif
makeopts="Machine=${HOSTTYPE} OS=${OSTYPE} VENDOR=${VENDOR} MACHTYPE=${MACHTYPE}"
%make_build $makeopts "$profilecflags" \
all printenv recho zecho xcase
TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1
> $SCREENLOG
tail -q -s 0.5 -f $SCREENLOG & pid=$!
env -i HOME=$PWD TERM=$TERM LD_LIBRARY_PATH=$LD_RUN_PATH TMPDIR=$TMPDIR \
SCREENRC=$SCREENRC SCREENDIR=$SCREENDIR \
screen -D -m %make_build -j1 TESTSCRIPT=%{SOURCE4} check
kill -TERM $pid
%if 0%{?do_profiling}
rm -f jobs.gcda
profilecflags=CFLAGS="$CFLAGS %{cflags_profile_feedback} -fprofile-correction"
%make_build $makeopts "$profilecflags" clean
%endif
%make_build $makeopts "$profilecflags" all
%make_build $makeopts -C examples/loadables/
%make_build $makeopts documentation
grep -F '$'\' doc/bash.html %{nil:test for boo#1203091}
%check
%make_build -j1 check
%install
%make_install
make -C examples/loadables/ install-supported DESTDIR=%{buildroot} libdir=%{_libdir}
mv -vf %{buildroot}%{_ldldir}/*.h %{buildroot}%{_includedir}/bash/
mv -vf %{buildroot}%{_ldldir}/*.inc %{buildroot}%{_datadir}/bash
rm -rf %{buildroot}/%{_lib}/pkgconfig
sed -ri '/CC = gcc/s@(CC = gcc).*@\1@' %{buildroot}%{_libdir}/pkgconfig/bash.pc
%if %{with alternatives}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
%endif
#
# It should be noted that the move of /bin/bash to /usr/bin/bash
# had NOT done by me at 2019/02/08. Now only a symbolic link
# remains here :(
# The same had happen for the system POSIX shell /bin/sh
#
mkdir -p %{buildroot}/bin
ln -sf %{_bindir}/bash %{buildroot}/bin/bash
ln -sf %{_bindir}/sh %{buildroot}/bin/sh
ln -sf bash %{buildroot}%{_bindir}/rbash
%if %{with alternatives}
ln -sf %{_sysconfdir}/alternatives/sh %{buildroot}%{_bindir}/sh
%else
ln -sf %{_bindir}/bash %{buildroot}%{_bindir}/sh
%endif
install -m 644 COMPAT NEWS %{buildroot}%{_docdir}/%{name}
install -m 644 doc/FAQ %{buildroot}%{_docdir}/%{name}
install -m 644 doc/INTRO %{buildroot}%{_docdir}/%{name}
install -m 644 doc/*.html %{buildroot}%{_docdir}/%{name}
install -m 644 doc/builtins.1 %{buildroot}%{_mandir}/man1/bash_builtins.1
install -m 644 doc/rbash.1 %{buildroot}%{_mandir}/man1/rbash.1
gzip -9f %{buildroot}%{_infodir}/*.inf*[^z] || true
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d
sed 's/^|//' > %{buildroot}%{_docdir}/%{name}/BUGS <<\EOF
Known problems
--------------
|
This version of bash/readline supports multi byte handling
that is e.g. wide character support for UTF-8. This causes
problems in geting the current cursor position within the
readline runtime library:
|
bash-%{bversion}> LANG=ja_JP
bash-%{bversion}> echo -n "Hello"
bash-%{bversion}>
|
In other words the prompt overwrites the output of the
echo comand. The boolean variable byte-oriented
set in %{_sysconfdir}/inputrc or $HOME/.inputrc avoids this
but disables multi byte handling.
EOF
# remove unpackaged files
mkdir -p %{buildroot}%{_sysconfdir}/skel
install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/skel/.bashrc
install -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/skel/.profile
touch -t 199605181720.50 %{buildroot}%{_sysconfdir}/skel/.bash_history
chmod 600 %{buildroot}%{_sysconfdir}/skel/.bash_history
%find_lang bash
%fdupes -s %{buildroot}%{_datadir}/bash/helpfiles
sed -ri '1{ s@/bin/sh@/bin/bash@ }' %{buildroot}%{_bindir}/bashbug
%if %{with alternatives}
%post -p %{_bindir}/bash
%{_sbindir}/update-alternatives --quiet --force \
--install %{_bindir}/sh sh %{_bindir}/bash 10100
%preun -p %{_bindir}/bash
if test "$1" = 0; then
%{_sbindir}/update-alternatives --quiet --remove sh %{_bindir}/bash
fi
%endif
%files
%license COPYING
%config %attr(600,root,root) %{_sysconfdir}/skel/.bash_history
%config %attr(644,root,root) %{_sysconfdir}/skel/.bashrc
%config %attr(644,root,root) %{_sysconfdir}/skel/.profile
%if %{with alternatives}
%ghost %config %{_sysconfdir}/alternatives/sh
%endif
%dir %{_sysconfdir}/bash_completion.d
%if 0%{?suse_version} < 1550
/bin/bash
%if %{with alternatives}
/bin/sh
%endif
%endif
%{_bindir}/bash
%{_bindir}/bashbug
%{_bindir}/rbash
%if %{with alternatives}
%{_bindir}/sh
%endif
%dir %{_datadir}/bash
%dir %{_datadir}/bash/helpfiles
%{_datadir}/bash/helpfiles/*
%{_mandir}/man1/bash.1%{?ext_man}
%{_mandir}/man1/bash_builtins.1%{?ext_man}
%{_mandir}/man1/bashbug.1%{?ext_man}
%{_mandir}/man1/rbash.1%{?ext_man}
%if %{without alternatives}
%files sh
%if 0%{?suse_version} < 1550
/bin/sh
%endif
%{_bindir}/sh
%endif
%files lang -f bash.lang
%files doc
%{_infodir}/bash.info%{?ext_info}
%doc %{_docdir}/%{name}
%files devel
%dir %{_includedir}/bash/
%dir %{_includedir}/bash/builtins/
%dir %{_includedir}/bash/include/
%{_incdir}/bash/*.h
%{_incdir}/bash/builtins/*.h
%{_incdir}/bash/include/*.h
%{_libdir}/pkgconfig/bash.pc
%{_datadir}/bash/*.inc
%files loadables
%{_ldldir}
%if 0%{?suse_version} >= 1550
%files legacybin
/bin/bash
/bin/sh
%endif
%changelog

13
dot.bashrc Normal file
View File

@ -0,0 +1,13 @@
# Sample .bashrc for SUSE Linux
# Copyright (c) SUSE Software Solutions Germany GmbH
# There are 3 different types of shells in bash: the login shell, normal shell
# and interactive shell. Login shells read ~/.profile and interactive shells
# read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all
# settings made here will also take effect in a login shell.
#
# NOTE: It is recommended to make language settings in ~/.profile rather than
# here, since multilingual X sessions would not work properly if LANG is over-
# ridden in every subshell.
test -s ~/.alias && . ~/.alias || true

25
dot.profile Normal file
View File

@ -0,0 +1,25 @@
# Sample .profile for SUSE Linux
# rewritten by Christian Steinruecken <cstein@suse.de>
#
# This file is read each time a login shell is started.
# All other interactive shells will only read .bashrc; this is particularly
# important for language settings, see below.
test -z "$PROFILEREAD" && . /etc/profile || true
# Some applications read the EDITOR variable to determine your favourite text
# editor. So uncomment the line below and enter the editor of your choice :-)
#export EDITOR=/usr/bin/vim
#export EDITOR=/usr/bin/mcedit
# For some news readers it makes sense to specify the NEWSSERVER variable here
#export NEWSSERVER=your.news.server
# Some people don't like fortune. If you uncomment the following lines,
# you will have a fortune each time you log in ;-)
#if [ -x /usr/bin/fortune ] ; then
# echo
# /usr/bin/fortune
# echo
#fi

16
get_version_number.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Note: this file is used in the spec file, do not remove it
# Print the highest version number of the patches from the archive
sourcedir=$1
test -n "${sourcedir}" || sourcedir=$PWD
test -e ${sourcedir}/bash.spec || exit 1
version=$(sed -rn '/^%define[[:space:]]+bversion/{s/^%define[[:space:]]+bversion[[:space:]]+([0-9]+\.[0-9]+)(\.[^\.]+)?/\1/p}' ${sourcedir}/bash.spec) || exit 1
test -e ${sourcedir}/bash-${version}.tar.gz || exit 1
last=($(tar Oxf ${sourcedir}/bash-${version}.tar.gz bash-${version}/configure.ac | sed -rn '/^define.bashvers/{s/^define\(bashvers,[[:space:]]([0-9\.]+)\)/\1/p}')) || exit 1
test -e ${sourcedir}/bash-${version}-patches.tar.bz2 || echo ${last[0]}
tar --wildcards -tf ${sourcedir}/bash-${version}-patches.tar.bz2 '*/bash[0-9][0-9]-*[0-9]' &> /dev/null || echo ${last[0]}
OFS="$IFS"
IFS=-
last=($(tar --wildcards -tf ${sourcedir}/bash-${version}-patches.tar.bz2 '*/bash[0-9][0-9]-*[0-9]' | sed -r 's@\.patch$@@'| sort -t '-' -k 3,3 -n | tail -n 1))
IFS="$OFS"
echo ${last[3]/*0/}

View File

@ -0,0 +1,15 @@
---
support/man2html.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- support/man2html.c
+++ support/man2html.c 2010-09-03 20:49:56.288632000 +0000
@@ -4076,7 +4076,7 @@ main(int argc, char **argv)
if (subs)
fputs("</DL>\n", stdout);
fputs("</DL>\n", stdout);
- print_sig();
+ /* print_sig(); */
fputs("</BODY>\n</HTML>\n", stdout);
} else
fprintf(stderr, "man2html: no output produced\n");

27
quotes-man2html.patch Normal file
View File

@ -0,0 +1,27 @@
boo#1203091
---
support/man2html.c | 12 ++++
1 file changed, 12 insertions(+)
--- support/man2html.c
+++ support/man2html.c 2022-09-12 08:27:06.352648345 +0000
@@ -476,6 +476,18 @@ expand_char(int nr)
charb[0] = nr / 256;
charb[1] = nr % 256;
charb[2] = '\0';
+ if (charb[1] == 'q') {
+ switch (charb[0]) {
+ case 'a':
+ strncpy(charb, "'", 1);
+ charb[1] = '\0';
+ break;
+ case 'd':
+ strncpy(charb, "&quot;", 6);
+ charb[6] = '\0';
+ break;
+ }
+ }
if (charb[0] == '<') { /* Fix up <= */
charb[4] = charb[1];
strncpy(charb, "&lt;", 4);

76
run-tests Normal file
View File

@ -0,0 +1,76 @@
#! /bin/sh
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
: ${TMPDIR:=/tmp}
export TMPDIR
# basic /bin/sh syntax
SUFFIX=`${THIS_SH} -c 'echo $(( $RANDOM + $BASHPID ))'`
BASH_TSTOUT=${TMPDIR}/bashtst-$SUFFIX # for now
export BASH_TSTOUT
trap 'rm -f $BASH_TSTOUT' 0 1 2 3 15
PATH=.:$PATH # just to get recho/zecho/printenv if not run via `make tests'
export PATH
# unset BASH_ENV only if it is set
[ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV
# ditto for SHELLOPTS
#[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS
: ${THIS_SH:=../bash}
export THIS_SH
: ${BUILD_DIR:=..}
export BUILD_DIR
${THIS_SH} ./version
rm -f ${BASH_TSTOUT}
echo Any output from any test, unless otherwise noted, indicates a possible anomaly
for x in run-*
do
case $x in
$0|run-all|run-minimal|run-gprof|run-jobs) ;;
*.orig|*~) ;;
*) echo $x ; sh $x ; rm -f ${BASH_TSTOUT} ;;
esac
done
trap 'rm -f $tmp' EXIT HUP INT QUIT TERM
tmp=$(mktemp /tmp/hello.XXXXXXXX) || exit 1
echo '#!/bin/sh' > $tmp
echo exit >> $tmp
chmod 755 $tmp
${THIS_SH} -c $tmp
typeset -i count=500
echo '#########################'
echo 'fork + /bin/sh -c runtime'
time while ((count-- > 0)) ; do
${THIS_SH} -c $tmp
done
echo '#########################'
set -x
read -t1 < /dev/tty
set +x
echo '#########################'
exit 0