-diff -up bash-4.1/builtins.h.requires bash-4.1/builtins.h
---- bash-4.1/builtins.h.requires 2009-01-04 20:32:23.000000000 +0100
-+++ bash-4.1/builtins.h 2010-08-02 17:42:41.000000000 +0200
-@@ -41,6 +41,8 @@
- #define SPECIAL_BUILTIN 0x08 /* This is a Posix `special' builtin. */
+commit efb0da0c0fee3e3ca21b21cd72f63cdfd7766d45
+Author: Michael Tremer <michael.tremer@ipfire.org>
+Date: Sun Sep 18 14:12:44 2016 +0100
+
+ Implement --rpm-requires
+
+ Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
+
+diff --git a/builtins.h b/builtins.h
+index 0cfea18..c0c6acc 100644
+--- a/builtins.h
++++ b/builtins.h
+@@ -42,6 +42,7 @@
#define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */
#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
-diff -up bash-4.1/builtins/mkbuiltins.c.requires bash-4.1/builtins/mkbuiltins.c
---- bash-4.1/builtins/mkbuiltins.c.requires 2009-01-04 20:32:23.000000000 +0100
-+++ bash-4.1/builtins/mkbuiltins.c 2010-08-02 17:42:41.000000000 +0200
-@@ -69,9 +69,15 @@ extern char *strcpy ();
+diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
+index 4f51201..69707ec 100644
+--- a/builtins/mkbuiltins.c
++++ b/builtins/mkbuiltins.c
+@@ -69,10 +69,15 @@ extern char *strcpy ();
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
/* Flag values that builtins can have. */
+ in ../builtins.h */
#define BUILTIN_FLAG_SPECIAL 0x01
#define BUILTIN_FLAG_ASSIGNMENT 0x02
- #define BUILTIN_FLAG_POSIX_BUILTIN 0x04
-+#define BUILTIN_FLAG_REQUIRES 0x08
-+
+ #define BUILTIN_FLAG_LOCALVAR 0x04
+ #define BUILTIN_FLAG_POSIX_BUILTIN 0x08
++#define BUILTIN_FLAG_REQUIRES 0x16
#define BASE_INDENT 4
-@@ -163,10 +169,18 @@ char *posix_builtins[] =
+@@ -173,11 +178,19 @@ char *posix_builtins[] =
(char *)NULL
};
/* Forward declarations. */
static int is_special_builtin ();
static int is_assignment_builtin ();
+ static int is_localvar_builtin ();
static int is_posix_builtin ();
+static int is_requires_builtin ();
#if !defined (HAVE_RENAME)
static int rename ();
-@@ -812,6 +826,9 @@ builtin_handler (self, defs, arg)
- new->flags |= BUILTIN_FLAG_ASSIGNMENT;
+@@ -831,6 +844,9 @@ builtin_handler (self, defs, arg)
+ new->flags |= BUILTIN_FLAG_LOCALVAR;
if (is_posix_builtin (name))
new->flags |= BUILTIN_FLAG_POSIX_BUILTIN;
+ if (is_requires_builtin (name))
array_add ((char *)new, defs->builtins);
building_builtin = 1;
-@@ -1229,11 +1246,12 @@ write_builtins (defs, structfile, extern
+@@ -1250,12 +1266,13 @@ write_builtins (defs, structfile, externfile)
else
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->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_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_REQUIRES) ? " | REQUIRES_BUILTIN" : "",
document_name (builtin));
- if (inhibit_functions)
-@@ -1581,6 +1599,13 @@ is_posix_builtin (name)
+ /* Don't translate short document summaries that are identical
+@@ -1645,6 +1662,13 @@ is_posix_builtin (name)
return (_find_in_table (name, posix_builtins));
}
#if !defined (HAVE_RENAME)
static int
rename (from, to)
-diff -up bash-4.1/doc/bash.1.requires bash-4.1/doc/bash.1
---- bash-4.1/doc/bash.1.requires 2010-08-02 17:42:41.000000000 +0200
-+++ bash-4.1/doc/bash.1 2010-08-02 18:09:27.000000000 +0200
-@@ -231,6 +231,14 @@ The shell becomes restricted (see
+diff --git a/doc/bash.1 b/doc/bash.1
+index 9a7a384..1c738bb 100644
+--- a/doc/bash.1
++++ b/doc/bash.1
+@@ -238,6 +238,14 @@ The shell becomes restricted (see
.B "RESTRICTED SHELL"
below).
.TP
+builtin are not parsed so some dependencies may be missed.
+.TP
.B \-\-verbose
- Equivalent to \fB\-v\fP.
+ Equivalent to \fB\-v\fP.
.TP
-diff -up bash-4.1/doc/bashref.texi.requires bash-4.1/doc/bashref.texi
---- bash-4.1/doc/bashref.texi.requires 2010-08-02 17:42:41.000000000 +0200
-+++ bash-4.1/doc/bashref.texi 2010-08-02 18:11:58.000000000 +0200
-@@ -5343,6 +5343,13 @@ standard. @xref{Bash POSIX Mode}, for a
+diff --git a/doc/bashref.texi b/doc/bashref.texi
+index c0f4a2f..8e30d4f 100644
+--- a/doc/bashref.texi
++++ b/doc/bashref.texi
+@@ -6243,6 +6243,13 @@ standard. @xref{Bash POSIX Mode}, for a description of the Bash
@item --restricted
Make the shell a restricted shell (@pxref{The Restricted Shell}).
@item --verbose
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
---- bash-4.1/eval.c.requires 2009-01-04 20:32:26.000000000 +0100
-+++ bash-4.1/eval.c 2010-08-02 17:42:41.000000000 +0200
-@@ -53,6 +53,7 @@ extern int last_command_exit_value, stdi
- extern int need_here_doc;
+diff --git a/eval.c b/eval.c
+index db863e7..5a5af32 100644
+--- a/eval.c
++++ b/eval.c
+@@ -56,6 +56,7 @@ extern int need_here_doc;
extern int current_command_number, current_command_line_count, line_number;
extern int expand_aliases;
+ extern char *ps0_prompt;
+extern int rpm_requires;
#if defined (HAVE_POSIX_SIGNALS)
extern sigset_t top_level_mask;
-@@ -136,7 +137,7 @@ reader_loop ()
+@@ -148,7 +149,7 @@ reader_loop ()
if (read_command () == 0)
{
{
last_command_exit_value = EXECUTION_SUCCESS;
dispose_command (global_command);
-diff -up bash-4.1/execute_cmd.c.requires bash-4.1/execute_cmd.c
---- bash-4.1/execute_cmd.c.requires 2010-08-02 17:42:41.000000000 +0200
-+++ bash-4.1/execute_cmd.c 2010-08-02 17:42:41.000000000 +0200
-@@ -503,6 +503,8 @@ async_redirect_stdin ()
+diff --git a/execute_cmd.c b/execute_cmd.c
+index 2a3df6d..2e3fb0c 100644
+--- a/execute_cmd.c
++++ b/execute_cmd.c
+@@ -529,6 +529,8 @@ async_redirect_stdin ()
#define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0)
/* Execute the command passed in COMMAND, perhaps doing it asynchronously.
COMMAND is exactly what read_command () places into GLOBAL_COMMAND.
ASYNCHROUNOUS, if non-zero, says to do this command in the background.
-@@ -534,7 +536,13 @@ execute_command_internal (command, async
+@@ -561,7 +563,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (breaking || continuing)
return (last_command_exit_value);
return (EXECUTION_SUCCESS);
QUIT;
-@@ -5066,7 +5074,7 @@ execute_intern_function (name, function)
+@@ -5609,7 +5617,7 @@ execute_intern_function (name, funcdef)
if (check_identifier (name, posixly_correct) == 0)
{
{
last_command_exit_value = EX_BADUSAGE;
jump_to_top_level (ERREXIT);
-diff -up bash-4.1/execute_cmd.h.requires bash-4.1/execute_cmd.h
---- bash-4.1/execute_cmd.h.requires 2009-01-16 22:20:15.000000000 +0100
-+++ bash-4.1/execute_cmd.h 2010-08-02 17:42:41.000000000 +0200
+diff --git a/execute_cmd.h b/execute_cmd.h
+index 62bec82..d42dc85 100644
+--- a/execute_cmd.h
++++ b/execute_cmd.h
@@ -22,6 +22,8 @@
#define _EXECUTE_CMD_H_
+#include "variables.h"
+#include "command.h"
- extern struct fd_bitmap *new_fd_bitmap __P((int));
- extern void dispose_fd_bitmap __P((struct fd_bitmap *));
-diff -up bash-4.1/make_cmd.c.requires bash-4.1/make_cmd.c
---- bash-4.1/make_cmd.c.requires 2009-09-11 23:26:12.000000000 +0200
-+++ bash-4.1/make_cmd.c 2010-08-02 17:42:41.000000000 +0200
+ #if defined (ARRAY_VARS)
+ struct func_array_state
+diff --git a/make_cmd.c b/make_cmd.c
+index b42e9ff..95ec723 100644
+--- a/make_cmd.c
++++ b/make_cmd.c
@@ -42,11 +42,15 @@
#include "flags.h"
#include "make_cmd.h"
#if defined (JOB_CONTROL)
#include "jobs.h"
-@@ -56,6 +60,10 @@
-
+@@ -57,9 +61,13 @@
extern int line_number, current_command_line_count, parser_state;
extern int last_command_exit_value;
+ extern int shell_initialized;
+extern int rpm_requires;
-+
+
+ int here_doc_first_line = 0;
+
+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)
+ sh_obj_cache_t wlcache = {0, 0, 0};
+@@ -839,6 +847,27 @@ make_coproc_command (name, command)
return (make_command (cm_coproc, (SIMPLE_COM *)temp));
}
/* Reverse the word list and redirection list in the simple command
has just been parsed. It seems simpler to do this here the one
time then by any other method that I can think of. */
-@@ -837,6 +866,27 @@ clean_simple_command (command)
+@@ -856,6 +885,27 @@ clean_simple_command (command)
REVERSE_LIST (command->value.Simple->redirects, REDIRECT *);
}
parser_state &= ~PST_REDIRLIST;
return (command);
}
-diff -up bash-4.1/shell.c.requires bash-4.1/shell.c
---- bash-4.1/shell.c.requires 2010-08-02 17:42:41.000000000 +0200
-+++ bash-4.1/shell.c 2010-08-02 17:42:41.000000000 +0200
-@@ -193,6 +193,9 @@ int have_devfd = 0;
+diff --git a/shell.c b/shell.c
+index 45b77f9..b43de50 100644
+--- a/shell.c
++++ b/shell.c
+@@ -201,6 +201,9 @@ int have_devfd = 0;
/* 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. */
+int rpm_requires;
/* Non-zero means to act more like the Bourne shell on startup. */
static int act_like_sh;
-@@ -251,6 +254,7 @@ static const struct {
+@@ -264,6 +267,7 @@ static const struct {
{ "protected", Int, &protected_mode, (char **)0x0 },
#endif
{ "rcfile", Charp, (int *)0x0, &bashrc_file },
#if defined (RESTRICTED_SHELL)
{ "restricted", Int, &restricted, (char **)0x0 },
#endif
-@@ -485,6 +489,12 @@ main (argc, argv, env)
+@@ -500,6 +504,12 @@ main (argc, argv, env)
if (dump_translatable_strings)
read_but_dont_execute = 1;