]> git.pld-linux.org Git - packages/bash.git/blobdiff - bash-requires.patch
Up to 5.2.26
[packages/bash.git] / bash-requires.patch
index 35670bd55cf43dbfd324894c2fa472e7912f9558..674e5b9483b861fbbe654f30dbf3b06dc23e4deb 100644 (file)
@@ -1,20 +1,18 @@
 diff --git a/builtins.h b/builtins.h
-index dac95fd..5b7e811 100644
 --- a/builtins.h
 +++ b/builtins.h
-@@ -45,6 +45,7 @@
- #define ASSIGNMENT_BUILTIN 0x10       /* This builtin takes assignment statements. */
+@@ -46,6 +46,7 @@
  #define POSIX_BUILTIN 0x20    /* This builtins is special in the Posix command search order. */
  #define LOCALVAR_BUILTIN   0x40       /* This builtin creates local variables */
-+#define REQUIRES_BUILTIN 0x80  /* This builtin requires other files. */
+ #define ARRAYREF_BUILTIN 0x80 /* This builtin takes array references as arguments */
++#define REQUIRES_BUILTIN 0x100  /* This builtin requires other files. */
  
  #define BASE_INDENT   4
  
 diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
-index 4f51201..91c25db 100644
 --- a/builtins/mkbuiltins.c
 +++ b/builtins/mkbuiltins.c
-@@ -69,10 +69,15 @@ extern char *strcpy ();
+@@ -69,11 +69,16 @@ extern char *strcpy ();
  #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
  
  /* Flag values that builtins can have. */
@@ -25,15 +23,18 @@ index 4f51201..91c25db 100644
  #define BUILTIN_FLAG_SPECIAL  0x01
  #define BUILTIN_FLAG_ASSIGNMENT 0x02
  #define BUILTIN_FLAG_LOCALVAR 0x04
- #define BUILTIN_FLAG_POSIX_BUILTIN 0x08
-+#define BUILTIN_FLAG_REQUIRES  0x10
+ #define BUILTIN_FLAG_POSIX_BUILTIN    0x08
+ #define BUILTIN_FLAG_ARRAYREF_ARG     0x10
++#define BUILTIN_FLAG_REQUIRES  0x20
  
  #define BASE_INDENT   4
  
-@@ -173,11 +178,19 @@ char *posix_builtins[] =
+@@ -189,13 +194,21 @@ char *arrayvar_builtins[] =
+   "typeset", "unset", "wait",         /*]*/
    (char *)NULL
  };
+-      
++
 +/* The builtin commands that cause requirements on other files. */
 +static char *requires_builtins[] =
 +{
@@ -46,36 +47,38 @@ index 4f51201..91c25db 100644
  static int is_assignment_builtin ();
  static int is_localvar_builtin ();
  static int is_posix_builtin ();
+ static int is_arrayvar_builtin ();
 +static int is_requires_builtin ();
  
  #if !defined (HAVE_RENAME)
  static int rename ();
-@@ -831,6 +844,8 @@ builtin_handler (self, defs, arg)
-     new->flags |= BUILTIN_FLAG_LOCALVAR;
-   if (is_posix_builtin (name))
+@@ -856,6 +869,8 @@ builtin_handler (self, defs, arg)
      new->flags |= BUILTIN_FLAG_POSIX_BUILTIN;
+   if (is_arrayvar_builtin (name))
+     new->flags |= BUILTIN_FLAG_ARRAYREF_ARG;
 +  if (is_requires_builtin (name))
 +    new->flags |= BUILTIN_FLAG_REQUIRES;
  
    array_add ((char *)new, defs->builtins);
    building_builtin = 1;
-@@ -1250,12 +1265,13 @@ write_builtins (defs, structfile, externfile)
+@@ -1275,13 +1290,14 @@ write_builtins (defs, structfile, externfile)
                  else
                    fprintf (structfile, "(sh_builtin_func_t *)0x0, ");
  
--                fprintf (structfile, "%s%s%s%s%s, %s_doc,\n",
-+                fprintf (structfile, "%s%s%s%s%s%s, %s_doc,\n",
+-                fprintf (structfile, "%s%s%s%s%s%s, %s_doc,\n",
++                fprintf (structfile, "%s%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_ARRAYREF_ARG) ? " | ARRAYREF_BUILTIN" : "",
 +                  (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "",
                    document_name (builtin));
  
                  /* Don't translate short document summaries that are identical
-@@ -1645,6 +1661,13 @@ is_posix_builtin (name)
-   return (_find_in_table (name, posix_builtins));
+@@ -1678,6 +1694,13 @@ is_arrayvar_builtin (name)
+   return (_find_in_table (name, arrayvar_builtins));
  }
  
 +static int
@@ -89,7 +92,6 @@ index 4f51201..91c25db 100644
  static int
  rename (from, to)
 diff --git a/doc/bash.1 b/doc/bash.1
-index d91f1fd..111a66d 100644
 --- a/doc/bash.1
 +++ b/doc/bash.1
 @@ -239,6 +239,14 @@ The shell becomes restricted (see
@@ -108,10 +110,9 @@ index d91f1fd..111a66d 100644
  Equivalent to \fB\-v\fP.
  .TP
 diff --git a/doc/bashref.texi b/doc/bashref.texi
-index d33cd57..6fc4d18 100644
 --- a/doc/bashref.texi
 +++ b/doc/bashref.texi
-@@ -6453,6 +6453,13 @@ standard.  @xref{Bash POSIX Mode}, for a description of the Bash
+@@ -6927,6 +6927,13 @@ standard.  @xref{Bash POSIX Mode}, for a description of the Bash
  @item --restricted
  Make the shell a restricted shell (@pxref{The Restricted Shell}).
  
@@ -126,10 +127,9 @@ index d33cd57..6fc4d18 100644
  Equivalent to @option{-v}.  Print shell input lines as they're read.
  
 diff --git a/eval.c b/eval.c
-index f02d6e4..76c1e8d 100644
 --- a/eval.c
 +++ b/eval.c
-@@ -142,7 +142,8 @@ reader_loop ()
+@@ -138,7 +138,8 @@ reader_loop ()
  
        if (read_command () == 0)
        {
@@ -137,13 +137,12 @@ index f02d6e4..76c1e8d 100644
 +
 +        if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires))
            {
-             last_command_exit_value = EXECUTION_SUCCESS;
+             set_exit_status (last_command_exit_value);
              dispose_command (global_command);
 diff --git a/execute_cmd.c b/execute_cmd.c
-index 8b3c83a..4eae19c 100644
 --- a/execute_cmd.c
 +++ b/execute_cmd.c
-@@ -538,6 +538,8 @@ async_redirect_stdin ()
+@@ -561,6 +561,8 @@ async_redirect_stdin ()
  
  #define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0)
  
@@ -151,23 +150,23 @@ index 8b3c83a..4eae19c 100644
 +
  /* 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.
-@@ -569,7 +571,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
+    ASYNCHRONOUS, if non-zero, says to do this command in the background.
+@@ -592,7 +594,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
  
    if (breaking || continuing)
      return (last_command_exit_value);
--  if (command == 0 || read_but_dont_execute)
+-  if (read_but_dont_execute)
 +  if (command == 0 || (read_but_dont_execute && !rpm_requires))
 +    return (EXECUTION_SUCCESS);
 +  if (rpm_requires && command->type == cm_function_def)
 +    return last_command_exit_value =
 +      execute_intern_function (command->value.Function_def->name,
 +                              command->value.Function_def);
-+  if (read_but_dont_execute)
++ if (read_but_dont_execute)
+     return (last_command_exit_value);
+   if (command == 0)
      return (EXECUTION_SUCCESS);
-   QUIT;
-@@ -2813,7 +2821,7 @@ execute_for_command (for_command)
+@@ -2883,7 +2891,7 @@ execute_for_command (for_command)
    save_line_number = line_number;
    if (check_identifier (for_command->name, 1) == 0)
      {
@@ -177,7 +176,6 @@ index 8b3c83a..4eae19c 100644
          last_command_exit_value = EX_BADUSAGE;
          jump_to_top_level (ERREXIT);
 diff --git a/execute_cmd.h b/execute_cmd.h
-index dc2f15e..506fff4 100644
 --- a/execute_cmd.h
 +++ b/execute_cmd.h
 @@ -22,6 +22,9 @@
@@ -191,10 +189,18 @@ index dc2f15e..506fff4 100644
  #if defined (ARRAY_VARS)
  struct func_array_state
 diff --git a/make_cmd.c b/make_cmd.c
-index ecbbfd6..3d8bfa4 100644
 --- a/make_cmd.c
 +++ b/make_cmd.c
-@@ -828,6 +828,27 @@ make_coproc_command (name, command)
+@@ -35,6 +35,8 @@
+ #include "bashintl.h"
+ #include "shell.h"
++#include "builtins.h"
++#include "builtins/common.h"
+ #include "execute_cmd.h"
+ #include "parser.h"
+ #include "flags.h"
+@@ -839,6 +841,30 @@ make_coproc_command (name, command)
    return (make_command (cm_coproc, (SIMPLE_COM *)temp));
  }
  
@@ -203,6 +209,9 @@ index ecbbfd6..3d8bfa4 100644
 +const char *deptype;
 +char *filename;
 +{
++  static char *alphabet_set = "abcdefghijklmnopqrstuvwxyz"
++                    "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
++
 +  if (strchr(filename, '$') || (filename[0] != '/' && strchr(filename, '/')))
 +    return;
 +
@@ -222,7 +231,7 @@ index ecbbfd6..3d8bfa4 100644
  /* 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. */
-@@ -845,6 +866,28 @@ clean_simple_command (command)
+@@ -856,6 +882,28 @@ clean_simple_command (command)
        REVERSE_LIST (command->value.Simple->redirects, REDIRECT *);
      }
  
@@ -252,10 +261,9 @@ index ecbbfd6..3d8bfa4 100644
    return (command);
  }
 diff --git a/shell.c b/shell.c
-index a2b2a55..c5d99b3 100644
 --- a/shell.c
 +++ b/shell.c
-@@ -193,6 +193,9 @@ int have_devfd = 0;
+@@ -196,6 +196,9 @@ int have_devfd = 0;
  /* The name of the .(shell)rc file. */
  static char *bashrc_file = DEFAULT_BASHRC;
  
@@ -265,7 +273,7 @@ index a2b2a55..c5d99b3 100644
  /* Non-zero means to act more like the Bourne shell on startup. */
  static int act_like_sh;
  
-@@ -259,6 +262,7 @@ static const struct {
+@@ -266,6 +269,7 @@ static const struct {
    { "protected", Int, &protected_mode, (char **)0x0 },
  #endif
    { "rcfile", Charp, (int *)0x0, &bashrc_file },
@@ -273,9 +281,9 @@ index a2b2a55..c5d99b3 100644
  #if defined (RESTRICTED_SHELL)
    { "restricted", Int, &restricted, (char **)0x0 },
  #endif
-@@ -496,6 +500,12 @@ main (argc, argv, env)
-   if (dump_translatable_strings)
+@@ -510,6 +514,12 @@ main (argc, argv, env)
      read_but_dont_execute = 1;
+ #endif
  
 +  if (rpm_requires)
 +    {
@@ -287,35 +295,13 @@ index a2b2a55..c5d99b3 100644
      disable_priv_mode ();
  
 diff --git a/shell.h b/shell.h
-index 8072605..6c4149d 100644
 --- a/shell.h
 +++ b/shell.h
-@@ -34,12 +34,15 @@
- #include "maxpath.h"
- #include "unwind_prot.h"
- #include "dispose_cmd.h"
-+#include "execute_cmd.h"
- #include "make_cmd.h"
- #include "ocache.h"
- #include "subst.h"
- #include "sig.h"
- #include "pathnames.h"
- #include "externs.h"
-+#include "builtins.h"
-+#include "builtins/common.h"
- extern int EOF_Reached;
-@@ -99,6 +102,9 @@ extern int interactive, interactive_shell;
+@@ -100,6 +100,7 @@ extern int interactive, interactive_shell;
  extern int startup_state;
  extern int reading_shell_script;
  extern int shell_initialized;
 +extern int rpm_requires;
-+static char *alphabet_set = "abcdefghijklmnopqrstuvwxyz"
-+                     "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  extern int bash_argv_initialized;
  extern int subshell_environment;
  extern int current_command_number;
--- 
-2.17.2
-
This page took 0.109858 seconds and 4 git commands to generate.