bash-1.5.8 rebuild

This commit is contained in:
Rmys
2021-09-21 12:24:31 +03:00
committed by GitHub
parent 5c05acbfd0
commit a396993765
9 changed files with 209 additions and 219 deletions
@@ -1,8 +1,8 @@
diff --git a/config.h.in b/config.h.in diff --git a/config.h.in b/config.h.in
index a5ad9e7..62a6b32 100644 index ab316d4..11d1d68 100644
--- a/config.h.in --- a/config.h.in
+++ b/config.h.in +++ b/config.h.in
@@ -748,6 +748,9 @@ @@ -775,6 +775,9 @@
/* Define if you have the pselect function. */ /* Define if you have the pselect function. */
#undef HAVE_PSELECT #undef HAVE_PSELECT
@@ -12,7 +12,7 @@ index a5ad9e7..62a6b32 100644
/* Define if you have the putenv function. */ /* Define if you have the putenv function. */
#undef HAVE_PUTENV #undef HAVE_PUTENV
@@ -946,6 +949,9 @@ @@ -981,6 +984,9 @@
/* Define if you have the <dlfcn.h> header file. */ /* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
@@ -23,29 +23,20 @@ index a5ad9e7..62a6b32 100644
#undef HAVE_GRP_H #undef HAVE_GRP_H
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index ce4e9b6..eda95d6 100644 index 2fe3e7d..f1b7f1b 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -700,7 +700,7 @@ BASH_HEADER_INTTYPES @@ -827,7 +827,7 @@ dnl checks for system calls
AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \ AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getentropy getgroups \
memory.h locale.h termcap.h termio.h termios.h dlfcn.h \ gethostname getpagesize getpeername getrandom getrlimit \
stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \ getrusage gettimeofday kill killpg lstat pselect readlink \
- regex.h syslog.h ulimit.h) - select setdtablesize setitimer tcgetpgrp uname ulimit waitpid)
+ regex.h syslog.h ulimit.h elf.h) + select setdtablesize setitimer tcgetpgrp uname ulimit waitpid pread)
AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
sys/param.h sys/socket.h sys/stat.h \
sys/time.h sys/times.h sys/types.h sys/wait.h)
@@ -771,7 +771,7 @@ dnl checks for system calls
AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
getpagesize getpeername getrlimit getrusage gettimeofday \
kill killpg lstat pselect readlink sbrk select setdtablesize \
- setitimer tcgetpgrp uname ulimit waitpid)
+ setitimer tcgetpgrp uname ulimit waitpid pread)
AC_REPLACE_FUNCS(rename) AC_REPLACE_FUNCS(rename)
dnl checks for c library functions dnl checks for c library functions
diff --git a/execute_cmd.c b/execute_cmd.c diff --git a/execute_cmd.c b/execute_cmd.c
index 2a3df6d..b5cd405 100644 index d2a0dd7..d2555ad 100644
--- a/execute_cmd.c --- a/execute_cmd.c
+++ b/execute_cmd.c +++ b/execute_cmd.c
@@ -41,6 +41,10 @@ @@ -41,6 +41,10 @@
@@ -59,7 +50,7 @@ index 2a3df6d..b5cd405 100644
#include "posixtime.h" #include "posixtime.h"
#if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE) #if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE)
@@ -5486,6 +5490,14 @@ shell_execve (command, args, env) @@ -5832,6 +5836,14 @@ shell_execve (command, args, env)
{ {
/* The file has the execute bits set, but the kernel refuses to /* The file has the execute bits set, but the kernel refuses to
run it for some reason. See why. */ run it for some reason. See why. */
@@ -74,18 +65,19 @@ index 2a3df6d..b5cd405 100644
#if defined (HAVE_HASH_BANG_EXEC) #if defined (HAVE_HASH_BANG_EXEC)
READ_SAMPLE_BUF (command, sample, sample_len); READ_SAMPLE_BUF (command, sample, sample_len);
if (sample_len > 0) if (sample_len > 0)
@@ -5495,6 +5507,7 @@ shell_execve (command, args, env) @@ -5841,6 +5853,7 @@ shell_execve (command, args, env)
char *interp; char *interp;
int ilen; int ilen;
+ close (fd); + close (fd);
interp = getinterp (sample, sample_len, (int *)NULL); interp = getinterp (sample, sample_len, (int *)NULL);
ilen = strlen (interp); ilen = strlen (interp);
errno = i; errno = i;
@@ -5510,6 +5523,136 @@ shell_execve (command, args, env) @@ -5856,7 +5869,138 @@ shell_execve (command, args, env)
return (EX_NOEXEC); return (EX_NOEXEC);
} }
#endif #endif
- errno = i;
+#if defined (HAVE_ELF_H) +#if defined (HAVE_ELF_H)
+ if (i == ENOENT + if (i == ENOENT
+ && sample_len > EI_NIDENT + && sample_len > EI_NIDENT
@@ -216,9 +208,8 @@ index 2a3df6d..b5cd405 100644
+#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H) +#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
+ close (fd); + close (fd);
+#endif +#endif
errno = i; +
+ errno = i;
file_error (command); file_error (command);
} }
-- return (last_command_exit_value);
2.9.3
@@ -1,12 +1,13 @@
diff -up bash-4.0/config-top.h.ssh_source_bash bash-4.0/config-top.h diff --git a/config-top.h b/config-top.h
--- bash-4.0/config-top.h.ssh_source_bash 2009-01-21 15:20:06.000000000 +0100 index e5cc147..f5e0a52 100644
+++ bash-4.0/config-top.h 2009-01-21 15:25:46.000000000 +0100 --- a/config-top.h
@@ -90,7 +90,7 @@ +++ b/config-top.h
@@ -106,7 +106,7 @@
sshd and source the .bashrc if so (like the rshd behavior). This checks 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, for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
which can be fooled under certain not-uncommon circumstances. */ which can be fooled under certain not-uncommon circumstances. */
-/* #define SSH_SOURCE_BASHRC */ -/* #define SSH_SOURCE_BASHRC */
+#define SSH_SOURCE_BASHRC +#define SSH_SOURCE_BASHRC
/* Define if you want the case-capitalizing operators (~[~]) and the /* Define if you want the case-toggling operators (~[~]) and the
`capcase' variable attribute (declare -c). */ `capcase' variable attribute (declare -c). */
@@ -1,7 +1,8 @@
diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c diff --git a/execute_cmd.c b/execute_cmd.c
--- bash-4.2/execute_cmd.c.coverity 2011-02-24 13:04:35.000000000 +0100 index a988400..412128c 100644
+++ bash-4.2/execute_cmd.c 2011-02-24 13:49:13.000000000 +0100 --- a/execute_cmd.c
@@ -5036,7 +5036,7 @@ shell_execve (command, args, env) +++ b/execute_cmd.c
@@ -5760,7 +5760,7 @@ shell_execve (command, args, env)
Elf32_Ehdr ehdr; Elf32_Ehdr ehdr;
Elf32_Phdr *phdr; Elf32_Phdr *phdr;
Elf32_Shdr *shdr; Elf32_Shdr *shdr;
@@ -10,7 +11,7 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
/* We have to copy the data since the sample buffer /* We have to copy the data since the sample buffer
might not be aligned correctly to be accessed as might not be aligned correctly to be accessed as
@@ -5044,12 +5044,12 @@ shell_execve (command, args, env) @@ -5768,12 +5768,12 @@ shell_execve (command, args, env)
memcpy (&ehdr, sample, sizeof (Elf32_Ehdr)); memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
nshdr = ehdr.e_shnum; nshdr = ehdr.e_shnum;
@@ -25,7 +26,7 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
ehdr.e_shoff); ehdr.e_shoff);
#else #else
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1) if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
@@ -5091,11 +5091,11 @@ shell_execve (command, args, env) @@ -5815,11 +5815,11 @@ shell_execve (command, args, env)
} }
nphdr = ehdr.e_phnum; nphdr = ehdr.e_phnum;
@@ -39,7 +40,7 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
ehdr.e_phoff); ehdr.e_phoff);
#else #else
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1) if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
@@ -5120,7 +5120,7 @@ shell_execve (command, args, env) @@ -5844,7 +5844,7 @@ shell_execve (command, args, env)
Elf64_Ehdr ehdr; Elf64_Ehdr ehdr;
Elf64_Phdr *phdr; Elf64_Phdr *phdr;
Elf64_Shdr *shdr; Elf64_Shdr *shdr;
@@ -48,7 +49,7 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
/* We have to copy the data since the sample buffer /* We have to copy the data since the sample buffer
might not be aligned correctly to be accessed as might not be aligned correctly to be accessed as
@@ -5128,11 +5128,11 @@ shell_execve (command, args, env) @@ -5852,11 +5852,11 @@ shell_execve (command, args, env)
memcpy (&ehdr, sample, sizeof (Elf64_Ehdr)); memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
nshdr = ehdr.e_shnum; nshdr = ehdr.e_shnum;
@@ -62,7 +63,7 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
ehdr.e_shoff); ehdr.e_shoff);
#else #else
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1) if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
@@ -5174,11 +5174,11 @@ shell_execve (command, args, env) @@ -5898,11 +5898,11 @@ shell_execve (command, args, env)
} }
nphdr = ehdr.e_phnum; nphdr = ehdr.e_phnum;
@@ -76,7 +77,7 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
ehdr.e_phoff); ehdr.e_phoff);
#else #else
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1) if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
@@ -5200,8 +5200,8 @@ shell_execve (command, args, env) @@ -5924,8 +5924,8 @@ shell_execve (command, args, env)
if (offset != -1) if (offset != -1)
{ {
@@ -87,7 +88,7 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
char *interp = NULL; char *interp = NULL;
do do
@@ -5250,7 +5250,8 @@ shell_execve (command, args, env) @@ -5974,7 +5974,8 @@ shell_execve (command, args, env)
} }
#endif #endif
#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H) #if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
@@ -95,5 +96,8 @@ diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
+ if (fd >= 0) + if (fd >= 0)
+ close (fd); + close (fd);
#endif #endif
errno = i;
file_error (command); errno = i;
--
2.17.2
@@ -1,12 +1,13 @@
diff -up bash-4.3/locale.c.old bash-4.3/locale.c diff --git a/locale.c b/locale.c
--- bash-4.3/locale.c.old 2015-07-15 11:55:00.002857301 +0200 index 17ccc58..a6c07a3 100644
+++ bash-4.3/locale.c 2015-07-15 11:48:36.698086257 +0200 --- a/locale.c
@@ -77,8 +77,6 @@ set_default_locale () +++ b/locale.c
@@ -78,8 +78,6 @@ set_default_locale ()
{ {
#if defined (HAVE_SETLOCALE) #if defined (HAVE_SETLOCALE)
default_locale = setlocale (LC_ALL, ""); default_locale = setlocale (LC_ALL, "");
- if (default_locale) - if (default_locale)
- default_locale = savestring (default_locale); - default_locale = savestring (default_locale);
#else
default_locale = savestring ("C");
#endif /* HAVE_SETLOCALE */ #endif /* HAVE_SETLOCALE */
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -1,29 +1,29 @@
diff --git a/parse.y b/parse.y diff --git a/parse.y b/parse.y
index 30425a5..85f1c4f 100644 index df1231d..2449fa8 100644
--- a/parse.y --- a/parse.y
+++ b/parse.y +++ b/parse.y
@@ -4228,6 +4228,8 @@ xparse_dolparen (base, string, indp, flags) @@ -4482,6 +4482,8 @@ xparse_dolparen (base, string, indp, flags)
save_parser_state (&ps); save_parser_state (&ps);
save_input_line_state (&ls); save_input_line_state (&ls);
orig_eof_token = shell_eof_token; orig_eof_token = shell_eof_token;
+ /* avoid echoing every substitution again */ + /* avoid echoing every substitution again */
+ echo_input_at_read = 0; + echo_input_at_read = 0;
#if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
/*(*/ saved_pushed_strings = pushed_string_list; /* separate parsing context */
parser_state |= PST_CMDSUBST|PST_EOFTOKEN; /* allow instant ')' */ /*(*/ pushed_string_list = (STRING_SAVER *)NULL;
diff --git a/subst.c b/subst.c diff --git a/subst.c b/subst.c
index f1a4df1..a93a4ce 100644 index 9ccbf33..8a9ee5c 100644
--- a/subst.c --- a/subst.c
+++ b/subst.c +++ b/subst.c
@@ -8513,6 +8513,7 @@ param_expand (string, sindex, quoted, expanded_something, @@ -9453,6 +9453,7 @@ param_expand (string, sindex, quoted, expanded_something,
WORD_LIST *list; WORD_LIST *list, *l;
WORD_DESC *tdesc, *ret; WORD_DESC *tdesc, *ret;
int tflag; int tflag, nullarg;
+ int old_echo_input; + int old_echo_input;
/*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/ /*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/
zindex = *sindex; zindex = *sindex;
@@ -8831,6 +8832,9 @@ arithsub: @@ -9843,6 +9844,9 @@ arithsub:
} }
comsub: comsub:
@@ -33,7 +33,7 @@ index f1a4df1..a93a4ce 100644
if (pflags & PF_NOCOMSUB) if (pflags & PF_NOCOMSUB)
/* we need zindex+1 because string[zindex] == RPAREN */ /* we need zindex+1 because string[zindex] == RPAREN */
temp1 = substring (string, *sindex, zindex+1); temp1 = substring (string, *sindex, zindex+1);
@@ -8843,6 +8847,7 @@ comsub: @@ -9855,6 +9859,7 @@ comsub:
} }
FREE (temp); FREE (temp);
temp = temp1; temp = temp1;
@@ -41,6 +41,3 @@ index f1a4df1..a93a4ce 100644
break; break;
/* Do POSIX.2d9-style arithmetic substitution. This will probably go /* Do POSIX.2d9-style arithmetic substitution. This will probably go
--
2.9.3
@@ -1,6 +1,8 @@
--- bash-3.1/doc/Makefile.in.infotags 2006-07-12 13:57:18.000000000 +0100 diff --git a/doc/Makefile.in b/doc/Makefile.in
+++ bash-3.1/doc/Makefile.in 2006-07-12 13:58:25.000000000 +0100 index 5f0756c..a5fa5a0 100644
@@ -69,7 +69,6 @@ --- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -74,7 +74,6 @@ TEXI2DVI = ${SUPPORT_SRCDIR}/texi2dvi
TEXI2HTML = ${SUPPORT_SRCDIR}/texi2html TEXI2HTML = ${SUPPORT_SRCDIR}/texi2html
MAN2HTML = ${BUILD_DIR}/support/man2html MAN2HTML = ${BUILD_DIR}/support/man2html
HTMLPOST = ${srcdir}/htmlpost.sh HTMLPOST = ${srcdir}/htmlpost.sh
@@ -8,18 +10,9 @@
QUIETPS = #set this to -q to shut up dvips QUIETPS = #set this to -q to shut up dvips
PAPERSIZE = letter # change to a4 for A4-size paper PAPERSIZE = letter # change to a4 for A4-size paper
PSDPI = 600 # could be 300 if you like PSDPI = 600 # could be 300 if you like
@@ -146,7 +145,7 @@ @@ -188,8 +187,8 @@ bashref.pdf: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps
DVIFILES = bashref.dvi bashref.ps
-INFOFILES = bashref.info
+INFOFILES = bashref.info bash.info
MAN0FILES = bash.0 bashbug.0 builtins.0 rbash.0
HTMLFILES = bashref.html bash.html
PDFFILES = bash.pdf bashref.pdf article.pdf rose94.pdf
@@ -167,8 +166,8 @@
bashref.html: $(BASHREF_FILES) $(HSUSER) $(RLUSER) bashref.html: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi $(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
-bash.info: bashref.info -bash.info: bashref.info
- ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \ - ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
@@ -28,3 +21,6 @@
bash.txt: bash.1 bash.txt: bash.1
bash.ps: bash.1 bash.ps: bash.1
--
2.9.3
@@ -1,19 +1,20 @@
diff -up bash-4.1/builtins.h.requires bash-4.1/builtins.h diff --git a/builtins.h b/builtins.h
--- bash-4.1/builtins.h.requires 2009-01-04 20:32:23.000000000 +0100 index dac95fd..5b7e811 100644
+++ bash-4.1/builtins.h 2010-08-02 17:42:41.000000000 +0200 --- a/builtins.h
@@ -41,6 +41,8 @@ +++ b/builtins.h
#define SPECIAL_BUILTIN 0x08 /* This is a Posix `special' builtin. */ @@ -45,6 +45,7 @@
#define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */ #define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */
#define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */ #define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */
+#define REQUIRES_BUILTIN 0x40 /* This builtin requires other files. */ #define LOCALVAR_BUILTIN 0x40 /* This builtin creates local variables */
+ +#define REQUIRES_BUILTIN 0x80 /* This builtin requires other files. */
#define BASE_INDENT 4 #define BASE_INDENT 4
diff -up bash-4.1/builtins/mkbuiltins.c.requires bash-4.1/builtins/mkbuiltins.c diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
--- bash-4.1/builtins/mkbuiltins.c.requires 2009-01-04 20:32:23.000000000 +0100 index e243021..0a7a0e5 100644
+++ bash-4.1/builtins/mkbuiltins.c 2010-08-02 17:42:41.000000000 +0200 --- a/builtins/mkbuiltins.c
@@ -69,9 +69,15 @@ extern char *strcpy (); +++ b/builtins/mkbuiltins.c
@@ -69,10 +69,15 @@ extern char *strcpy ();
#define whitespace(c) (((c) == ' ') || ((c) == '\t')) #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
/* Flag values that builtins can have. */ /* Flag values that builtins can have. */
@@ -23,13 +24,13 @@ diff -up bash-4.1/builtins/mkbuiltins.c.requires bash-4.1/builtins/mkbuiltins.c
+ in ../builtins.h */ + in ../builtins.h */
#define BUILTIN_FLAG_SPECIAL 0x01 #define BUILTIN_FLAG_SPECIAL 0x01
#define BUILTIN_FLAG_ASSIGNMENT 0x02 #define BUILTIN_FLAG_ASSIGNMENT 0x02
#define BUILTIN_FLAG_POSIX_BUILTIN 0x04 #define BUILTIN_FLAG_LOCALVAR 0x04
+#define BUILTIN_FLAG_REQUIRES 0x08 #define BUILTIN_FLAG_POSIX_BUILTIN 0x08
+ +#define BUILTIN_FLAG_REQUIRES 0x10
#define BASE_INDENT 4 #define BASE_INDENT 4
@@ -163,10 +169,18 @@ char *posix_builtins[] = @@ -173,11 +178,19 @@ char *posix_builtins[] =
(char *)NULL (char *)NULL
}; };
@@ -43,36 +44,37 @@ diff -up bash-4.1/builtins/mkbuiltins.c.requires bash-4.1/builtins/mkbuiltins.c
/* Forward declarations. */ /* Forward declarations. */
static int is_special_builtin (); static int is_special_builtin ();
static int is_assignment_builtin (); static int is_assignment_builtin ();
static int is_localvar_builtin ();
static int is_posix_builtin (); static int is_posix_builtin ();
+static int is_requires_builtin (); +static int is_requires_builtin ();
#if !defined (HAVE_RENAME) #if !defined (HAVE_RENAME)
static int rename (); static int rename ();
@@ -812,6 +826,9 @@ builtin_handler (self, defs, arg) @@ -831,6 +844,8 @@ builtin_handler (self, defs, arg)
new->flags |= BUILTIN_FLAG_ASSIGNMENT; new->flags |= BUILTIN_FLAG_LOCALVAR;
if (is_posix_builtin (name)) if (is_posix_builtin (name))
new->flags |= BUILTIN_FLAG_POSIX_BUILTIN; new->flags |= BUILTIN_FLAG_POSIX_BUILTIN;
+ if (is_requires_builtin (name)) + if (is_requires_builtin (name))
+ new->flags |= BUILTIN_FLAG_REQUIRES; + new->flags |= BUILTIN_FLAG_REQUIRES;
+
array_add ((char *)new, defs->builtins); array_add ((char *)new, defs->builtins);
building_builtin = 1; building_builtin = 1;
@@ -1229,11 +1246,12 @@ write_builtins (defs, structfile, extern @@ -1250,12 +1265,13 @@ write_builtins (defs, structfile, externfile)
else else
fprintf (structfile, "(sh_builtin_func_t *)0x0, "); fprintf (structfile, "(sh_builtin_func_t *)0x0, ");
- fprintf (structfile, "%s%s%s%s, %s_doc,\n", - fprintf (structfile, "%s%s%s%s%s, %s_doc,\n",
+ fprintf (structfile, "%s%s%s%s%s, %s_doc,\n", + fprintf (structfile, "%s%s%s%s%s%s, %s_doc,\n",
"BUILTIN_ENABLED | STATIC_BUILTIN", "BUILTIN_ENABLED | STATIC_BUILTIN",
(builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "", (builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "", (builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_LOCALVAR) ? " | LOCALVAR_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_POSIX_BUILTIN) ? " | POSIX_BUILTIN" : "", (builtin->flags & BUILTIN_FLAG_POSIX_BUILTIN) ? " | POSIX_BUILTIN" : "",
+ (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "", + (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "",
document_name (builtin)); document_name (builtin));
if (inhibit_functions) /* Don't translate short document summaries that are identical
@@ -1581,6 +1599,13 @@ is_posix_builtin (name) @@ -1645,6 +1661,13 @@ is_posix_builtin (name)
return (_find_in_table (name, posix_builtins)); return (_find_in_table (name, posix_builtins));
} }
@@ -86,10 +88,11 @@ diff -up bash-4.1/builtins/mkbuiltins.c.requires bash-4.1/builtins/mkbuiltins.c
#if !defined (HAVE_RENAME) #if !defined (HAVE_RENAME)
static int static int
rename (from, to) rename (from, to)
diff -up bash-4.1/doc/bash.1.requires bash-4.1/doc/bash.1 diff --git a/doc/bash.1 b/doc/bash.1
--- bash-4.1/doc/bash.1.requires 2010-08-02 17:42:41.000000000 +0200 index 5af7d42..7539368 100644
+++ bash-4.1/doc/bash.1 2010-08-02 18:09:27.000000000 +0200 --- a/doc/bash.1
@@ -231,6 +231,14 @@ The shell becomes restricted (see +++ b/doc/bash.1
@@ -239,6 +239,14 @@ The shell becomes restricted (see
.B "RESTRICTED SHELL" .B "RESTRICTED SHELL"
below). below).
.TP .TP
@@ -102,12 +105,13 @@ diff -up bash-4.1/doc/bash.1.requires bash-4.1/doc/bash.1
+builtin are not parsed so some dependencies may be missed. +builtin are not parsed so some dependencies may be missed.
+.TP +.TP
.B \-\-verbose .B \-\-verbose
Equivalent to \fB\-v\fP. Equivalent to \fB\-v\fP.
.TP .TP
diff -up bash-4.1/doc/bashref.texi.requires bash-4.1/doc/bashref.texi diff --git a/doc/bashref.texi b/doc/bashref.texi
--- bash-4.1/doc/bashref.texi.requires 2010-08-02 17:42:41.000000000 +0200 index 9e23f58..d02151e 100644
+++ bash-4.1/doc/bashref.texi 2010-08-02 18:11:58.000000000 +0200 --- a/doc/bashref.texi
@@ -5343,6 +5343,13 @@ standard. @xref{Bash POSIX Mode}, for a +++ b/doc/bashref.texi
@@ -6554,6 +6554,13 @@ standard. @xref{Bash POSIX Mode}, for a description of the Bash
@item --restricted @item --restricted
Make the shell a restricted shell (@pxref{The Restricted Shell}). Make the shell a restricted shell (@pxref{The Restricted Shell}).
@@ -121,30 +125,25 @@ diff -up bash-4.1/doc/bashref.texi.requires bash-4.1/doc/bashref.texi
@item --verbose @item --verbose
Equivalent to @option{-v}. Print shell input lines as they're read. Equivalent to @option{-v}. Print shell input lines as they're read.
diff -up bash-4.1/eval.c.requires bash-4.1/eval.c diff --git a/eval.c b/eval.c
--- bash-4.1/eval.c.requires 2009-01-04 20:32:26.000000000 +0100 index 1d967da..f197033 100644
+++ bash-4.1/eval.c 2010-08-02 17:42:41.000000000 +0200 --- a/eval.c
@@ -53,6 +53,7 @@ extern int last_command_exit_value, stdi +++ b/eval.c
extern int need_here_doc; @@ -137,7 +137,8 @@ reader_loop ()
extern int current_command_number, current_command_line_count, line_number;
extern int expand_aliases;
+extern int rpm_requires;
#if defined (HAVE_POSIX_SIGNALS)
extern sigset_t top_level_mask;
@@ -136,7 +137,7 @@ reader_loop ()
if (read_command () == 0) if (read_command () == 0)
{ {
- if (interactive_shell == 0 && read_but_dont_execute) - if (interactive_shell == 0 && read_but_dont_execute)
+
+ if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires)) + if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires))
{ {
last_command_exit_value = EXECUTION_SUCCESS; set_exit_status (EXECUTION_SUCCESS);
dispose_command (global_command); dispose_command (global_command);
diff -up bash-4.1/execute_cmd.c.requires bash-4.1/execute_cmd.c diff --git a/execute_cmd.c b/execute_cmd.c
--- bash-4.1/execute_cmd.c.requires 2010-08-02 17:42:41.000000000 +0200 index d2555ad..397e283 100644
+++ bash-4.1/execute_cmd.c 2010-08-02 17:42:41.000000000 +0200 --- a/execute_cmd.c
@@ -503,6 +503,8 @@ async_redirect_stdin () +++ b/execute_cmd.c
@@ -543,6 +543,8 @@ async_redirect_stdin ()
#define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0) #define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0)
@@ -152,8 +151,8 @@ diff -up bash-4.1/execute_cmd.c.requires bash-4.1/execute_cmd.c
+ +
/* Execute the command passed in COMMAND, perhaps doing it asynchronously. /* Execute the command passed in COMMAND, perhaps doing it asynchronously.
COMMAND is exactly what read_command () places into GLOBAL_COMMAND. COMMAND is exactly what read_command () places into GLOBAL_COMMAND.
ASYNCHROUNOUS, if non-zero, says to do this command in the background. ASYNCHRONOUS, if non-zero, says to do this command in the background.
@@ -534,7 +536,13 @@ execute_command_internal (command, async @@ -574,7 +576,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (breaking || continuing) if (breaking || continuing)
return (last_command_exit_value); return (last_command_exit_value);
@@ -163,63 +162,48 @@ diff -up bash-4.1/execute_cmd.c.requires bash-4.1/execute_cmd.c
+ if (rpm_requires && command->type == cm_function_def) + if (rpm_requires && command->type == cm_function_def)
+ return last_command_exit_value = + return last_command_exit_value =
+ execute_intern_function (command->value.Function_def->name, + execute_intern_function (command->value.Function_def->name,
+ command->value.Function_def->command); + command->value.Function_def);
+ if (read_but_dont_execute) + if (read_but_dont_execute)
return (EXECUTION_SUCCESS); return (EXECUTION_SUCCESS);
QUIT; QUIT;
@@ -5066,7 +5074,7 @@ execute_intern_function (name, function) @@ -2836,7 +2844,7 @@ execute_for_command (for_command)
save_line_number = line_number;
if (check_identifier (name, posixly_correct) == 0) if (check_identifier (for_command->name, 1) == 0)
{ {
- if (posixly_correct && interactive_shell == 0) - if (posixly_correct && interactive_shell == 0)
+ if (posixly_correct && interactive_shell == 0 && rpm_requires == 0) + if (posixly_correct && interactive_shell == 0 && rpm_requires == 0)
{ {
last_command_exit_value = EX_BADUSAGE; last_command_exit_value = EX_BADUSAGE;
jump_to_top_level (ERREXIT); jump_to_top_level (ERREXIT);
diff -up bash-4.1/execute_cmd.h.requires bash-4.1/execute_cmd.h diff --git a/execute_cmd.h b/execute_cmd.h
--- bash-4.1/execute_cmd.h.requires 2009-01-16 22:20:15.000000000 +0100 index 465030a..9c7fd1c 100644
+++ bash-4.1/execute_cmd.h 2010-08-02 17:42:41.000000000 +0200 --- a/execute_cmd.h
@@ -22,6 +22,8 @@ +++ b/execute_cmd.h
@@ -22,6 +22,9 @@
#define _EXECUTE_CMD_H_ #define _EXECUTE_CMD_H_
#include "stdc.h" #include "stdc.h"
+#include "variables.h" +#include "variables.h"
+#include "command.h" +#include "command.h"
+
extern struct fd_bitmap *new_fd_bitmap __P((int)); #if defined (ARRAY_VARS)
extern void dispose_fd_bitmap __P((struct fd_bitmap *)); struct func_array_state
diff -up bash-4.1/make_cmd.c.requires bash-4.1/make_cmd.c diff --git a/make_cmd.c b/make_cmd.c
--- bash-4.1/make_cmd.c.requires 2009-09-11 23:26:12.000000000 +0200 index 2d7ac96..ac53526 100644
+++ bash-4.1/make_cmd.c 2010-08-02 17:42:41.000000000 +0200 --- a/make_cmd.c
@@ -42,11 +42,15 @@ +++ b/make_cmd.c
#include "flags.h" @@ -35,6 +35,8 @@
#include "make_cmd.h" #include "bashintl.h"
#include "dispose_cmd.h"
+#include "execute_cmd.h" #include "shell.h"
#include "variables.h"
#include "subst.h"
#include "input.h"
#include "ocache.h"
#include "externs.h"
+#include "builtins.h" +#include "builtins.h"
+
+#include "builtins/common.h" +#include "builtins/common.h"
#include "execute_cmd.h"
#if defined (JOB_CONTROL) #include "parser.h"
#include "jobs.h" #include "flags.h"
@@ -56,6 +60,10 @@ @@ -828,6 +830,30 @@ make_coproc_command (name, command)
extern int line_number, current_command_line_count, parser_state;
extern int last_command_exit_value;
+extern int rpm_requires;
+
+static char *alphabet_set = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/* Object caching */
sh_obj_cache_t wdcache = {0, 0, 0};
@@ -820,6 +828,27 @@ make_coproc_command (name, command)
return (make_command (cm_coproc, (SIMPLE_COM *)temp)); return (make_command (cm_coproc, (SIMPLE_COM *)temp));
} }
@@ -228,6 +212,9 @@ diff -up bash-4.1/make_cmd.c.requires bash-4.1/make_cmd.c
+const char *deptype; +const char *deptype;
+char *filename; +char *filename;
+{ +{
+ static char *alphabet_set = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ if (strchr(filename, '$') || (filename[0] != '/' && strchr(filename, '/'))) + if (strchr(filename, '$') || (filename[0] != '/' && strchr(filename, '/')))
+ return; + return;
+ +
@@ -247,7 +234,7 @@ diff -up bash-4.1/make_cmd.c.requires bash-4.1/make_cmd.c
/* Reverse the word list and redirection list in the simple command /* Reverse the word list and redirection list in the simple command
has just been parsed. It seems simpler to do this here the one has just been parsed. It seems simpler to do this here the one
time then by any other method that I can think of. */ time then by any other method that I can think of. */
@@ -837,6 +866,27 @@ clean_simple_command (command) @@ -845,6 +871,28 @@ clean_simple_command (command)
REVERSE_LIST (command->value.Simple->redirects, REDIRECT *); REVERSE_LIST (command->value.Simple->redirects, REDIRECT *);
} }
@@ -271,16 +258,18 @@ diff -up bash-4.1/make_cmd.c.requires bash-4.1/make_cmd.c
+ output_requirement (find_function(cmd0) ? "function" : "executable", cmd0); + output_requirement (find_function(cmd0) ? "function" : "executable", cmd0);
+ } + }
+ } /*rpm_requires*/ + } /*rpm_requires*/
+
+ +
parser_state &= ~PST_REDIRLIST; parser_state &= ~PST_REDIRLIST;
return (command); return (command);
} }
diff -up bash-4.1/shell.c.requires bash-4.1/shell.c diff --git a/shell.c b/shell.c
--- bash-4.1/shell.c.requires 2010-08-02 17:42:41.000000000 +0200 index ce8087f..7dcd000 100644
+++ bash-4.1/shell.c 2010-08-02 17:42:41.000000000 +0200 --- a/shell.c
@@ -193,6 +193,9 @@ int have_devfd = 0; +++ b/shell.c
@@ -194,6 +194,9 @@ int have_devfd = 0;
/* The name of the .(shell)rc file. */ /* The name of the .(shell)rc file. */
static char *bashrc_file = "~/.bashrc"; static char *bashrc_file = DEFAULT_BASHRC;
+/* Non-zero if we are finding the scripts requirements. */ +/* Non-zero if we are finding the scripts requirements. */
+int rpm_requires; +int rpm_requires;
@@ -288,7 +277,7 @@ diff -up bash-4.1/shell.c.requires bash-4.1/shell.c
/* Non-zero means to act more like the Bourne shell on startup. */ /* Non-zero means to act more like the Bourne shell on startup. */
static int act_like_sh; static int act_like_sh;
@@ -251,6 +254,7 @@ static const struct { @@ -260,6 +263,7 @@ static const struct {
{ "protected", Int, &protected_mode, (char **)0x0 }, { "protected", Int, &protected_mode, (char **)0x0 },
#endif #endif
{ "rcfile", Charp, (int *)0x0, &bashrc_file }, { "rcfile", Charp, (int *)0x0, &bashrc_file },
@@ -296,7 +285,7 @@ diff -up bash-4.1/shell.c.requires bash-4.1/shell.c
#if defined (RESTRICTED_SHELL) #if defined (RESTRICTED_SHELL)
{ "restricted", Int, &restricted, (char **)0x0 }, { "restricted", Int, &restricted, (char **)0x0 },
#endif #endif
@@ -485,6 +489,12 @@ main (argc, argv, env) @@ -502,6 +506,12 @@ main (argc, argv, env)
if (dump_translatable_strings) if (dump_translatable_strings)
read_but_dont_execute = 1; read_but_dont_execute = 1;
@@ -309,3 +298,15 @@ diff -up bash-4.1/shell.c.requires bash-4.1/shell.c
if (running_setuid && privileged_mode == 0) if (running_setuid && privileged_mode == 0)
disable_priv_mode (); disable_priv_mode ();
diff --git a/shell.h b/shell.h
index 8b41792..29b0efb 100644
--- a/shell.h
+++ b/shell.h
@@ -99,6 +99,7 @@ extern int interactive, interactive_shell;
extern int startup_state;
extern int reading_shell_script;
extern int shell_initialized;
+extern int rpm_requires;
extern int bash_argv_initialized;
extern int subshell_environment;
extern int current_command_number;
@@ -1,7 +1,8 @@
diff -up bash-4.2-rc2/tests/exec.right.tty_tests bash-4.2-rc2/tests/exec.right diff --git a/tests/exec.right b/tests/exec.right
--- bash-4.2-rc2/tests/exec.right.tty_tests 2011-02-09 10:42:48.000000000 +0100 index 0a249dd..fe8a127 100644
+++ bash-4.2-rc2/tests/exec.right 2011-02-09 10:42:59.000000000 +0100 --- a/tests/exec.right
@@ -50,7 +50,6 @@ this is ohio-state +++ b/tests/exec.right
@@ -51,7 +51,6 @@ this is ohio-state
0 0
1 1
testb testb
@@ -9,21 +10,23 @@ diff -up bash-4.2-rc2/tests/exec.right.tty_tests bash-4.2-rc2/tests/exec.right
1 1
1 1
1 1
diff -up bash-4.2-rc2/tests/execscript.tty_tests bash-4.2-rc2/tests/execscript diff --git a/tests/execscript b/tests/execscript
--- bash-4.2-rc2/tests/execscript.tty_tests 2010-12-27 22:01:02.000000000 +0100 index 2809676..1216828 100644
+++ bash-4.2-rc2/tests/execscript 2011-02-09 10:42:34.000000000 +0100 --- a/tests/execscript
@@ -107,8 +107,6 @@ ${THIS_SH} ./exec6.sub +++ b/tests/execscript
@@ -108,8 +108,6 @@ ${THIS_SH} ./exec6.sub
# checks for properly deciding what constitutes an executable file # checks for properly deciding what constitutes an executable file
${THIS_SH} ./exec7.sub ${THIS_SH} ./exec7.sub
-${THIS_SH} -i ./exec8.sub -${THIS_SH} -i ${PWD}/exec8.sub
- -
${THIS_SH} ./exec9.sub ${THIS_SH} ./exec9.sub
true | `echo true` & ${THIS_SH} ./exec10.sub
diff -up bash-4.2-rc2/tests/read.right.tty_tests bash-4.2-rc2/tests/read.right diff --git a/tests/read.right b/tests/read.right
--- bash-4.2-rc2/tests/read.right.tty_tests 2010-12-21 16:49:00.000000000 +0100 index 1144083..09cd422 100644
+++ bash-4.2-rc2/tests/read.right 2011-02-09 10:42:34.000000000 +0100 --- a/tests/read.right
+++ b/tests/read.right
@@ -33,14 +33,6 @@ a = abcdefg @@ -33,14 +33,6 @@ a = abcdefg
a = xyz a = xyz
a = -xyz 123- a = -xyz 123-
@@ -32,17 +35,18 @@ diff -up bash-4.2-rc2/tests/read.right.tty_tests bash-4.2-rc2/tests/read.right
- -
-timeout 2: ok -timeout 2: ok
- -
-./read2.sub: line 23: read: -3: invalid timeout specification -./read2.sub: line 36: read: -3: invalid timeout specification
-1 -1
- -
-abcde -abcde
./read3.sub: line 4: read: -1: invalid number ./read3.sub: line 17: read: -1: invalid number
abc abc
ab ab
diff -up bash-4.2-rc2/tests/read.tests.tty_tests bash-4.2-rc2/tests/read.tests diff --git a/tests/read.tests b/tests/read.tests
--- bash-4.2-rc2/tests/read.tests.tty_tests 2008-09-06 19:09:11.000000000 +0200 index 7384f05..43fcf8d 100644
+++ bash-4.2-rc2/tests/read.tests 2011-02-09 10:42:34.000000000 +0100 --- a/tests/read.tests
@@ -82,9 +82,6 @@ echo " foo" | { IFS=$':' ; read line; re +++ b/tests/read.tests
@@ -95,9 +95,6 @@ echo " foo" | { IFS=$':' ; read line; recho "$line"; }
# test read -d delim behavior # test read -d delim behavior
${THIS_SH} ./read1.sub ${THIS_SH} ./read1.sub
+11 -16
View File
@@ -29,33 +29,28 @@
<Patch>official/bash51-008.patch</Patch> <Patch>official/bash51-008.patch</Patch>
<!-- Fedora patches --> <!-- Fedora patches -->
<Patch level="1">fedora/bash-2.02-security.patch</Patch>
<Patch level="1">fedora/bash-2.03-paths.patch</Patch> <Patch level="1">fedora/bash-2.03-paths.patch</Patch>
<Patch level="1">fedora/bash-2.03-profile.patch</Patch> <Patch level="1">fedora/bash-2.03-profile.patch</Patch>
<!-- <Patch level="1">fedora/bash-2.05a-interpreter.patch</Patch> --> <Patch level="1">fedora/bash-2.05a-interpreter.patch</Patch>
<Patch level="1">fedora/bash-2.05b-debuginfo.patch</Patch> <Patch level="1">fedora/bash-2.05b-debuginfo.patch</Patch>
<Patch level="1">fedora/bash-2.05b-manso.patch</Patch>
<Patch level="1">fedora/bash-2.05b-pgrp_sync.patch</Patch> <Patch level="1">fedora/bash-2.05b-pgrp_sync.patch</Patch>
<!-- <Patch level="1">fedora/bash-2.05b-xcc.patch</Patch> -->
<Patch level="1">fedora/bash-3.2-audit.patch</Patch> <Patch level="1">fedora/bash-3.2-audit.patch</Patch>
<Patch level="1">fedora/bash-3.2-ssh_source_bash.patch</Patch> <Patch level="1">fedora/bash-3.2-ssh_source_bash.patch</Patch>
<!--Patch level="1">fedora/bash-bashbug.patch</Patch> <Patch level="1">fedora/bash-4.0-nobits.patch</Patch>
<Patch level="1">fedora/bash-infotags.patch</Patch>
<Patch level="1">fedora/bash-requires.patch</Patch-->
<Patch level="1">fedora/bash-setlocale.patch</Patch>
<!-- <Patch level="1">fedora/bash-tty-tests.patch</Patch> -->
<!-- <Patch level="1">fedora/bash-4.0-nobits.patch</Patch> -->
<Patch level="1">fedora/bash-4.1-examples.patch</Patch>
<Patch level="1">fedora/bash-4.1-broken_pipe.patch</Patch> <Patch level="1">fedora/bash-4.1-broken_pipe.patch</Patch>
<Patch level="1">fedora/bash-4.2-rc2-logout.patch</Patch> <Patch level="1">fedora/bash-4.1-examples.patch</Patch>
<!-- <Patch level="1">fedora/bash-4.2-coverity.patch</Patch> --> <Patch level="1">fedora/bash-4.2-coverity.patch</Patch>
<Patch level="1">fedora/bash-4.1-defer-sigchld-trap.patch</Patch>
<Patch level="1">fedora/bash-4.2-manpage_trap.patch</Patch> <Patch level="1">fedora/bash-4.2-manpage_trap.patch</Patch>
<Patch level="1">fedora/bash-4.2-rc2-logout.patch</Patch>
<Patch level="1">fedora/bash-4.2-size_type.patch</Patch> <Patch level="1">fedora/bash-4.2-size_type.patch</Patch>
<Patch level="1">fedora/bash-4.3-man-ulimit.patch</Patch> <Patch level="1">fedora/bash-4.3-man-ulimit.patch</Patch>
<!-- <Patch level="1">fedora/bash-4.3-noecho.patch</Patch> --> <Patch level="1">fedora/bash-4.3-memleak-lc_all.patch</Patch>
<!-- <Patch level="1">fedora/bash-4.3-memleak-lc_all.patch</Patch> --> <Patch level="1">fedora/bash-4.3-noecho.patch</Patch>
<Patch level="1">fedora/bash-4.4-no-loadable-builtins.patch</Patch> <Patch level="1">fedora/bash-4.4-no-loadable-builtins.patch</Patch>
<Patch level="1">fedora/bash-infotags.patch</Patch>
<Patch level="1">fedora/bash-requires.patch</Patch>
<Patch level="1">fedora/bash-setlocale.patch</Patch>
<Patch level="1">fedora/bash-tty-tests.patch</Patch>
</Patches> </Patches>
</Source> </Source>