Initialize for bash
This commit is contained in:
commit
e367703cd4
44 changed files with 5010 additions and 0 deletions
4
.bash.metadata
Normal file
4
.bash.metadata
Normal file
|
@ -0,0 +1,4 @@
|
|||
5509e0346b09f8f7a0dcae9559f10bef3675877e2af8439d00be18235223e163 bash-4.4-patches.tar.bz2
|
||||
7d74875842f898434972a4dbb8cf9b525667bdbb7107939e589f32dc1a77a5bc bash-4.4.tar.gz
|
||||
4693c04572d69a56387d88feb141b01abd8d0f120d00cbb0c8f887be0490cfb7 readline-7.0-patches.tar.bz2
|
||||
42494f2be05e4db52b92729ccb4b0510175056be63c916e658102e7561f8b09a readline-7.0.tar.gz
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
bash-4.4-patches.tar.bz2
|
||||
bash-4.4.tar.gz
|
||||
readline-7.0-patches.tar.bz2
|
||||
readline-7.0.tar.gz
|
12
baselibs.conf
Normal file
12
baselibs.conf
Normal file
|
@ -0,0 +1,12 @@
|
|||
libreadline7
|
||||
obsoletes "readline-<targettype> <= <version>"
|
||||
provides "readline-<targettype> = <version>"
|
||||
targettype x86 package bash
|
||||
+^/bin/bash$
|
||||
+^/bin/sh$
|
||||
prereq -glibc-x86
|
||||
readline-devel
|
||||
requires -readline-<targettype>
|
||||
requires "libreadline7-<targettype> = <version>"
|
||||
conflicts "readline5-devel-<targettype>"
|
||||
conflicts "readline6-devel-<targettype>"
|
65
bash-2.03-manual.patch
Normal file
65
bash-2.03-manual.patch
Normal 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 2016-09-16 10:36:46.667901616 +0000
|
||||
@@ -121,6 +121,12 @@ processing, then commands are read from
|
||||
This option allows the positional parameters to be set
|
||||
when invoking an interactive shell.
|
||||
.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.
|
||||
@@ -7038,6 +7044,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
|
||||
@@ -10432,6 +10443,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 2016-09-16 10:36:46.667901616 +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 2016-09-16 10:36:46.667901616 +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
17
bash-3.0-evalexp.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
expr.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- expr.c
|
||||
+++ expr.c 2004-07-30 14:39:48.000000000 +0000
|
||||
@@ -466,8 +466,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;
|
||||
|
33
bash-3.0-warn-locale.patch
Normal file
33
bash-3.0-warn-locale.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
locale.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
--- locale.c
|
||||
+++ locale.c 2004-09-03 10:56:10.000000000 +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>
|
||||
|
||||
@@ -76,6 +80,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);
|
36
bash-3.2-printf.patch
Normal file
36
bash-3.2-printf.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
builtins/printf.def | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
--- builtins/printf.def
|
||||
+++ builtins/printf.def 2006-07-27 15:11:19.000000000 +0000
|
||||
@@ -54,6 +54,7 @@ error occurs.
|
||||
$END
|
||||
|
||||
#include <config.h>
|
||||
+#include <locale.h>
|
||||
|
||||
#include "../bashtypes.h"
|
||||
|
||||
@@ -654,12 +655,20 @@ printf_builtin (list)
|
||||
case 'A':
|
||||
#endif
|
||||
{
|
||||
- char *f;
|
||||
+ char *f, *lce = getenv("LC_NUMERIC"), *lcl = setlocale(LC_NUMERIC, NULL);
|
||||
floatmax_t p;
|
||||
|
||||
p = getfloatmax ();
|
||||
f = mklong (start, FLOATMAX_CONV, sizeof(FLOATMAX_CONV) - 1);
|
||||
+
|
||||
+ if (lce && lcl)
|
||||
+ setlocale(LC_NUMERIC, lce);
|
||||
+
|
||||
PF (f, p);
|
||||
+
|
||||
+ if (lce && lcl)
|
||||
+ setlocale(LC_NUMERIC, lcl);
|
||||
+
|
||||
break;
|
||||
}
|
||||
|
47
bash-4.0-security.patch
Normal file
47
bash-4.0-security.patch
Normal file
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
variables.c | 27 +++++++++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
--- variables.c
|
||||
+++ variables.c 2016-09-14 08:51:32.306631046 +0000
|
||||
@@ -1300,6 +1300,7 @@ static unsigned long rseed = 1;
|
||||
static int last_random_value;
|
||||
static int seeded_subshell = 0;
|
||||
|
||||
+#if !defined(linux)
|
||||
/* A linear congruential random number generator based on the example
|
||||
one in the ANSI C standard. This one isn't very good, but a more
|
||||
complicated one is overkill. */
|
||||
@@ -1344,6 +1345,32 @@ seedrand ()
|
||||
sbrand (tv.tv_sec ^ tv.tv_usec ^ getpid ());
|
||||
}
|
||||
|
||||
+#else
|
||||
+/* Use ISO C Random Number Functions of the glibc */
|
||||
+static int
|
||||
+brand (void)
|
||||
+{
|
||||
+ if (rseed == 0)
|
||||
+ seedrand ();
|
||||
+ return rand() & 32767;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sbrand (unsigned long seed)
|
||||
+{
|
||||
+ rseed = seed;
|
||||
+ srand(seed);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+seedrand (void)
|
||||
+{
|
||||
+ struct timeval tv;
|
||||
+ gettimeofday (&tv, NULL);
|
||||
+ srand (tv.tv_sec ^ tv.tv_usec ^ getpid ());
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static SHELL_VAR *
|
||||
assign_random (self, value, unused, key)
|
||||
SHELL_VAR *self;
|
41
bash-4.0-setlocale.dif
Normal file
41
bash-4.0-setlocale.dif
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
locale.c | 21 ++++++++++++++++-----
|
||||
1 file changed, 16 insertions(+), 5 deletions(-)
|
||||
|
||||
--- locale.c
|
||||
+++ locale.c 2008-11-25 13:41:50.000000000 +0000
|
||||
@@ -54,6 +54,7 @@ extern int dump_translatable_strings, du
|
||||
|
||||
/* 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;
|
||||
@@ -326,11 +327,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);
|
||||
}
|
||||
|
64
bash-4.1-bash.bashrc.dif
Normal file
64
bash-4.1-bash.bashrc.dif
Normal file
|
@ -0,0 +1,64 @@
|
|||
|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 | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
--- doc/bash.1
|
||||
+++ doc/bash.1 2016-08-01 13:54:54.253999110 +0000
|
||||
@@ -329,6 +329,8 @@ and executes commands from the first one
|
||||
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,
|
||||
@@ -338,13 +340,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
|
||||
@@ -430,7 +438,8 @@ daemon, usually \fIrshd\fP, or the secur
|
||||
If
|
||||
.B bash
|
||||
determines it is being run in this fashion, it reads and executes
|
||||
-commands from \fI~/.bashrc\fP, if that file exists and is readable.
|
||||
+commands from \fI/etc/bash.bashrc\fP then \fI~/.bashrc\fP when
|
||||
+those files exist and are readable.
|
||||
It will not do this if invoked as \fBsh\fP.
|
||||
The
|
||||
.B \-\-norc
|
20
bash-4.1-completion.dif
Normal file
20
bash-4.1-completion.dif
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
bashline.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- bashline.c
|
||||
+++ bashline.c 2016-09-14 08:54:09.315700369 +0000
|
||||
@@ -2029,6 +2029,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))
|
176
bash-4.2-endpw.dif
Normal file
176
bash-4.2-endpw.dif
Normal file
|
@ -0,0 +1,176 @@
|
|||
---
|
||||
bashline.c | 1 +
|
||||
examples/loadables/finfo.c | 16 ++++++++++------
|
||||
examples/loadables/id.c | 37 +++++++++++++++++++++++++------------
|
||||
lib/tilde/shell.c | 9 +++++++++
|
||||
lib/tilde/tilde.c | 1 +
|
||||
5 files changed, 46 insertions(+), 18 deletions(-)
|
||||
|
||||
--- bashline.c
|
||||
+++ bashline.c 2011-11-21 12:41:19.831646479 +0000
|
||||
@@ -2485,6 +2485,7 @@ bash_groupname_completion_function (text
|
||||
}
|
||||
|
||||
value = savestring (grent->gr_name);
|
||||
+ endgrent ();
|
||||
return (value);
|
||||
#endif
|
||||
}
|
||||
--- examples/loadables/finfo.c
|
||||
+++ examples/loadables/finfo.c 2011-11-21 12:23:17.331147246 +0000
|
||||
@@ -290,6 +290,7 @@ struct stat *st;
|
||||
pw = getpwuid(st->st_uid);
|
||||
owner = pw ? pw->pw_name : "unknown";
|
||||
printf("Uid of owner: %d (%s)\n", (int) st->st_uid, owner);
|
||||
+ endpwent();
|
||||
gr = getgrgid(st->st_gid);
|
||||
owner = gr ? gr->gr_name : "unknown";
|
||||
printf("Gid of owner: %d (%s)\n", (int) st->st_gid, owner);
|
||||
@@ -298,6 +299,7 @@ struct stat *st;
|
||||
printf("File last access time: %s", ctime (&st->st_atime));
|
||||
printf("File last modify time: %s", ctime (&st->st_mtime));
|
||||
printf("File last status change time: %s", ctime (&st->st_ctime));
|
||||
+ endgrent();
|
||||
fflush(stdout);
|
||||
return(0);
|
||||
}
|
||||
@@ -366,16 +368,18 @@ int flags;
|
||||
else if (flags & OPT_PMASK)
|
||||
printf("%o\n", getperm(st->st_mode) & pmask);
|
||||
else if (flags & OPT_UID) {
|
||||
- pw = getpwuid(st->st_uid);
|
||||
- if (flags & OPT_ASCII)
|
||||
+ if (flags & OPT_ASCII) {
|
||||
+ pw = getpwuid(st->st_uid);
|
||||
printf("%s\n", pw ? pw->pw_name : "unknown");
|
||||
- else
|
||||
+ endpwent();
|
||||
+ } else
|
||||
printf("%d\n", st->st_uid);
|
||||
} else if (flags & OPT_GID) {
|
||||
- gr = getgrgid(st->st_gid);
|
||||
- if (flags & OPT_ASCII)
|
||||
+ if (flags & OPT_ASCII) {
|
||||
+ gr = getgrgid(st->st_gid);
|
||||
printf("%s\n", gr ? gr->gr_name : "unknown");
|
||||
- else
|
||||
+ endgrent();
|
||||
+ } else
|
||||
printf("%d\n", st->st_gid);
|
||||
} else if (flags & OPT_SIZE)
|
||||
printf("%ld\n", (long) st->st_size);
|
||||
--- examples/loadables/id.c
|
||||
+++ examples/loadables/id.c 2011-11-21 12:39:06.895646231 +0000
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
extern struct passwd *getpwuid ();
|
||||
+extern void endpwent ();
|
||||
#endif
|
||||
extern struct group *getgrgid ();
|
||||
|
||||
@@ -136,18 +137,26 @@ static int
|
||||
inituser (uname)
|
||||
char *uname;
|
||||
{
|
||||
- struct passwd *pwd;
|
||||
-
|
||||
if (uname)
|
||||
{
|
||||
+ struct passwd *pwd;
|
||||
+ int r;
|
||||
+
|
||||
+ r = 0;
|
||||
pwd = getpwnam (uname);
|
||||
if (pwd == 0)
|
||||
{
|
||||
builtin_error ("%s: no such user", uname);
|
||||
- return -1;
|
||||
+ r = -1;
|
||||
}
|
||||
- ruid = euid = pwd->pw_uid;
|
||||
- rgid = egid = pwd->pw_gid;
|
||||
+ else
|
||||
+ {
|
||||
+ ruid = euid = pwd->pw_uid;
|
||||
+ rgid = egid = pwd->pw_gid;
|
||||
+ }
|
||||
+ endpwent ();
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -172,11 +181,12 @@ id_pruser (uid)
|
||||
{
|
||||
pwd = getpwuid (uid);
|
||||
if (pwd == NULL)
|
||||
- r = 1;
|
||||
+ r = 1;
|
||||
+ else
|
||||
+ printf ("%s", pwd->pw_name);
|
||||
+ endpwent ();
|
||||
}
|
||||
- if (pwd)
|
||||
- printf ("%s", pwd->pw_name);
|
||||
- else
|
||||
+ if (pwd == NULL)
|
||||
printf ("%u", (unsigned) uid);
|
||||
|
||||
return r;
|
||||
@@ -197,11 +207,12 @@ id_prgrp (gid)
|
||||
grp = getgrgid (gid);
|
||||
if (grp == NULL)
|
||||
r = 1;
|
||||
+ else
|
||||
+ printf ("%s", grp->gr_name);
|
||||
+ endgrent ();
|
||||
}
|
||||
|
||||
- if (grp)
|
||||
- printf ("%s", grp->gr_name);
|
||||
- else
|
||||
+ if (grp == NULL)
|
||||
printf ("%u", (unsigned) gid);
|
||||
|
||||
return r;
|
||||
@@ -307,6 +318,8 @@ id_prall (uname)
|
||||
else
|
||||
printf ("(%s)", grp->gr_name);
|
||||
}
|
||||
+ endpwent ();
|
||||
+ endgrent ();
|
||||
|
||||
return r;
|
||||
}
|
||||
--- lib/tilde/shell.c
|
||||
+++ lib/tilde/shell.c 2011-11-21 13:07:02.099146925 +0000
|
||||
@@ -45,9 +45,18 @@
|
||||
#include <pwd.h>
|
||||
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
+# if defined (HAVE_GETPWUID)
|
||||
extern struct passwd *getpwuid ();
|
||||
+# endif
|
||||
+# if defined (HAVE_GETPWENT)
|
||||
+extern void endpwent ();
|
||||
+# endif
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
|
||||
+#if !defined (savestring)
|
||||
+# define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
|
||||
+#endif /* !savestring */
|
||||
+
|
||||
char *
|
||||
get_env_value (varname)
|
||||
char *varname;
|
||||
--- lib/tilde/tilde.c
|
||||
+++ lib/tilde/tilde.c 2011-11-11 13:10:07.000000000 +0000
|
||||
@@ -61,6 +61,7 @@ extern struct passwd *getpwuid PARAMS((u
|
||||
# endif
|
||||
# if defined (HAVE_GETPWNAM)
|
||||
extern struct passwd *getpwnam PARAMS((const char *));
|
||||
+extern void endpwent ();
|
||||
# endif
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
|
BIN
bash-4.2-history-myown.dif.bz2
Normal file
BIN
bash-4.2-history-myown.dif.bz2
Normal file
Binary file not shown.
51
bash-4.2-nscdunmap.dif
Normal file
51
bash-4.2-nscdunmap.dif
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
shell.c | 24 ++++++++++++++++++++++++
|
||||
1 file changed, 24 insertions(+)
|
||||
|
||||
--- shell.c
|
||||
+++ shell.c 2016-09-14 08:54:32.971258862 +0000
|
||||
@@ -43,6 +43,7 @@
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
+# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -1751,6 +1752,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 ()
|
||||
{
|
||||
@@ -1782,6 +1805,7 @@ get_current_user_info ()
|
||||
#if defined (HAVE_GETPWENT)
|
||||
endpwent ();
|
||||
#endif
|
||||
+ maybe_unmap_nscd ();
|
||||
}
|
||||
}
|
||||
|
96
bash-4.3-2.4.4.patch
Normal file
96
bash-4.3-2.4.4.patch
Normal file
|
@ -0,0 +1,96 @@
|
|||
---
|
||||
array.c | 2 +-
|
||||
examples/loadables/tee.c | 3 ++-
|
||||
hashlib.c | 2 +-
|
||||
jobs.c | 9 +++++++++
|
||||
sig.c | 4 ++--
|
||||
sig.h | 4 ++--
|
||||
6 files changed, 17 insertions(+), 7 deletions(-)
|
||||
|
||||
--- array.c
|
||||
+++ array.c 2017-01-27 17:45:42.364066849 +0000
|
||||
@@ -946,7 +946,7 @@ char *s, *sep;
|
||||
* 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 2017-01-27 17:45:42.364066849 +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 2017-01-27 17:45:42.364066849 +0000
|
||||
@@ -382,7 +382,7 @@ hash_pstats (table, name)
|
||||
|
||||
HASH_TABLE *table, *ntable;
|
||||
|
||||
-int interrupt_immediately = 0;
|
||||
+volatile sig_atomic_t interrupt_immediately = 0;
|
||||
|
||||
int
|
||||
signal_is_trapped (s)
|
||||
--- jobs.c
|
||||
+++ jobs.c 2017-01-27 17:45:42.364066849 +0000
|
||||
@@ -1962,6 +1962,15 @@ make_child (command, async_p)
|
||||
pid_t mypid;
|
||||
|
||||
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 2017-01-27 17:45:42.364066849 +0000
|
||||
@@ -98,10 +98,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 2017-01-27 17:45:42.364066849 +0000
|
||||
@@ -109,8 +109,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 __P((int));
|
14
bash-4.3-decl.patch
Normal file
14
bash-4.3-decl.patch
Normal 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
|
90
bash-4.3-extra-import-func.patch
Normal file
90
bash-4.3-extra-import-func.patch
Normal file
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
builtins/shopt.def | 2 ++
|
||||
doc/bash.1 | 7 +++++++
|
||||
shell.c | 2 ++
|
||||
variables.c | 8 +++++++-
|
||||
4 files changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
--- builtins/shopt.def
|
||||
+++ builtins/shopt.def 2016-09-14 08:57:33.723885627 +0000
|
||||
@@ -90,6 +90,7 @@ extern int autocd;
|
||||
extern int glob_star;
|
||||
extern int glob_asciirange;
|
||||
extern int lastpipe_opt;
|
||||
+extern int import_functions;
|
||||
extern int inherit_errexit;
|
||||
|
||||
#if defined (EXTENDED_GLOB)
|
||||
@@ -200,6 +201,7 @@ static struct {
|
||||
{ "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 2016-09-14 08:57:33.723885627 +0000
|
||||
@@ -244,6 +244,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
|
||||
--- shell.c
|
||||
+++ shell.c 2016-09-14 08:57:33.723885627 +0000
|
||||
@@ -238,6 +238,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
|
||||
@@ -257,6 +258,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 2016-09-14 08:57:33.723885627 +0000
|
||||
@@ -115,6 +115,7 @@ extern time_t shell_start_time;
|
||||
extern int assigning_in_environment;
|
||||
extern int executing_builtin;
|
||||
extern int funcnest_max;
|
||||
+extern int import_functions;
|
||||
|
||||
#if defined (READLINE)
|
||||
extern int no_line_editing;
|
||||
@@ -378,6 +379,11 @@ initialize_shell_variables (env, privmod
|
||||
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);
|
||||
|
||||
@@ -392,7 +398,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));
|
16
bash-4.3-include-unistd.dif
Normal file
16
bash-4.3-include-unistd.dif
Normal 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"
|
115
bash-4.3-loadables.dif
Normal file
115
bash-4.3-loadables.dif
Normal file
|
@ -0,0 +1,115 @@
|
|||
---
|
||||
examples/loadables/finfo.c | 11 +++++------
|
||||
examples/loadables/head.c | 2 --
|
||||
examples/loadables/id.c | 2 --
|
||||
examples/loadables/mkdir.c | 2 +-
|
||||
examples/loadables/pathchk.c | 2 --
|
||||
examples/loadables/print.c | 2 +-
|
||||
examples/loadables/tee.c | 2 --
|
||||
7 files changed, 7 insertions(+), 16 deletions(-)
|
||||
|
||||
--- examples/loadables/finfo.c
|
||||
+++ examples/loadables/finfo.c 2016-03-08 12:24:51.061423424 +0000
|
||||
@@ -102,7 +102,7 @@ int argc;
|
||||
char **argv;
|
||||
{
|
||||
register int i;
|
||||
- int mode, flags, opt;
|
||||
+ int flags, opt;
|
||||
|
||||
sh_optind = 0; /* XXX */
|
||||
prog = base_pathname(argv[0]);
|
||||
@@ -334,13 +334,13 @@ int flags;
|
||||
else
|
||||
printf("%ld\n", st->st_ctime);
|
||||
} else if (flags & OPT_DEV)
|
||||
- printf("%d\n", st->st_dev);
|
||||
+ printf("%lu\n", (ulong)st->st_dev);
|
||||
else if (flags & OPT_INO)
|
||||
- printf("%d\n", st->st_ino);
|
||||
+ printf("%lu\n", (ulong)st->st_ino);
|
||||
else if (flags & OPT_FID)
|
||||
- printf("%d:%ld\n", st->st_dev, st->st_ino);
|
||||
+ printf("%lu:%lu\n", (ulong)st->st_dev, (ulong)st->st_ino);
|
||||
else if (flags & OPT_NLINK)
|
||||
- printf("%d\n", st->st_nlink);
|
||||
+ printf("%lu\n", (ulong)st->st_nlink);
|
||||
else if (flags & OPT_LNKNAM) {
|
||||
#ifdef S_ISLNK
|
||||
b = xmalloc(4096);
|
||||
@@ -390,7 +390,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 2016-03-08 12:24:51.061423424 +0000
|
||||
@@ -99,8 +99,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 2016-03-08 12:24:51.061423424 +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 2016-03-08 12:24:51.061423424 +0000
|
||||
@@ -167,7 +167,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 2016-03-08 12:24:51.061423424 +0000
|
||||
@@ -291,10 +291,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 2016-03-08 12:24:51.061423424 +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 2016-03-08 12:24:51.061423424 +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
97
bash-4.3-pathtemp.patch
Normal 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;
|
||||
@@ -186,7 +221,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);
|
||||
@@ -201,6 +237,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;
|
||||
@@ -219,6 +259,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
31
bash-4.3-perl522.patch
Normal 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);
|
||||
}
|
23
bash-4.3-sigrestart.patch
Normal file
23
bash-4.3-sigrestart.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
sig.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- sig.c
|
||||
+++ sig.c 2017-01-27 17:46:46.602829901 +0000
|
||||
@@ -739,10 +739,16 @@ set_signal_handler (sig, handler)
|
||||
if (sig == SIGCHLD)
|
||||
act.sa_flags |= SA_RESTART; /* XXX */
|
||||
#endif
|
||||
+ if (handler == (trap_handler))
|
||||
+ act.sa_flags |= SA_NODEFER; /* XXX */
|
||||
/* If we're installing a SIGTERM handler for interactive shells, we want
|
||||
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
15
bash-4.3-winch.dif
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
config-top.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- config-top.h
|
||||
+++ config-top.h 2016-09-14 08:55:30.170191343 +0000
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
/* 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
|
301
bash-4.4-bgpoverflow.patch
Normal file
301
bash-4.4-bgpoverflow.patch
Normal file
|
@ -0,0 +1,301 @@
|
|||
---
|
||||
execute_cmd.c | 4 ++
|
||||
jobs.c | 45 +++++++++++++++++++------
|
||||
nojobs.c | 5 ++
|
||||
subst.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
subst.h | 8 ++++
|
||||
5 files changed, 154 insertions(+), 10 deletions(-)
|
||||
|
||||
--- execute_cmd.c
|
||||
+++ execute_cmd.c 2019-06-05 09:19:06.362106086 +0000
|
||||
@@ -722,6 +722,10 @@ execute_command_internal (command, async
|
||||
stdin_redir = stdin_redirects (command->redirects);
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
+# if !defined (HAVE_DEV_FD)
|
||||
+ reap_procsubs ();
|
||||
+# endif
|
||||
+
|
||||
if (variable_context != 0)
|
||||
{
|
||||
ofifo = num_fifos ();
|
||||
--- jobs.c
|
||||
+++ jobs.c 2019-06-05 09:42:13.056119389 +0000
|
||||
@@ -72,6 +72,8 @@
|
||||
#include "execute_cmd.h"
|
||||
#include "flags.h"
|
||||
|
||||
+#include "typemax.h"
|
||||
+
|
||||
#include "builtins/builtext.h"
|
||||
#include "builtins/common.h"
|
||||
|
||||
@@ -92,7 +94,7 @@ extern int killpg __P((pid_t, int));
|
||||
#endif
|
||||
|
||||
#if !MAX_CHILD_MAX
|
||||
-# define MAX_CHILD_MAX 8192
|
||||
+# define MAX_CHILD_MAX 32768
|
||||
#endif
|
||||
|
||||
#if !defined (DEBUG)
|
||||
@@ -751,7 +753,7 @@ stop_pipeline (async, deferred)
|
||||
static void
|
||||
bgp_resize ()
|
||||
{
|
||||
- ps_index_t nsize;
|
||||
+ ps_index_t nsize, nsize_cur, nsize_max;
|
||||
ps_index_t psi;
|
||||
|
||||
if (bgpids.nalloc == 0)
|
||||
@@ -765,10 +767,19 @@ bgp_resize ()
|
||||
else
|
||||
nsize = bgpids.nalloc;
|
||||
|
||||
- while (nsize < js.c_childmax)
|
||||
- nsize *= 2;
|
||||
+ nsize_max = TYPE_MAXIMUM (ps_index_t);
|
||||
+ nsize_cur = (ps_index_t)js.c_childmax;
|
||||
+ if (nsize_cur < 0) /* overflow */
|
||||
+ nsize_cur = MAX_CHILD_MAX;
|
||||
+
|
||||
+ while (nsize > 0 && nsize < nsize_cur) /* > 0 should catch overflow */
|
||||
+ nsize <<= 1;
|
||||
+ if (nsize > nsize_max || nsize <= 0) /* overflow? */
|
||||
+ nsize = nsize_max;
|
||||
+ if (nsize > MAX_CHILD_MAX)
|
||||
+ nsize = nsize_max = MAX_CHILD_MAX; /* hard cap */
|
||||
|
||||
- if (bgpids.nalloc < js.c_childmax)
|
||||
+ if (bgpids.nalloc < nsize_cur && bgpids.nalloc < nsize_max)
|
||||
{
|
||||
bgpids.storage = (struct pidstat *)xrealloc (bgpids.storage, nsize * sizeof (struct pidstat));
|
||||
|
||||
@@ -785,9 +796,7 @@ bgp_resize ()
|
||||
static ps_index_t
|
||||
bgp_getindex ()
|
||||
{
|
||||
- ps_index_t psi;
|
||||
-
|
||||
- if (bgpids.nalloc < js.c_childmax || bgpids.head >= bgpids.nalloc)
|
||||
+ if (bgpids.nalloc < (ps_index_t)js.c_childmax || bgpids.head >= bgpids.nalloc)
|
||||
bgp_resize ();
|
||||
|
||||
pshash_delindex (bgpids.head); /* XXX - clear before reusing */
|
||||
@@ -1010,6 +1019,7 @@ cleanup_dead_jobs ()
|
||||
{
|
||||
register int i;
|
||||
int os;
|
||||
+ PROCESS *discard;
|
||||
|
||||
if (js.j_jobslots == 0 || jobs_list_frozen)
|
||||
return;
|
||||
@@ -1034,8 +1044,9 @@ cleanup_dead_jobs ()
|
||||
if (last_procsub_child && last_procsub_child->running == PS_DONE)
|
||||
{
|
||||
bgp_add (last_procsub_child->pid, process_exit_status (last_procsub_child->status)); /* XXX */
|
||||
- discard_pipeline (last_procsub_child);
|
||||
+ discard = last_procsub_child;
|
||||
last_procsub_child = (PROCESS *)NULL;
|
||||
+ discard_pipeline (discard);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2475,6 +2486,13 @@ wait_for_background_pids ()
|
||||
waited_for++;
|
||||
}
|
||||
|
||||
+#if defined (PROCESS_SUBSTITUTION)
|
||||
+ if (last_procsub_child && last_procsub_child->pid != NO_PID)
|
||||
+ r = wait_for (last_procsub_child->pid);
|
||||
+ wait_procsubs ();
|
||||
+ reap_procsubs ();
|
||||
+#endif
|
||||
+
|
||||
/* POSIX.2 says the shell can discard the statuses of all completed jobs if
|
||||
`wait' is called with no arguments. */
|
||||
mark_dead_jobs_as_notified (1);
|
||||
@@ -3498,6 +3516,7 @@ waitchld (wpid, block)
|
||||
WAIT status;
|
||||
PROCESS *child;
|
||||
pid_t pid;
|
||||
+ int ind;
|
||||
|
||||
int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
|
||||
static int wcontinued = WCONTINUED; /* run-time fix for glibc problem */
|
||||
@@ -3604,6 +3623,13 @@ itrace("waitchld: waitpid returns %d blo
|
||||
coproc_pidchk (pid, WSTATUS(status));
|
||||
#endif
|
||||
|
||||
+#if defined (PROCESS_SUBSTITUTION)
|
||||
+ /* Only manipulate the list of process substitutions while SIGCHLD
|
||||
+ is blocked. */
|
||||
+ if ((ind = find_procsub_child (pid)) >= 0)
|
||||
+ set_procsub_status (ind, pid, WSTATUS (status));
|
||||
+#endif
|
||||
+
|
||||
/* It is not an error to have a child terminate that we did
|
||||
not have a record of. This child could have been part of
|
||||
a pipeline in backquote substitution. Even so, I'm not
|
||||
@@ -4838,5 +4864,4 @@ restore_pgrp_pipe (p)
|
||||
pgrp_pipe[0] = p[0];
|
||||
pgrp_pipe[1] = p[1];
|
||||
}
|
||||
-
|
||||
#endif /* PGRP_PIPE */
|
||||
--- nojobs.c
|
||||
+++ nojobs.c 2019-06-05 09:28:29.891549557 +0000
|
||||
@@ -273,6 +273,11 @@ set_pid_status (pid, status)
|
||||
coproc_pidchk (pid, status);
|
||||
#endif
|
||||
|
||||
+#if defined (PROCESS_SUBSTITUTION)
|
||||
+ if ((slot = find_procsub_child (pid)) >= 0)
|
||||
+ set_procsub_status (slot, pid, WSTATUS (status));
|
||||
+#endif
|
||||
+
|
||||
slot = find_index_by_pid (pid);
|
||||
if (slot == NO_PID)
|
||||
return;
|
||||
--- subst.c
|
||||
+++ subst.c 2019-06-05 09:34:35.696693909 +0000
|
||||
@@ -5506,6 +5506,55 @@ close_new_fifos (list, lsize)
|
||||
}
|
||||
|
||||
int
|
||||
+find_procsub_child (pid)
|
||||
+ pid_t pid;
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < nfifo; i++)
|
||||
+ if (fifo_list[i].proc == pid)
|
||||
+ return i;
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+set_procsub_status (ind, pid, status)
|
||||
+ int ind;
|
||||
+ pid_t pid;
|
||||
+ int status;
|
||||
+{
|
||||
+ if (ind >= 0 && ind < nfifo)
|
||||
+ fifo_list[ind].proc = (pid_t)-1; /* sentinel */
|
||||
+}
|
||||
+
|
||||
+/* If we've marked the process for this procsub as dead, close the
|
||||
+ associated file descriptor and delete the FIFO. */
|
||||
+void
|
||||
+reap_procsubs ()
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < nfifo; i++)
|
||||
+ if (fifo_list[i].proc == (pid_t)-1) /* reaped */
|
||||
+ unlink_fifo (i);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+wait_procsubs ()
|
||||
+{
|
||||
+ int i, r;
|
||||
+
|
||||
+ for (i = 0; i < nfifo; i++)
|
||||
+ {
|
||||
+ if (fifo_list[i].proc != (pid_t)-1 && fifo_list[i].proc > 0)
|
||||
+ {
|
||||
+ r = wait_for (fifo_list[i].proc);
|
||||
+ fifo_list[i].proc = (pid_t)-1;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int
|
||||
fifos_pending ()
|
||||
{
|
||||
return nfifo;
|
||||
@@ -5674,6 +5723,59 @@ close_new_fifos (list, lsize)
|
||||
unlink_fifo (i);
|
||||
}
|
||||
|
||||
+int
|
||||
+find_procsub_child (pid)
|
||||
+ pid_t pid;
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ if (nfds == 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ for (i = 0; i < totfds; i++)
|
||||
+ if (dev_fd_list[i] == pid)
|
||||
+ return i;
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+set_procsub_status (ind, pid, status)
|
||||
+ int ind;
|
||||
+ pid_t pid;
|
||||
+ int status;
|
||||
+{
|
||||
+ if (ind >= 0 && ind < totfds)
|
||||
+ dev_fd_list[ind] = (pid_t)-1; /* sentinel */
|
||||
+}
|
||||
+
|
||||
+/* If we've marked the process for this procsub as dead, close the
|
||||
+ associated file descriptor. */
|
||||
+void
|
||||
+reap_procsubs ()
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; nfds > 0 && i < totfds; i++)
|
||||
+ if (dev_fd_list[i] == (pid_t)-1)
|
||||
+ unlink_fifo (i);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+wait_procsubs ()
|
||||
+{
|
||||
+ int i, r;
|
||||
+
|
||||
+ for (i = 0; nfds > 0 && i < totfds; i++)
|
||||
+ {
|
||||
+ if (dev_fd_list[i] != (pid_t)-1 && dev_fd_list[i] > 0)
|
||||
+ {
|
||||
+ r = wait_for (dev_fd_list[i]);
|
||||
+ dev_fd_list[i] = (pid_t)-1;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
#if defined (NOTDEF)
|
||||
print_dev_fd_list ()
|
||||
{
|
||||
--- subst.h
|
||||
+++ subst.h 2019-06-05 09:15:36.846029324 +0000
|
||||
@@ -261,6 +261,7 @@ extern WORD_LIST *expand_words_shellexp
|
||||
extern WORD_DESC *command_substitute __P((char *, int));
|
||||
extern char *pat_subst __P((char *, char *, char *, int));
|
||||
|
||||
+#if defined (PROCESS_SUBSTITUTION)
|
||||
extern int fifos_pending __P((void));
|
||||
extern int num_fifos __P((void));
|
||||
extern void unlink_fifo_list __P((void));
|
||||
@@ -272,6 +273,13 @@ extern void close_new_fifos __P((char *,
|
||||
|
||||
extern void clear_fifo_list __P((void));
|
||||
|
||||
+extern int find_procsub_child __P((pid_t));
|
||||
+extern void set_procsub_status __P((int, pid_t, int));
|
||||
+
|
||||
+extern void wait_procsubs __P((void));
|
||||
+extern void reap_procsubs __P((void));
|
||||
+#endif
|
||||
+
|
||||
extern WORD_LIST *list_string_with_quotes __P((char *));
|
||||
|
||||
#if defined (ARRAY_VARS)
|
17
bash-4.4-jobctrl.patch
Normal file
17
bash-4.4-jobctrl.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
configure.ac | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- bash-4.4/configure.ac
|
||||
+++ bash-4.4/configure.ac 2021-08-04 08:41:02.752903425 +0000
|
||||
@@ -1092,9 +1092,7 @@ solaris2.10*) LOCAL_CFLAGS=-DSOLARIS ;;
|
||||
solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
|
||||
lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
|
||||
linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
|
||||
- case "`uname -r`" in
|
||||
- 2.[[456789]]*|[[34]]*) AC_DEFINE(PGRP_PIPE) ;;
|
||||
- esac ;;
|
||||
+ AC_DEFINE(PGRP_PIPE) ;;
|
||||
*qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
|
||||
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
|
||||
powerux*) LOCAL_LIBS="-lgen" ;;
|
248
bash-4.4.dif
Normal file
248
bash-4.4.dif
Normal file
|
@ -0,0 +1,248 @@
|
|||
---
|
||||
Makefile.in | 2 +-
|
||||
config-top.h | 16 ++++++++++------
|
||||
doc/Makefile.in | 2 +-
|
||||
doc/bash.1 | 7 +++++--
|
||||
general.h | 3 +++
|
||||
parse.y | 2 +-
|
||||
shell.c | 4 +++-
|
||||
support/bashbug.sh | 2 +-
|
||||
support/man2html.c | 1 +
|
||||
support/rlvers.sh | 6 +++---
|
||||
support/shobj-conf | 5 +++--
|
||||
tests/glob.tests | 4 ++--
|
||||
tests/run-intl | 2 +-
|
||||
tests/run-read | 2 +-
|
||||
14 files changed, 36 insertions(+), 22 deletions(-)
|
||||
|
||||
--- Makefile.in
|
||||
+++ Makefile.in 2017-09-25 09:08:48.341515472 +0000
|
||||
@@ -447,7 +447,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 2017-09-25 09:08:06.210296290 +0000
|
||||
@@ -60,17 +60,21 @@
|
||||
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
|
||||
|
||||
/* The value for PATH when invoking `command -p'. This is only used when
|
||||
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
|
||||
|
||||
/* Default primary and secondary prompt strings. */
|
||||
@@ -87,20 +91,20 @@
|
||||
#define DEFAULT_BASHRC "~/.bashrc"
|
||||
|
||||
/* System-wide .bashrc file for interactive shells. */
|
||||
-/* #define SYS_BASHRC "/etc/bash.bashrc" */
|
||||
+#define SYS_BASHRC "/etc/bash.bashrc"
|
||||
|
||||
/* System-wide .bash_logout for login shells. */
|
||||
-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
|
||||
+#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
|
||||
|
||||
/* Define this to make non-interactive shells begun with argv[0][0] == '-'
|
||||
run the startup files when not in posix mode. */
|
||||
-/* #define NON_INTERACTIVE_LOGIN_SHELLS */
|
||||
+#define NON_INTERACTIVE_LOGIN_SHELLS
|
||||
|
||||
/* Define this if you want bash to try to check whether it's being run by
|
||||
sshd and source the .bashrc if so (like the rshd behavior). This checks
|
||||
for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
|
||||
which can be fooled under certain not-uncommon circumstances. */
|
||||
-/* #define SSH_SOURCE_BASHRC */
|
||||
+#define SSH_SOURCE_BASHRC
|
||||
|
||||
/* Define if you want the case-capitalizing operators (~[~]) and the
|
||||
`capcase' variable attribute (declare -c). */
|
||||
--- doc/Makefile.in
|
||||
+++ doc/Makefile.in 2017-09-25 09:08:06.210296290 +0000
|
||||
@@ -154,7 +154,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 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -5253,8 +5253,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 .
|
||||
When a program which uses the readline library starts up, the
|
||||
initialization file is read, and the key bindings and variables
|
||||
are set.
|
||||
@@ -10586,6 +10586,9 @@ The individual login shell cleanup file,
|
||||
.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 2017-09-25 09:08:06.214296216 +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 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -1426,7 +1426,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 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -45,6 +45,7 @@
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
+# include <grp.h>
|
||||
#endif
|
||||
|
||||
#include "bashintl.h"
|
||||
@@ -501,7 +502,7 @@ main (argc, argv, env)
|
||||
if (dump_translatable_strings)
|
||||
read_but_dont_execute = 1;
|
||||
|
||||
- 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
|
||||
@@ -1277,6 +1278,9 @@ disable_priv_mode ()
|
||||
{
|
||||
int e;
|
||||
|
||||
+ if (!current_user.user_name)
|
||||
+ get_current_user_info();
|
||||
+ initgroups (current_user.user_name, current_user.gid);
|
||||
if (setuid (current_user.uid) < 0)
|
||||
{
|
||||
e = errno;
|
||||
--- support/bashbug.sh
|
||||
+++ support/bashbug.sh 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/sh -
|
||||
+#!/bin/bash -
|
||||
#
|
||||
# bashbug - create a bug report and mail it to the bug address
|
||||
#
|
||||
--- support/man2html.c
|
||||
+++ support/man2html.c 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -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 2017-09-25 09:08:06.214296216 +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 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -126,10 +126,11 @@ sunos5*|solaris2*)
|
||||
linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
|
||||
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
|
||||
;;
|
||||
|
||||
freebsd2*)
|
||||
--- tests/glob.tests
|
||||
+++ tests/glob.tests 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -12,8 +12,8 @@ ${THIS_SH} ./glob1.sub
|
||||
|
||||
MYDIR=$PWD # save where we are
|
||||
|
||||
-TESTDIR=/tmp/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 2017-09-25 09:08:06.214296216 +0000
|
||||
@@ -5,4 +5,4 @@ echo "warning: some of these tests will
|
||||
echo "warning: locales installed on your system." >&2
|
||||
|
||||
${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 2017-09-25 09:08:06.214296216 +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}
|
19
bash-memmove.patch
Normal file
19
bash-memmove.patch
Normal file
|
@ -0,0 +1,19 @@
|
|||
Author: Bernhard M. Wiedemann <bwiedemann suse de>
|
||||
Date: 2018-07-07
|
||||
|
||||
strcpy can cause corruption when working on overlapping strings
|
||||
so we use memmove instead that handles this case correctly
|
||||
|
||||
Index: bash-4.4/support/man2html.c
|
||||
===================================================================
|
||||
--- bash-4.4.orig/support/man2html.c
|
||||
+++ bash-4.4/support/man2html.c
|
||||
@@ -1992,7 +1993,7 @@ unescape (char *c)
|
||||
while (i < l && c[i]) {
|
||||
if (c[i] == '\a') {
|
||||
if (c[i+1])
|
||||
- strcpy(c + i, c + i + 1); /* should be memmove */
|
||||
+ memmove(c + i, c + i + 1, strlen(c + i));
|
||||
else {
|
||||
c[i] = '\0';
|
||||
break;
|
3
bash-rpmlintrc
Normal file
3
bash-rpmlintrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
addFilter(".*hidden-file-or-dir.*/etc/skel/\..*")
|
||||
addFilter(".*zero-length.*/etc/skel/\..*")
|
||||
addFilter(".*call-to-mktemp.*/usr/bin/bash.*")
|
1710
bash.changes
Normal file
1710
bash.changes
Normal file
File diff suppressed because it is too large
Load diff
774
bash.spec
Normal file
774
bash.spec
Normal file
|
@ -0,0 +1,774 @@
|
|||
#
|
||||
# spec file for package bash
|
||||
#
|
||||
# Copyright (c) 2022-2023 ZhuningOS
|
||||
#
|
||||
|
||||
%if 0%{?suse_version} > 1500
|
||||
%bcond_with alternatives
|
||||
%else
|
||||
%if 0%{?sle_version} >= 150300
|
||||
%bcond_with alternatives
|
||||
%else
|
||||
%bcond_without alternatives
|
||||
%endif
|
||||
%endif
|
||||
%bcond_with import_function
|
||||
|
||||
Name: bash
|
||||
BuildRequires: audit-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: bison
|
||||
BuildRequires: fdupes
|
||||
%if %suse_version > 1220
|
||||
BuildRequires: makeinfo
|
||||
%endif
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: patchutils
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: screen
|
||||
BuildRequires: sed
|
||||
%if %{with alternatives}
|
||||
BuildRequires: update-alternatives
|
||||
%endif
|
||||
%define bash_vers 4.4
|
||||
%define rl_vers 7.0
|
||||
%define bextend %nil
|
||||
%define rextend %nil
|
||||
%if %{with alternatives}
|
||||
Requires(post): update-alternatives
|
||||
Requires(preun):update-alternatives
|
||||
%endif
|
||||
# The package bash-completion is a source of
|
||||
# bugs which will hit at most this package
|
||||
#Recommends: bash-completion
|
||||
Recommends: bash-doc = %bash_vers
|
||||
Recommends: bash-lang = %bash_vers
|
||||
Suggests: command-not-found
|
||||
%if %{with alternatives}
|
||||
Provides: /bin/sh
|
||||
%else
|
||||
Suggests: bash-sh
|
||||
%endif
|
||||
Version: 4.4
|
||||
Release: 150400.25.22
|
||||
Summary: The GNU Bourne-Again Shell
|
||||
License: GPL-3.0-or-later
|
||||
Group: System/Shells
|
||||
Url: http://www.gnu.org/software/bash/bash.html
|
||||
# Git: http://git.savannah.gnu.org/cgit/bash.git
|
||||
Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bash_vers}%{bextend}.tar.gz
|
||||
Source1: ftp://ftp.gnu.org/gnu/readline/readline-%{rl_vers}%{rextend}.tar.gz
|
||||
Source2: bash-%{bash_vers}-patches.tar.bz2
|
||||
Source3: readline-%{rl_vers}-patches.tar.bz2
|
||||
Source4: run-tests
|
||||
Source5: dot.bashrc
|
||||
Source6: dot.profile
|
||||
Source7: bash-rpmlintrc
|
||||
Source8: baselibs.conf
|
||||
# Remember unsafe method, compare with
|
||||
# http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00070.html
|
||||
# http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00071.html
|
||||
# http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00073.html
|
||||
Source9: bash-4.2-history-myown.dif.bz2
|
||||
Patch0: bash-%{bash_vers}.dif
|
||||
Patch1: bash-2.03-manual.patch
|
||||
Patch2: bash-4.0-security.patch
|
||||
Patch3: bash-4.3-2.4.4.patch
|
||||
Patch4: bash-3.0-evalexp.patch
|
||||
Patch5: bash-3.0-warn-locale.patch
|
||||
# Disabled
|
||||
Patch6: bash-4.2-endpw.dif
|
||||
Patch7: bash-4.3-decl.patch
|
||||
Patch9: bash-4.3-include-unistd.dif
|
||||
Patch10: bash-3.2-printf.patch
|
||||
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
|
||||
Patch20: readline-%{rl_vers}.dif
|
||||
Patch21: readline-6.3-input.dif
|
||||
Patch23: readline-5.2-conf.patch
|
||||
Patch24: readline-6.2-metamode.patch
|
||||
Patch25: readline-6.2-endpw.dif
|
||||
Patch27: readline-6.2-xmalloc.dif
|
||||
Patch30: readline-6.3-destdir.patch
|
||||
Patch31: readline-6.3-rltrace.patch
|
||||
Patch40: bash-4.1-bash.bashrc.dif
|
||||
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-UPSTREAM bnc#1086247
|
||||
Patch50: bash-memmove.patch
|
||||
# PATCH-EXTEND-SUSE boo#1095661 be abele to handle TERM=screen.*
|
||||
Patch51: readline-7.0-screen.patch
|
||||
# PATCH-FIX-SUSE
|
||||
Patch52: bash-4.4-bgpoverflow.patch
|
||||
# PATCH-FIX-UPSTREAM bnc#1183064
|
||||
Patch53: bsc1183064.patch
|
||||
# PATCH-FIX-UPSTREAM bnc#1188287
|
||||
Patch54: bash-4.4-jobctrl.patch
|
||||
%global _sysconfdir /etc
|
||||
%global _incdir %{_includedir}
|
||||
%global _ldldir /%{_lib}/bash
|
||||
%{expand: %%global rl_major %(echo %{rl_vers} | sed -r 's/.[0-9]+//g')}
|
||||
|
||||
%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 -n bash-doc
|
||||
Summary: Documentation how to Use the GNU Bourne-Again Shell
|
||||
Group: Documentation/Man
|
||||
Provides: bash:%{_infodir}/bash.info.gz
|
||||
PreReq: %install_info_prereq
|
||||
Version: %{bash_vers}
|
||||
Release: 150400.25.22
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n bash-doc
|
||||
This package contains the documentation for using the bourne shell
|
||||
interpreter Bash.
|
||||
|
||||
%if %{without alternatives}
|
||||
%package sh
|
||||
Summary: Handle behaviour of /bin/sh
|
||||
Group: System/Shells
|
||||
Provides: alternative(sh)
|
||||
Conflicts: alternative(sh)
|
||||
PreReq: bash = %{version}
|
||||
|
||||
%description sh
|
||||
Use bash as /bin/sh implementation.
|
||||
%endif
|
||||
|
||||
%if %{defined lang_package}
|
||||
%lang_package(bash)
|
||||
%else
|
||||
|
||||
%package -n bash-lang
|
||||
Summary: Languages for package bash
|
||||
Group: System/Localization
|
||||
Provides: bash-lang = %{bash_vers}
|
||||
Requires: bash = %{bash_vers}
|
||||
|
||||
%description -n bash-lang
|
||||
Provides translations to the package bash
|
||||
%endif
|
||||
|
||||
%package -n bash-devel
|
||||
Summary: Include Files mandatory for Development of bash loadable builtins
|
||||
Group: Development/Languages/C and C++
|
||||
Version: %{bash_vers}
|
||||
Release: 150400.25.22
|
||||
|
||||
%description -n bash-devel
|
||||
This package contains the C header files for writing loadable new
|
||||
builtins for the interpreter Bash. Use -I /usr/include/bash/<version>
|
||||
on the compilers command line.
|
||||
|
||||
%package -n bash-loadables
|
||||
Summary: Loadable bash builtins
|
||||
Group: System/Shells
|
||||
Version: %{bash_vers}
|
||||
Release: 150400.25.22
|
||||
|
||||
%description -n bash-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.
|
||||
|
||||
|
||||
%package -n libreadline7
|
||||
Summary: The Readline Library
|
||||
Group: System/Libraries
|
||||
Provides: bash:/%{_lib}/libreadline.so.%{rl_major}
|
||||
Version: %{rl_vers}
|
||||
Release: 150400.25.22
|
||||
Recommends: readline-doc = %{version}
|
||||
# bug437293
|
||||
%ifarch ppc64
|
||||
Obsoletes: readline-64bit
|
||||
%endif
|
||||
#
|
||||
Provides: readline = %{rl_vers}
|
||||
Obsoletes: readline <= 6.3
|
||||
|
||||
%description -n libreadline7
|
||||
The readline library is used by the Bourne Again Shell (bash, the
|
||||
standard command interpreter) for easy editing of command lines. This
|
||||
includes history and search functionality.
|
||||
|
||||
%package -n readline-devel
|
||||
Summary: Include Files and Libraries mandatory for Development
|
||||
Group: Development/Libraries/C and C++
|
||||
Version: %{rl_vers}
|
||||
Release: 150400.25.22
|
||||
Requires: libreadline7 = %{rl_vers}
|
||||
Requires: ncurses-devel
|
||||
Recommends: readline-doc = %{rl_vers}
|
||||
# bug437293
|
||||
%ifarch ppc64
|
||||
Obsoletes: readline-devel-64bit
|
||||
%endif
|
||||
#
|
||||
|
||||
%description -n readline-devel
|
||||
This package contains all necessary include files and libraries needed
|
||||
to develop applications that require these.
|
||||
|
||||
%package -n readline-devel-static
|
||||
Summary: Static library for Development
|
||||
Group: Development/Libraries/C and C++
|
||||
Version: %{rl_vers}
|
||||
Release: 150400.25.22
|
||||
Requires: ncurses-devel
|
||||
Requires: readline-devel = %{rl_vers}
|
||||
Recommends: readline-doc = %{rl_vers}
|
||||
#
|
||||
|
||||
%description -n readline-devel-static
|
||||
This package contains the static library needed
|
||||
to develop applications that require these.
|
||||
|
||||
%package -n readline-doc
|
||||
Summary: Documentation how to Use and Program with the Readline Library
|
||||
Group: System/Libraries
|
||||
Provides: readline:%{_infodir}/readline.info.gz
|
||||
PreReq: %install_info_prereq
|
||||
Version: %{rl_vers}
|
||||
Release: 150400.25.22
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n readline-doc
|
||||
This package contains the documentation for using the readline library
|
||||
as well as programming with the interface of the readline library.
|
||||
|
||||
%prep
|
||||
%setup -q -n bash-%{bash_vers}%{bextend} -b1 -b2 -b3
|
||||
typeset -i level
|
||||
for patch in ../bash-%{bash_vers}-patches/*; 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-%{bash_vers}[^/]*/@@ }' $patch
|
||||
echo Patch $patch
|
||||
patch -s -p$level < $patch
|
||||
done
|
||||
%patch1 -p0 -b .manual
|
||||
%patch2 -p0 -b .security
|
||||
%patch3 -p0 -b .2.4.4
|
||||
%patch4 -p0 -b .evalexp
|
||||
%patch5 -p0 -b .warnlc
|
||||
#%patch6 -p0 -b .endpw
|
||||
%patch7 -p0 -b .decl
|
||||
%patch9 -p0 -b .unistd
|
||||
%patch10 -p0 -b .printf
|
||||
%patch11 -p0 -b .plugins
|
||||
%patch12 -p0 -b .completion
|
||||
%patch13 -p0 -b .nscdunmap
|
||||
%patch14 -p0 -b .sigrestart
|
||||
%patch16 -p0 -b .setlocale
|
||||
%patch18 -p0 -b .winch
|
||||
%patch21 -p0 -b .zerotty
|
||||
%patch23 -p0 -b .conf
|
||||
%patch24 -p0 -b .metamode
|
||||
#%patch25 -p0 -b .endpw
|
||||
%patch31 -p0 -b .tmp
|
||||
%patch40 -p0 -b .bashrc
|
||||
%patch46 -p0 -b .notimestamp
|
||||
%patch47 -p0 -b .perl522
|
||||
%if %{with import_function}
|
||||
%patch48 -b .eif
|
||||
%endif
|
||||
%patch49 -p0 -b .pthtmp
|
||||
%patch50 -p1 -b .mmv
|
||||
%patch51 -p0 -b .screen
|
||||
%patch52 -p0 -b .bgpovflw
|
||||
%patch53 -p1 -b .p53
|
||||
%patch54 -p1 -b .p54
|
||||
%patch0 -p0 -b .0
|
||||
pushd ../readline-%{rl_vers}%{rextend}
|
||||
for patch in ../readline-%{rl_vers}-patches/*; 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
|
||||
sed -ri '/^\*\*\* \.\./{ s@\.\./readline-%{rl_vers}[^/]*/@@ }' $patch
|
||||
echo Patch $patch
|
||||
patch -s -p$level < $patch
|
||||
done
|
||||
%patch21 -p2 -b .zerotty
|
||||
%patch23 -p2 -b .conf
|
||||
%patch24 -p2 -b .metamode
|
||||
#%patch25 -p2 -b .endpw
|
||||
%patch31 -p2 -b .tmp
|
||||
%patch51 -p2 -b .screen
|
||||
%patch53 -p3 -b .p53
|
||||
%patch27 -p0 -b .xm
|
||||
%patch30 -p0 -b .destdir
|
||||
%patch20 -p0 -b .0
|
||||
|
||||
%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
|
||||
CPU=$(uname -m 2> /dev/null)
|
||||
HOSTTYPE=${CPU}
|
||||
MACHTYPE=${CPU}-suse-linux
|
||||
export LANG LC_ALL HOSTTYPE MACHTYPE
|
||||
pushd ../readline-%{rl_vers}%{rextend}
|
||||
autoconf
|
||||
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)"
|
||||
(cat > dyn.map)<<-'EOF'
|
||||
{
|
||||
*;
|
||||
!rl_*stream;
|
||||
};
|
||||
EOF
|
||||
(cat > rl.map)<<-'EOF'
|
||||
READLINE_6.3 {
|
||||
rl_change_environment;
|
||||
rl_clear_history;
|
||||
rl_executing_key;
|
||||
rl_executing_keyseq;
|
||||
rl_filename_stat_hook;
|
||||
rl_history_substr_search_backward;
|
||||
rl_history_substr_search_forward;
|
||||
rl_input_available_hook;
|
||||
rl_print_last_kbd_macro;
|
||||
rl_signal_event_hook;
|
||||
};
|
||||
EOF
|
||||
CFLAGS="$RPM_OPT_FLAGS $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
|
||||
cflags -Wl,--version-script=${PWD}/rl.map LDFLAGS
|
||||
cflags -Wl,--dynamic-list=${PWD}/dyn.map LDFLAGS
|
||||
CC=gcc
|
||||
CC_FOR_BUILD="$CC"
|
||||
CFLAGS_FOR_BUILD="$CFLAGS"
|
||||
LDFLAGS_FOR_BUILD="$LDFLAGS"
|
||||
export CC_FOR_BUILD CFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD CFLAGS LDFLAGS CC
|
||||
./configure --build=%{_target_cpu}-suse-linux \
|
||||
--enable-static \
|
||||
--enable-shared \
|
||||
--enable-multibyte \
|
||||
--prefix=%{_prefix} \
|
||||
--with-curses \
|
||||
--mandir=%{_mandir} \
|
||||
--infodir=%{_infodir} \
|
||||
--docdir=%{_defaultdocdir}/readline \
|
||||
--libdir=%{_libdir}
|
||||
make
|
||||
make documentation
|
||||
ln -sf shlib/libreadline.so.%{rl_vers} libreadline.so
|
||||
ln -sf shlib/libreadline.so.%{rl_vers} libreadline.so.%{rl_major}
|
||||
ln -sf shlib/libhistory.so.%{rl_vers} libhistory.so
|
||||
ln -sf shlib/libhistory.so.%{rl_vers} libhistory.so.%{rl_major}
|
||||
LDFLAGS=${LDFLAGS/-Wl,--version-script=*rl.map/}
|
||||
LDFLAGS=${LDFLAGS/-Wl,--dynamic-list=*dyn.map/}
|
||||
LDFLAGS_FOR_BUILD="$LDFLAGS"
|
||||
popd
|
||||
# /proc is required for correct configuration
|
||||
test -d /dev/fd || { echo "/proc is not mounted!" >&2; exit 1; }
|
||||
ln -sf ../readline-%{rl_vers} readline
|
||||
LD_RUN_PATH=$PWD/../readline-%{rl_vers}
|
||||
export LD_RUN_PATH
|
||||
CC="gcc -I$PWD -L$PWD/../readline-%{rl_vers}"
|
||||
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
|
||||
"
|
||||
#
|
||||
# System readline library (comment out it not to be used)
|
||||
#
|
||||
READLINE="
|
||||
--with-installed-readline
|
||||
"
|
||||
bash support/mkconffiles -v
|
||||
./configure --build=%{_target_cpu}-suse-linux \
|
||||
--prefix=%{_prefix} \
|
||||
--mandir=%{_mandir} \
|
||||
--infodir=%{_infodir} \
|
||||
--libdir=%{_libdir} \
|
||||
--docdir=%{_defaultdocdir}/bash \
|
||||
--with-curses \
|
||||
--with-afs \
|
||||
$SYSMALLOC \
|
||||
--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-array-variables \
|
||||
--enable-brace-expansion \
|
||||
--enable-command-timing \
|
||||
--enable-disabled-builtins \
|
||||
--disable-strict-posix-default \
|
||||
--enable-multibyte \
|
||||
--enable-separate-helpfiles=%{_datadir}/bash/helpfiles \
|
||||
$READLINE
|
||||
profilecflags=CFLAGS="$CFLAGS"
|
||||
%if 0%{?do_profiling}
|
||||
profilecflags=CFLAGS="$CFLAGS %cflags_profile_generate"
|
||||
%endif
|
||||
make "$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 TESTSCRIPT=%{SOURCE4} check
|
||||
kill -TERM $pid
|
||||
%if 0%{?do_profiling}
|
||||
rm -f jobs.gcda
|
||||
profilecflags=CFLAGS="$CFLAGS %cflags_profile_feedback -fprofile-correction"
|
||||
clean=clean
|
||||
%endif
|
||||
make "$profilecflags" $clean all
|
||||
make -C examples/loadables/
|
||||
make documentation
|
||||
|
||||
%install
|
||||
pushd ../readline-%{rl_vers}%{rextend}
|
||||
%make_install htmldir=%{_defaultdocdir}/readline \
|
||||
installdir=%{_defaultdocdir}/readline/examples
|
||||
%make_install install libdir=/%{_lib} linkagedir=%{_libdir}
|
||||
rm -rf %{buildroot}%{_defaultdocdir}/bash
|
||||
mkdir -p %{buildroot}%{_defaultdocdir}/bash
|
||||
chmod 0755 %{buildroot}/%{_lib}/libhistory.so.%{rl_vers}
|
||||
chmod 0755 %{buildroot}/%{_lib}/libreadline.so.%{rl_vers}
|
||||
rm -vf %{buildroot}/%{_lib}/libhistory.so.%{rl_vers}*old
|
||||
rm -vf %{buildroot}/%{_lib}/libreadline.so.%{rl_vers}*old
|
||||
rm -vf %{buildroot}/%{_lib}/libhistory.so
|
||||
rm -vf %{buildroot}/%{_lib}/libreadline.so
|
||||
ln -sf /%{_lib}/libhistory.so.%{rl_vers} %{buildroot}/%{_libdir}/libhistory.so
|
||||
ln -sf /%{_lib}/libreadline.so.%{rl_vers} %{buildroot}/%{_libdir}/libreadline.so
|
||||
mv -vf %{buildroot}/%{_lib}/libhistory.a %{buildroot}/%{_libdir}/libhistory.a
|
||||
mv -vf %{buildroot}/%{_lib}/libreadline.a %{buildroot}/%{_libdir}/libreadline.a
|
||||
rm -vrf %{buildroot}%{_datadir}/readline/
|
||||
popd
|
||||
%make_install
|
||||
make -C examples/loadables/ install-supported DESTDIR=%{buildroot} libdir=/%{_lib}
|
||||
rm -rf %{buildroot}%{_libdir}/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
|
||||
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 bash %{buildroot}%{_bindir}/sh
|
||||
%endif
|
||||
install -m 644 COMPAT NEWS %{buildroot}%{_defaultdocdir}/bash/
|
||||
install -m 644 COPYING %{buildroot}%{_defaultdocdir}/bash/
|
||||
install -m 644 doc/FAQ %{buildroot}%{_defaultdocdir}/bash/
|
||||
install -m 644 doc/INTRO %{buildroot}%{_defaultdocdir}/bash/
|
||||
install -m 644 doc/*.html %{buildroot}%{_defaultdocdir}/bash/
|
||||
install -m 644 doc/builtins.1 %{buildroot}%{_mandir}/man1/bashbuiltins.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}%{_defaultdocdir}/bash/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-%{bash_vers}> LANG=ja_JP
|
||||
bash-%{bash_vers}> echo -n "Hello"
|
||||
bash-%{bash_vers}>
|
||||
|
|
||||
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
|
||||
rm -fv %{buildroot}%{_libdir}/libhistory.so.*
|
||||
rm -fv %{buildroot}%{_libdir}/libreadline.so.*
|
||||
rm -fv %{buildroot}%{_defaultdocdir}/readline/INSTALL
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/skel
|
||||
install -m 644 %{S:5} %{buildroot}%{_sysconfdir}/skel/.bashrc
|
||||
install -m 644 %{S:6} %{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
|
||||
|
||||
%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
|
||||
|
||||
%post -n bash-doc
|
||||
%install_info --info-dir=%{_infodir} %{_infodir}/bash.info.gz
|
||||
|
||||
%preun -n bash-doc
|
||||
%install_info_delete --info-dir=%{_infodir} %{_infodir}/bash.info.gz
|
||||
|
||||
%post -n libreadline7 -p /sbin/ldconfig
|
||||
|
||||
%postun -n libreadline7 -p /sbin/ldconfig
|
||||
|
||||
%post -n readline-doc
|
||||
%install_info --info-dir=%{_infodir} %{_infodir}/history.info.gz
|
||||
%install_info --info-dir=%{_infodir} %{_infodir}/readline.info.gz
|
||||
%install_info --info-dir=%{_infodir} %{_infodir}/rluserman.info.gz
|
||||
|
||||
%preun -n readline-doc
|
||||
%install_info_delete --info-dir=%{_infodir} %{_infodir}/history.info.gz
|
||||
%install_info_delete --info-dir=%{_infodir} %{_infodir}/readline.info.gz
|
||||
%install_info_delete --info-dir=%{_infodir} %{_infodir}/rluserman.info.gz
|
||||
|
||||
%clean
|
||||
LD_LIBRARY_PATH=%{buildroot}/%{_lib} \
|
||||
ldd -u -r %{buildroot}/bin/bash || true
|
||||
ldd -u -r %{buildroot}/%{_lib}/libreadline.so.* || true
|
||||
%{?buildroot: %{__rm} -rf %{buildroot}}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%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
|
||||
/bin/bash
|
||||
%if %{with alternatives}
|
||||
/bin/sh
|
||||
%endif
|
||||
%dir %{_sysconfdir}/bash_completion.d
|
||||
%{_bindir}/bash
|
||||
%{_bindir}/bashbug
|
||||
%{_bindir}/rbash
|
||||
%if %{with alternatives}
|
||||
%{_bindir}/sh
|
||||
%endif
|
||||
%dir %{_datadir}/bash
|
||||
%dir %{_datadir}/bash/helpfiles
|
||||
%{_datadir}/bash/helpfiles/*
|
||||
|
||||
%if %{without alternatives}
|
||||
%files sh
|
||||
%defattr(-,root,root)
|
||||
/bin/sh
|
||||
%{_bindir}/sh
|
||||
%endif
|
||||
|
||||
%files -n bash-lang -f bash.lang
|
||||
%defattr(-,root,root)
|
||||
|
||||
%files -n bash-doc
|
||||
%defattr(-,root,root)
|
||||
%doc %{_infodir}/bash.info*
|
||||
%doc %{_mandir}/man1/bash.1*
|
||||
%doc %{_mandir}/man1/bashbuiltins.1*
|
||||
%doc %{_mandir}/man1/bashbug.1*
|
||||
%doc %{_mandir}/man1/rbash.1*
|
||||
%doc %{_defaultdocdir}/bash/
|
||||
|
||||
%if 0%suse_version >= 1020
|
||||
%files -n bash-devel
|
||||
%defattr(-,root,root)
|
||||
%dir /%{_includedir}/bash/
|
||||
%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
|
||||
%endif
|
||||
|
||||
%files -n bash-loadables
|
||||
%defattr(-,root,root)
|
||||
%dir %{_ldldir}/
|
||||
%dir %{_ldldir}/
|
||||
%{_ldldir}/*
|
||||
|
||||
%files -n libreadline7
|
||||
%defattr(-,root,root)
|
||||
%license COPYING
|
||||
/%{_lib}/libhistory.so.%{rl_major}
|
||||
/%{_lib}/libhistory.so.%{rl_vers}
|
||||
/%{_lib}/libreadline.so.%{rl_major}
|
||||
/%{_lib}/libreadline.so.%{rl_vers}
|
||||
|
||||
%files -n readline-devel
|
||||
%defattr(-,root,root)
|
||||
%{_incdir}/readline/
|
||||
%{_libdir}/libhistory.so
|
||||
%{_libdir}/libreadline.so
|
||||
|
||||
%files -n readline-devel-static
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libhistory.a
|
||||
%{_libdir}/libreadline.a
|
||||
|
||||
%files -n readline-doc
|
||||
%defattr(-,root,root)
|
||||
%doc %{_infodir}/history.info*
|
||||
%doc %{_infodir}/readline.info*
|
||||
%doc %{_infodir}/rluserman.info*
|
||||
%doc %{_mandir}/man3/history.3*
|
||||
%doc %{_mandir}/man3/readline.3*
|
||||
%doc %{_defaultdocdir}/readline/
|
||||
|
||||
%changelog
|
28
bsc1183064.patch
Normal file
28
bsc1183064.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
From 12beeabf52074f1061d8c12f0a1b57a743510b17 Mon Sep 17 00:00:00 2001
|
||||
From: Chet Ramey <chet.ramey@case.edu>
|
||||
Date: Tue, 12 Jun 2018 10:37:19 -0400
|
||||
Subject: commit bash-20180608 snapshot
|
||||
|
||||
---
|
||||
lib/readline/histfile.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
|
||||
(limited to 'lib/readline/histfile.c')
|
||||
|
||||
diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c
|
||||
index 399bcc39..dc64bde1 100644
|
||||
--- a/lib/readline/histfile.c
|
||||
+++ b/lib/readline/histfile.c
|
||||
@@ -396,7 +396,7 @@ read_history_range (const char *filename, int from, int to)
|
||||
{
|
||||
if (HIST_TIMESTAMP_START(line_start) == 0)
|
||||
{
|
||||
- if (last_ts == NULL && history_multiline_entries)
|
||||
+ if (last_ts == NULL && history_length > 0 && history_multiline_entries)
|
||||
_hs_append_history_line (history_length - 1, line_start);
|
||||
else
|
||||
add_history (line_start);
|
||||
--
|
||||
cgit v1.2.1
|
||||
|
28
dot.bashrc
Normal file
28
dot.bashrc
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Sample .bashrc for SuSE Linux
|
||||
# Copyright (c) SuSE GmbH Nuernberg
|
||||
|
||||
# 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.
|
||||
|
||||
# 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
|
||||
|
||||
# If you want to use a Palm device with Linux, uncomment the two lines below.
|
||||
# For some (older) Palm Pilots, you might need to set a lower baud rate
|
||||
# e.g. 57600 or 38400; lowest is 9600 (very slow!)
|
||||
#
|
||||
#export PILOTPORT=/dev/pilot
|
||||
#export PILOTRATE=115200
|
||||
|
||||
test -s ~/.alias && . ~/.alias || true
|
28
dot.profile
Normal file
28
dot.profile
Normal file
|
@ -0,0 +1,28 @@
|
|||
# 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
|
||||
|
||||
# Most applications support several languages for their output.
|
||||
# To make use of this feature, simply uncomment one of the lines below or
|
||||
# add your own one (see /usr/share/locale/locale.alias for more codes)
|
||||
# This overwrites the system default set in /etc/sysconfig/language
|
||||
# in the variable RC_LANG.
|
||||
#
|
||||
#export LANG=de_DE.UTF-8 # uncomment this line for German output
|
||||
#export LANG=fr_FR.UTF-8 # uncomment this line for French output
|
||||
#export LANG=es_ES.UTF-8 # uncomment this line for Spanish output
|
||||
|
||||
|
||||
# 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
|
15
man2html-no-timestamp.patch
Normal file
15
man2html-no-timestamp.patch
Normal 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");
|
129
readline-5.2-conf.patch
Normal file
129
readline-5.2-conf.patch
Normal file
|
@ -0,0 +1,129 @@
|
|||
---
|
||||
lib/readline/bind.c | 55 ++++++++++++++++++++++++++++++++++---------
|
||||
lib/readline/doc/rluser.texi | 3 +-
|
||||
lib/readline/rlconf.h | 2 -
|
||||
3 files changed, 47 insertions(+), 13 deletions(-)
|
||||
|
||||
--- lib/readline/bind.c
|
||||
+++ lib/readline/bind.c 2017-04-26 13:07:22.115249970 +0000
|
||||
@@ -826,6 +826,9 @@ rl_function_of_keyseq (keyseq, map, type
|
||||
/* The last key bindings file read. */
|
||||
static char *last_readline_init_file = (char *)NULL;
|
||||
|
||||
+/* Flag to read system init file */
|
||||
+static int read_system_init_file = 0;
|
||||
+
|
||||
/* The file we're currently reading key bindings from. */
|
||||
static const char *current_readline_init_file;
|
||||
static int current_readline_init_include_level;
|
||||
@@ -891,11 +894,14 @@ rl_re_read_init_file (count, ignore)
|
||||
return r;
|
||||
}
|
||||
|
||||
+/* Forward declarations */
|
||||
+static int sv_bell_style PARAMS((const char *));
|
||||
+
|
||||
/* Do key bindings from a file. If FILENAME is NULL it defaults
|
||||
to the first non-null filename from this list:
|
||||
1. the filename used for the previous call
|
||||
2. the value of the shell variable `INPUTRC'
|
||||
- 3. ~/.inputrc
|
||||
+ 3. /etc/inputrc and ~/.inputrc
|
||||
4. /etc/inputrc
|
||||
If the file existed and could be opened and read, 0 is returned,
|
||||
otherwise errno is returned. */
|
||||
@@ -905,18 +911,39 @@ rl_read_init_file (filename)
|
||||
{
|
||||
/* Default the filename. */
|
||||
if (filename == 0)
|
||||
- filename = last_readline_init_file;
|
||||
- if (filename == 0)
|
||||
- filename = sh_get_env_value ("INPUTRC");
|
||||
- if (filename == 0 || *filename == 0)
|
||||
+ {
|
||||
+ filename = last_readline_init_file;
|
||||
+ if (filename == 0)
|
||||
+ {
|
||||
+ filename = sh_get_env_value ("INPUTRC");
|
||||
+ read_system_init_file = 0;
|
||||
+ }
|
||||
+ if (filename == 0)
|
||||
+ {
|
||||
+ filename = DEFAULT_INPUTRC;
|
||||
+ read_system_init_file = 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (*filename == 0)
|
||||
{
|
||||
filename = DEFAULT_INPUTRC;
|
||||
- /* Try to read DEFAULT_INPUTRC; fall back to SYS_INPUTRC on failure */
|
||||
- if (_rl_read_init_file (filename, 0) == 0)
|
||||
- return 0;
|
||||
- filename = SYS_INPUTRC;
|
||||
+ read_system_init_file = 1;
|
||||
}
|
||||
|
||||
+ sv_bell_style(sh_get_env_value("DEFAULT_BELL_STYLE"));
|
||||
+
|
||||
+ if (read_system_init_file)
|
||||
+ if (filename == last_readline_init_file)
|
||||
+ {
|
||||
+ filename = savestring (filename);
|
||||
+ _rl_read_init_file (SYS_INPUTRC, 0);
|
||||
+ free (last_readline_init_file);
|
||||
+ last_readline_init_file = filename;
|
||||
+ }
|
||||
+ else
|
||||
+ _rl_read_init_file (SYS_INPUTRC, 0);
|
||||
+
|
||||
#if defined (__MSDOS__)
|
||||
if (_rl_read_init_file (filename, 0) == 0)
|
||||
return 0;
|
||||
@@ -1467,7 +1494,14 @@ remove_trailing:
|
||||
rl_macro_bind (seq, &funname[1], _rl_keymap);
|
||||
}
|
||||
else
|
||||
- rl_bind_keyseq (seq, rl_named_function (funname));
|
||||
+ {
|
||||
+#if defined (PREFIX_META_HACK)
|
||||
+ if (_rl_stricmp (funname, "prefix-meta") == 0)
|
||||
+ rl_generic_bind (ISKMAP, seq, (char *)emacs_meta_keymap, _rl_keymap);
|
||||
+ else
|
||||
+#endif
|
||||
+ rl_bind_keyseq (seq, rl_named_function (funname));
|
||||
+ }
|
||||
|
||||
xfree (seq);
|
||||
return 0;
|
||||
@@ -1632,7 +1666,6 @@ typedef int _rl_sv_func_t PARAMS((const
|
||||
#define V_INT 2
|
||||
|
||||
/* Forward declarations */
|
||||
-static int sv_bell_style PARAMS((const char *));
|
||||
static int sv_combegin PARAMS((const char *));
|
||||
static int sv_dispprefix PARAMS((const char *));
|
||||
static int sv_compquery PARAMS((const char *));
|
||||
--- lib/readline/doc/rluser.texi
|
||||
+++ lib/readline/doc/rluser.texi 2017-04-26 12:57:24.590906421 +0000
|
||||
@@ -349,7 +349,8 @@ file is taken from the value of the envi
|
||||
@end ifclear
|
||||
that variable is unset, the default is @file{~/.inputrc}. If that
|
||||
file does not exist or cannot be read, the ultimate default is
|
||||
-@file{/etc/inputrc}.
|
||||
+@file{/etc/inputrc}. If both @file{~/.inputrc} and @file{/etc/inputrc}
|
||||
+exist Readline will read first @file{/etc/inputrc} and then @file{~/.inputrc}.
|
||||
|
||||
When a program which uses the Readline library starts up, the
|
||||
init file is read, and the key bindings are set.
|
||||
--- lib/readline/rlconf.h
|
||||
+++ lib/readline/rlconf.h 2017-04-26 12:57:24.586906499 +0000
|
||||
@@ -37,7 +37,7 @@
|
||||
#define HANDLE_SIGNALS
|
||||
|
||||
/* Ugly but working hack for binding prefix meta. */
|
||||
-#define PREFIX_META_HACK
|
||||
+#undef PREFIX_META_HACK
|
||||
|
||||
/* The next-to-last-ditch effort file name for a user-specific init file. */
|
||||
#define DEFAULT_INPUTRC "~/.inputrc"
|
24
readline-6.2-endpw.dif
Normal file
24
readline-6.2-endpw.dif
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
lib/readline/complete.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- lib/readline/complete.c
|
||||
+++ lib/readline/complete.c 2011-11-21 12:51:35.695646715 +0000
|
||||
@@ -89,6 +89,7 @@ typedef int QSFUNC ();
|
||||
defined. */
|
||||
#if defined (HAVE_GETPWENT) && (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE))
|
||||
extern struct passwd *getpwent PARAMS((void));
|
||||
+extern void endpwent ();
|
||||
#endif /* HAVE_GETPWENT && (!HAVE_GETPW_DECLS || _POSIX_SOURCE) */
|
||||
|
||||
/* If non-zero, then this is the address of a function to call when
|
||||
@@ -2316,6 +2317,9 @@ rl_username_completion_function (text, s
|
||||
if (first_char == '~')
|
||||
rl_filename_completion_desired = 1;
|
||||
|
||||
+#if defined (HAVE_GETPWENT)
|
||||
+ /* endpwent (); */
|
||||
+#endif
|
||||
return (value);
|
||||
}
|
||||
#endif /* !__WIN32__ && !__OPENNT */
|
14
readline-6.2-metamode.patch
Normal file
14
readline-6.2-metamode.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
lib/readline/bind.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- lib/readline/bind.c
|
||||
+++ lib/readline/bind.c 2011-03-04 15:00:17.332426313 +0000
|
||||
@@ -1613,6 +1613,7 @@ static const struct {
|
||||
#if defined (VISIBLE_STATS)
|
||||
{ "visible-stats", &rl_visible_stats, 0 },
|
||||
#endif /* VISIBLE_STATS */
|
||||
+ { "meta-mode", &_rl_enable_meta, 0 },
|
||||
{ (char *)NULL, (int *)NULL, 0 }
|
||||
};
|
||||
|
43
readline-6.2-xmalloc.dif
Normal file
43
readline-6.2-xmalloc.dif
Normal file
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
xfree.c | 3 +++
|
||||
xmalloc.c | 5 +++++
|
||||
xmalloc.h | 8 ++++++++
|
||||
3 files changed, 16 insertions(+)
|
||||
|
||||
--- xfree.c
|
||||
+++ xfree.c 2012-10-17 12:48:37.862344784 +0000
|
||||
@@ -48,3 +48,6 @@ xfree (string)
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
+
|
||||
+#undef xfree
|
||||
+extern void xfree PARAMS((void *)) __attribute__ ((weak, alias ("_rl_xfree")));
|
||||
--- xmalloc.c
|
||||
+++ xmalloc.c 2012-10-17 12:48:28.430844890 +0000
|
||||
@@ -77,3 +77,8 @@ xrealloc (pointer, bytes)
|
||||
memory_error_and_abort ("xrealloc");
|
||||
return (temp);
|
||||
}
|
||||
+
|
||||
+#undef xmalloc
|
||||
+#undef xrealloc
|
||||
+extern PTR_T xmalloc PARAMS((size_t)) __attribute__ ((weak, alias ("_rl_xmalloc")));
|
||||
+extern PTR_T xrealloc PARAMS((void *, size_t)) __attribute__ ((weak, alias ("_rl_xrealloc")));
|
||||
--- xmalloc.h
|
||||
+++ xmalloc.h 2012-10-17 12:27:20.325156790 +0000
|
||||
@@ -38,6 +38,14 @@
|
||||
|
||||
#endif /* !PTR_T */
|
||||
|
||||
+#undef xmalloc
|
||||
+#undef xrealloc
|
||||
+#undef xfree
|
||||
+
|
||||
+#define xmalloc _rl_xmalloc
|
||||
+#define xrealloc _rl_xrealloc
|
||||
+#define xfree _rl_xfree
|
||||
+
|
||||
extern PTR_T xmalloc PARAMS((size_t));
|
||||
extern PTR_T xrealloc PARAMS((void *, size_t));
|
||||
extern void xfree PARAMS((void *));
|
200
readline-6.3-destdir.patch
Normal file
200
readline-6.3-destdir.patch
Normal file
|
@ -0,0 +1,200 @@
|
|||
---
|
||||
shlib/Makefile.in | 9 +++++----
|
||||
support/shlib-install | 47 +++++++++++++++++++++++++++--------------------
|
||||
2 files changed, 32 insertions(+), 24 deletions(-)
|
||||
|
||||
--- shlib/Makefile.in
|
||||
+++ shlib/Makefile.in 2014-04-17 10:51:05.898235056 +0000
|
||||
@@ -59,6 +59,7 @@ bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
datadir = @datadir@
|
||||
localedir = @localedir@
|
||||
+linkagedir = $(libdir)
|
||||
|
||||
# Support an alternate destination root directory for package building
|
||||
DESTDIR =
|
||||
@@ -192,8 +193,8 @@ installdirs: $(topdir)/support/mkdirs
|
||||
-$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(bindir)
|
||||
|
||||
install-supported: installdirs $(SHLIB_STATUS)
|
||||
- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
|
||||
- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
|
||||
+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
|
||||
+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
|
||||
@echo install: you may need to run ldconfig
|
||||
|
||||
install-unsupported:
|
||||
@@ -202,8 +203,8 @@ install-unsupported:
|
||||
install: install-$(SHLIB_STATUS)
|
||||
|
||||
uninstall-supported:
|
||||
- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_HISTORY)
|
||||
- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_READLINE)
|
||||
+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -U $(SHARED_HISTORY)
|
||||
+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -U $(SHARED_READLINE)
|
||||
@echo uninstall: you may need to run ldconfig
|
||||
|
||||
uninstall-unsupported:
|
||||
--- support/shlib-install
|
||||
+++ support/shlib-install 2014-04-17 10:54:11.938235782 +0000
|
||||
@@ -3,7 +3,7 @@
|
||||
# shlib-install - install a shared library and do any necessary host-specific
|
||||
# post-installation configuration (like ldconfig)
|
||||
#
|
||||
-# usage: shlib-install [-D] -O host_os [-V host_vendor] -d installation-dir [-b bin-dir] -i install-prog [-U] library
|
||||
+# usage: shlib-install [-D] -O host_os [-V host_vendor] -d installation-dir [-l linkage-dir] [-b bin-dir] -i install-prog [-U] library
|
||||
#
|
||||
# Chet Ramey
|
||||
# chet@po.cwru.edu
|
||||
@@ -12,10 +12,12 @@
|
||||
# defaults
|
||||
#
|
||||
INSTALLDIR=/usr/local/lib
|
||||
+LINKAGEDIR=
|
||||
LDCONFIG=ldconfig
|
||||
+DESTDIR=
|
||||
|
||||
PROGNAME=`basename $0`
|
||||
-USAGE="$PROGNAME [-D] -O host_os [-V host_vendor] -d installation-dir [-b bin-dir] -i install-prog [-U] library"
|
||||
+USAGE="$PROGNAME [-D] -O host_os [-V host_vendor] [-l linkage-dir] -d installation-dir [-b bin-dir] -i install-prog [-U] library"
|
||||
|
||||
# process options
|
||||
|
||||
@@ -24,14 +26,19 @@ while [ $# -gt 0 ]; do
|
||||
-O) shift; host_os="$1"; shift ;;
|
||||
-V) shift; host_vendor="$1"; shift ;;
|
||||
-d) shift; INSTALLDIR="$1"; shift ;;
|
||||
+ -dd) shift; DESTDIR=$1; shift ;;
|
||||
-b) shift; BINDIR="$1" ; shift ;;
|
||||
-i) shift; INSTALLPROG="$1" ; shift ;;
|
||||
+ -l) shift; LINKAGEDIR="$1" ; shift ;;
|
||||
-D) echo=echo ; shift ;;
|
||||
-U) uninstall=true ; shift ;;
|
||||
-*) echo "$USAGE" >&2 ; exit 2;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
+if [ -z "$LINKAGEDIR" ]; then
|
||||
+ LINKAGEDIR="$INSTALLDIR"
|
||||
+fi
|
||||
|
||||
# set install target name
|
||||
LIBNAME="$1"
|
||||
@@ -49,18 +56,18 @@ LN="ln -s"
|
||||
# pre-install
|
||||
|
||||
if [ -z "$uninstall" ]; then
|
||||
- ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
|
||||
- if [ -f "$INSTALLDIR/$LIBNAME" ]; then
|
||||
- ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
|
||||
+ ${echo} $RM ${DESTDIR}${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
|
||||
+ if [ -f "${DESTDIR}$INSTALLDIR/$LIBNAME" ]; then
|
||||
+ ${echo} $MV ${DESTDIR}$INSTALLDIR/$LIBNAME ${DESTDIR}${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
|
||||
fi
|
||||
fi
|
||||
|
||||
# install/uninstall
|
||||
|
||||
if [ -z "$uninstall" ] ; then
|
||||
- ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
|
||||
+ ${echo} eval ${INSTALLPROG} $LIBNAME ${DESTDIR}${INSTALLDIR}/${LIBNAME}
|
||||
else
|
||||
- ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
|
||||
+ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/${LIBNAME}
|
||||
fi
|
||||
|
||||
# post-install/uninstall
|
||||
@@ -73,7 +80,7 @@ fi
|
||||
case "$host_os" in
|
||||
hpux*|darwin*|macosx*|linux*|solaris2*)
|
||||
if [ -z "$uninstall" ]; then
|
||||
- chmod 555 ${INSTALLDIR}/${LIBNAME}
|
||||
+ chmod 555 ${DESTDIR}${INSTALLDIR}/${LIBNAME}
|
||||
fi ;;
|
||||
cygwin*|mingw*)
|
||||
IMPLIBNAME=`echo ${LIBNAME} \
|
||||
@@ -111,8 +118,8 @@ case "$LIBNAME" in
|
||||
LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]\.[0-9]:\1:'` # libname.dylib
|
||||
esac
|
||||
|
||||
-INSTALL_LINK1='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
|
||||
-INSTALL_LINK2='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
|
||||
+INSTALL_LINK1='${echo} cd ${DESTDIR}$INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
|
||||
+INSTALL_LINK2='${echo} cd ${DESTDIR}$INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
|
||||
|
||||
#
|
||||
# Create symlinks to the installed library. This section is incomplete.
|
||||
@@ -120,27 +127,27 @@ INSTALL_LINK2='${echo} cd $INSTALLDIR &&
|
||||
case "$host_os-$host_vendor" in
|
||||
*linux*|freebsd*-gentoo)
|
||||
# libname.so.M -> libname.so.M.N
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK2
|
||||
+ ${echo} ${RM} {DESTDIR}${INSTALLDIR}/$LINK2
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK2
|
||||
fi
|
||||
|
||||
# libname.so -> libname.so.M
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
|
||||
+ ${echo} ${RM} {DESTDIR}${INSTALLDIR}/$LINK1
|
||||
if [ -z "$uninstall" ]; then
|
||||
- ${echo} cd $INSTALLDIR && ${echo} ${LN} $LINK2 $LINK1
|
||||
+ ${echo} cd {DESTDIR}$INSTALLDIR && ${echo} ${LN} $LINK2 $LINK1
|
||||
fi
|
||||
;;
|
||||
|
||||
bsdi4*|*gnu*|darwin*|macosx*|netbsd*|mirbsd*)
|
||||
# libname.so.M -> libname.so.M.N
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK2
|
||||
+ ${echo} ${RM} {DESTDIR}${INSTALLDIR}/$LINK2
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK2
|
||||
fi
|
||||
|
||||
# libname.so -> libname.so.M.N
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
|
||||
+ ${echo} ${RM} {DESTDIR}${INSTALLDIR}/$LINK1
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK1
|
||||
fi
|
||||
@@ -148,7 +155,7 @@ bsdi4*|*gnu*|darwin*|macosx*|netbsd*|mir
|
||||
|
||||
solaris2*|aix4.[2-9]*|aix[5-9]*|osf*|irix[56]*|sysv[45]*|dgux*|interix*)
|
||||
# libname.so -> libname.so.M
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
|
||||
+ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK1
|
||||
fi
|
||||
@@ -159,19 +166,19 @@ solaris2*|aix4.[2-9]*|aix[5-9]*|osf*|iri
|
||||
freebsd3*|freebsdaout*)
|
||||
if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
|
||||
# libname.so -> libname.so.M
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
|
||||
+ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK1
|
||||
fi
|
||||
else
|
||||
# libname.so.M -> libname.so.M.N
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK2
|
||||
+ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK2
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK2
|
||||
fi
|
||||
|
||||
# libname.so -> libname.so.M.N
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
|
||||
+ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK1
|
||||
fi
|
||||
@@ -188,7 +195,7 @@ freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*
|
||||
|
||||
hpux1*)
|
||||
# libname.sl -> libname.M
|
||||
- ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
|
||||
+ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1.sl
|
||||
if [ -z "$uninstall" ]; then
|
||||
eval $INSTALL_LINK1
|
||||
fi
|
51
readline-6.3-input.dif
Normal file
51
readline-6.3-input.dif
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
lib/readline/input.c | 7 ++++++-
|
||||
lib/readline/readline.c | 7 +++++++
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
--- lib/readline/input.c
|
||||
+++ lib/readline/input.c 2003-03-17 19:03:51.000000000 +0000
|
||||
@@ -489,6 +489,8 @@ rl_read_key ()
|
||||
return (c);
|
||||
}
|
||||
|
||||
+extern int _rl_read_zero_char_from_tty;
|
||||
+
|
||||
int
|
||||
rl_getc (stream)
|
||||
FILE *stream;
|
||||
@@ -526,7 +528,10 @@ rl_getc (stream)
|
||||
/* If zero characters are returned, then the file that we are
|
||||
reading from is empty! Return EOF in that case. */
|
||||
if (result == 0)
|
||||
- return (EOF);
|
||||
+ {
|
||||
+ _rl_read_zero_char_from_tty = 1;
|
||||
+ return (EOF);
|
||||
+ }
|
||||
|
||||
#if defined (__BEOS__)
|
||||
if (errno == EINTR)
|
||||
--- lib/readline/readline.c
|
||||
+++ lib/readline/readline.c 2014-04-17 10:24:16.302236347 +0000
|
||||
@@ -522,6 +522,9 @@ _rl_internal_char_cleanup ()
|
||||
_rl_erase_entire_line ();
|
||||
}
|
||||
|
||||
+/* Catch EOF from tty, do not return command line */
|
||||
+int _rl_read_zero_char_from_tty = 0;
|
||||
+
|
||||
STATIC_CALLBACK int
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
readline_internal_char ()
|
||||
@@ -570,6 +573,10 @@ readline_internal_charloop ()
|
||||
c = rl_read_key ();
|
||||
RL_UNSETSTATE(RL_STATE_READCMD);
|
||||
|
||||
+ /* Return here if terminal is closed */
|
||||
+ if (c == EOF && _rl_read_zero_char_from_tty)
|
||||
+ return (rl_done = 1);
|
||||
+
|
||||
/* look at input.c:rl_getc() for the circumstances under which this will
|
||||
be returned; punt immediately on read error without converting it to
|
||||
a newline; assume that rl_read_key has already called the signal
|
43
readline-6.3-rltrace.patch
Normal file
43
readline-6.3-rltrace.patch
Normal file
|
@ -0,0 +1,43 @@
|
|||
Even if used only by developers to debug readline library do not open
|
||||
temporary files from public location without O_EXCL (bcn#868822).
|
||||
|
||||
---
|
||||
lib/readline/util.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
--- lib/readline/util.c
|
||||
+++ lib/readline/util.c 2014-04-17 10:29:43.157274616 +0000
|
||||
@@ -504,10 +504,12 @@ _rl_trace (va_alist)
|
||||
|
||||
if (_rl_tracefp == 0)
|
||||
_rl_tropen ();
|
||||
+ if (!_rl_tracefp)
|
||||
+ goto out;
|
||||
vfprintf (_rl_tracefp, format, args);
|
||||
fprintf (_rl_tracefp, "\n");
|
||||
fflush (_rl_tracefp);
|
||||
-
|
||||
+out:
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
@@ -527,7 +529,7 @@ _rl_tropen ()
|
||||
#endif
|
||||
sprintf (fnbuf, "%s/rltrace.%ld", x, (long)getpid());
|
||||
unlink(fnbuf);
|
||||
- _rl_tracefp = fopen (fnbuf, "w+");
|
||||
+ _rl_tracefp = fopen (fnbuf, "w+xe");
|
||||
return _rl_tracefp != 0;
|
||||
}
|
||||
|
||||
@@ -535,8 +537,8 @@ int
|
||||
_rl_trclose ()
|
||||
{
|
||||
int r;
|
||||
-
|
||||
- r = fclose (_rl_tracefp);
|
||||
+ if (_rl_tracefp)
|
||||
+ r = fclose (_rl_tracefp);
|
||||
_rl_tracefp = 0;
|
||||
return r;
|
||||
}
|
49
readline-7.0-screen.patch
Normal file
49
readline-7.0-screen.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
Special for screen and its new TERM setting like TERM=screen.xterm-256color
|
||||
Map all "screen(-xxx)?.yyy(-zzz)?" to "screen" as well as map "konsole(-xxx)?"
|
||||
and "gnome(-xxx)?" to "xterm".
|
||||
|
||||
This helps to get /etc/inputrc work for most users.
|
||||
|
||||
---
|
||||
lib/readline/bind.c | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
--- lib/readline/bind.c
|
||||
+++ lib/readline/bind.c 2019-08-16 11:03:55.654173671 +0000
|
||||
@@ -1113,19 +1113,34 @@ parser_if (args)
|
||||
word in ARGS is the same as the value stored in rl_readline_name. */
|
||||
if (rl_terminal_name && _rl_strnicmp (args, "term=", 5) == 0)
|
||||
{
|
||||
- char *tem, *tname;
|
||||
+ char *tem, *tname, *talias;
|
||||
|
||||
- /* Terminals like "aaa-60" are equivalent to "aaa". */
|
||||
tname = savestring (rl_terminal_name);
|
||||
+ /* Various terminal types of screen are equivalent to "screen" */
|
||||
+ if (_rl_strnicmp (rl_terminal_name, "screen", 6) == 0)
|
||||
+ {
|
||||
+ tem = strchr (tname, '.');
|
||||
+ if (tem)
|
||||
+ *tem = '\0';
|
||||
+ }
|
||||
+ /* Terminals like "aaa-60" are equivalent to "aaa". */
|
||||
tem = strchr (tname, '-');
|
||||
if (tem)
|
||||
*tem = '\0';
|
||||
|
||||
+ /* Map terminal types "konsole" and "gnome" to "xterm" nowadays */
|
||||
+ talias = tname;
|
||||
+ if (_rl_stricmp("konsole", tname) == 0)
|
||||
+ talias = "xterm";
|
||||
+ if (_rl_stricmp("gnome", tname) == 0)
|
||||
+ talias = "xterm";
|
||||
+
|
||||
/* Test the `long' and `short' forms of the terminal name so that
|
||||
if someone has a `sun-cmd' and does not want to have bindings
|
||||
that will be executed if the terminal is a `sun', they can put
|
||||
`$if term=sun-cmd' into their .inputrc. */
|
||||
_rl_parsing_conditionalized_out = _rl_stricmp (args + 5, tname) &&
|
||||
+ _rl_stricmp (args + 5, talias) &&
|
||||
_rl_stricmp (args + 5, rl_terminal_name);
|
||||
xfree (tname);
|
||||
}
|
161
readline-7.0.dif
Normal file
161
readline-7.0.dif
Normal file
|
@ -0,0 +1,161 @@
|
|||
---
|
||||
Makefile.in | 4 +---
|
||||
complete.c | 6 +++---
|
||||
doc/Makefile.in | 2 +-
|
||||
doc/readline.3 | 11 +++++++++++
|
||||
history.h | 1 +
|
||||
readline.c | 7 +++++--
|
||||
readline.h | 3 ++-
|
||||
support/shobj-conf | 5 +++--
|
||||
8 files changed, 27 insertions(+), 12 deletions(-)
|
||||
|
||||
--- Makefile.in
|
||||
+++ Makefile.in 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -233,10 +233,8 @@ uninstall-headers:
|
||||
maybe-uninstall-headers: uninstall-headers
|
||||
|
||||
install-static: installdirs $(STATIC_LIBS) install-headers install-doc install-examples
|
||||
- -$(MV) $(DESTDIR)$(libdir)/libreadline.a $(DESTDIR)$(libdir)/libreadline.old
|
||||
$(INSTALL_DATA) libreadline.a $(DESTDIR)$(libdir)/libreadline.a
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libreadline.a
|
||||
- -$(MV) $(DESTDIR)$(libdir)/libhistory.a $(DESTDIR)$(libdir)/libhistory.old
|
||||
$(INSTALL_DATA) libhistory.a $(DESTDIR)$(libdir)/libhistory.a
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libhistory.a
|
||||
|
||||
@@ -266,7 +264,7 @@ install-doc: installdirs
|
||||
$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
|
||||
-( if test -d doc ; then \
|
||||
cd doc && \
|
||||
- ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
|
||||
+ ${MAKE} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
|
||||
fi )
|
||||
|
||||
uninstall-doc:
|
||||
--- complete.c
|
||||
+++ complete.c 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -1152,7 +1152,7 @@ _rl_find_completion_word (fp, dp)
|
||||
/* We didn't find an unclosed quoted substring upon which to do
|
||||
completion, so use the word break characters to find the
|
||||
substring on which to complete. */
|
||||
- while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
|
||||
+ while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)))
|
||||
{
|
||||
scan = rl_line_buffer[rl_point];
|
||||
|
||||
@@ -2229,7 +2229,7 @@ rl_completion_matches (text, entry_funct
|
||||
match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
|
||||
match_list[1] = (char *)NULL;
|
||||
|
||||
- while (string = (*entry_function) (text, matches))
|
||||
+ while ((string = (*entry_function) (text, matches)))
|
||||
{
|
||||
if (RL_SIG_RECEIVED ())
|
||||
{
|
||||
@@ -2303,7 +2303,7 @@ rl_username_completion_function (text, s
|
||||
}
|
||||
|
||||
#if defined (HAVE_GETPWENT)
|
||||
- while (entry = getpwent ())
|
||||
+ while ((entry = getpwent ()))
|
||||
{
|
||||
/* Null usernames should result in all users as possible completions. */
|
||||
if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
|
||||
--- doc/Makefile.in
|
||||
+++ doc/Makefile.in 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -107,7 +107,7 @@ DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ
|
||||
# $(RM) $@
|
||||
# -${TEXI2PDF} $<
|
||||
|
||||
-all: info dvi html ps text pdf
|
||||
+all: info html
|
||||
nodvi: info html text
|
||||
|
||||
xdist: $(DIST_DOCS)
|
||||
--- doc/readline.3
|
||||
+++ doc/readline.3 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -119,6 +119,14 @@ environment variable. If that variable
|
||||
.IR ~/.inputrc .
|
||||
If that file does not exist or cannot be read, the ultimate default is
|
||||
.IR /etc/inputrc .
|
||||
+If both files
|
||||
+.I ~/.inputrc
|
||||
+and
|
||||
+.I /etc/inputrc
|
||||
+exist readline will read first
|
||||
+.I /etc/inputrc
|
||||
+and then
|
||||
+.IR ~/.inputrc .
|
||||
When a program which uses the readline library starts up, the
|
||||
init file is read, and the key bindings and variables are set.
|
||||
There are only a few basic constructs allowed in the
|
||||
@@ -1457,6 +1465,9 @@ VI Command Mode functions
|
||||
.TP
|
||||
.FN ~/.inputrc
|
||||
Individual \fBreadline\fP initialization file
|
||||
+.TP
|
||||
+.FN /etc/inputrc
|
||||
+System \fBreadline\fP initialization file
|
||||
.PD
|
||||
.SH AUTHORS
|
||||
Brian Fox, Free Software Foundation
|
||||
--- history.h
|
||||
+++ history.h 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -32,6 +32,7 @@ extern "C" {
|
||||
# include "rlstdc.h"
|
||||
# include "rltypedefs.h"
|
||||
#else
|
||||
+# include <stdio.h>
|
||||
# include <readline/rlstdc.h>
|
||||
# include <readline/rltypedefs.h>
|
||||
#endif
|
||||
--- readline.c
|
||||
+++ readline.c 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -851,8 +851,11 @@ _rl_dispatch_subseq (key, map, got_subse
|
||||
{
|
||||
/* Special case rl_do_lowercase_version (). */
|
||||
if (func == rl_do_lowercase_version)
|
||||
- /* Should we do anything special if key == ANYOTHERKEY? */
|
||||
- return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
|
||||
+ {
|
||||
+ if (key == ANYOTHERKEY)
|
||||
+ return -1;
|
||||
+ return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
|
||||
+ }
|
||||
|
||||
rl_executing_keymap = map;
|
||||
rl_executing_key = key;
|
||||
--- readline.h
|
||||
+++ readline.h 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -32,6 +32,7 @@ extern "C" {
|
||||
# include "keymaps.h"
|
||||
# include "tilde.h"
|
||||
#else
|
||||
+# include <stdio.h>
|
||||
# include <readline/rlstdc.h>
|
||||
# include <readline/rltypedefs.h>
|
||||
# include <readline/keymaps.h>
|
||||
@@ -467,7 +468,7 @@ extern char *rl_filename_completion_func
|
||||
|
||||
extern int rl_completion_mode PARAMS((rl_command_func_t *));
|
||||
|
||||
-#if 0
|
||||
+#ifdef OLD_READLINE
|
||||
/* Backwards compatibility (compat.c). These will go away sometime. */
|
||||
extern void free_undo_list PARAMS((void));
|
||||
extern int maybe_save_line PARAMS((void));
|
||||
--- support/shobj-conf
|
||||
+++ support/shobj-conf 2016-09-14 08:59:09.830092311 +0000
|
||||
@@ -126,10 +126,11 @@ sunos5*|solaris2*)
|
||||
linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
|
||||
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
|
||||
;;
|
||||
|
||||
freebsd2*)
|
58
run-tests
Normal file
58
run-tests
Normal file
|
@ -0,0 +1,58 @@
|
|||
#! /bin/sh
|
||||
|
||||
: ${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
|
||||
|
||||
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
|
||||
|
||||
${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 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
trap 'rm -f $tmp' EXIT TERM INT QUIT
|
||||
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
|
Loading…
Add table
Reference in a new issue