tizen 2.3.1 release tizen_2.3.1 submit/tizen_2.3.1/20150915.073334 tizen_2.3.1_release
authorjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 12:42:19 +0000 (21:42 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 12:42:19 +0000 (21:42 +0900)
builtins/common.h
builtins/evalstring.c
packaging/bash.manifest [new file with mode: 0644]
packaging/bash.spec [changed mode: 0644->0755]
variables.c

index efbb078..aef24dc 100644 (file)
@@ -35,6 +35,8 @@
 #define SEVAL_NOLONGJMP 0x040
 
 /* Flags for describe_command, shared between type.def and command.def */
+#define SEVAL_FUNCDEF  0x080   /* only allow function definitions */
+#define SEVAL_ONECMD   0x100   /* only allow a single command */
 #define CDESC_ALL              0x001   /* type -a */
 #define CDESC_SHORTDESC                0x002   /* command -V */
 #define CDESC_REUSABLE         0x004   /* command -v */
index 40abe00..40bd44e 100644 (file)
@@ -261,6 +261,14 @@ parse_and_execute (string, from_file, flags)
            {
              struct fd_bitmap *bitmap;
 
+             if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def)
+               {
+                 internal_warning ("%s: ignoring function definition attempt", from_file);
+                 should_jump_to_top_level = 0;
+                 last_result = last_command_exit_value = EX_BADUSAGE;
+                 break;
+               }
+
              bitmap = new_fd_bitmap (FD_BITMAP_SIZE);
              begin_unwind_frame ("pe_dispose");
              add_unwind_protect (dispose_fd_bitmap, bitmap);
@@ -321,6 +329,9 @@ parse_and_execute (string, from_file, flags)
              dispose_command (command);
              dispose_fd_bitmap (bitmap);
              discard_unwind_frame ("pe_dispose");
+
+             if (flags & SEVAL_ONECMD)
+           break;
            }
        }
       else
diff --git a/packaging/bash.manifest b/packaging/bash.manifest
new file mode 100644 (file)
index 0000000..c922afb
--- /dev/null
@@ -0,0 +1,8 @@
+<manifest>
+        <request>
+                <domain name="_"/>
+        </request>
+        <assign>
+                <filesystem path="/bin/*" exec_label="none" />
+        </assign>
+</manifest>
old mode 100644 (file)
new mode 100755 (executable)
index 58c5d14..ae23a23
@@ -1,11 +1,12 @@
 Version: 4.1
 Name: bash
 Summary: The GNU Bourne Again shell
-Release: 1
+Release: 3
 Group: System/Shells
-License: GPLv2+
+License: GPL-3.0+
 Url: http://www.gnu.org/software/bash
 Source0: ftp://ftp.gnu.org/gnu/bash/%{name}-%{version}.tar.gz
+Source1001:    %{name}.manifest
 
 # SLP patches
 Patch0: bash41-001.patch
@@ -59,15 +60,14 @@ This package contains documentation files for %{name}.
 %patch12 -p1 -b .builtins-declare-fix
 
 %build
+cp %{SOURCE1001} .
 autoconf
 %configure --enable-largefile --without-bash-malloc --disable-nls
 
 # Recycles pids is neccessary. When bash's last fork's pid was X
 # and new fork's pid is also X, bash has to wait for this same pid.
 # Without Recycles pids bash will not wait.
-make "CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS `getconf LFS_CFLAGS`"
-%check
-make check
+make %{?_smp_mflags} "CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS `getconf LFS_CFLAGS`"
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -147,6 +147,16 @@ done
 rm -rf %{buildroot}%{_bindir}/bashbug-*
 chmod a-x doc/*.sh
 
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/license
+for keyword in LICENSE COPYING COPYRIGHT;
+do
+       for file in `find %{_builddir} -name $keyword`;
+       do
+               cat $file >> $RPM_BUILD_ROOT%{_datadir}/license/%{name};
+               echo "";
+       done;
+done
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -159,7 +169,7 @@ rm -rf $RPM_BUILD_ROOT
 %post -p <lua>
 bashfound = false;
 shfound = false;
+
 f = io.open("/etc/shells", "r");
 if f == nil
 then
@@ -178,7 +188,7 @@ else
   until t == nil;
 end
 f:close()
+
 f = io.open("/etc/shells", "a");
 if not bashfound
 then
@@ -200,7 +210,8 @@ fi
 
 %docs_package
 
-%files 
+%files
+%manifest %{name}.manifest
+%{_datadir}/license/%{name}
 /bin/sh
 /bin/bash
-
index d1da8f6..e5106e0 100644 (file)
@@ -347,12 +347,10 @@ initialize_shell_variables (env, privmode)
          temp_string[char_index] = ' ';
          strcpy (temp_string + char_index + 1, string);
 
-         parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST);
-
-         /* Ancient backwards compatibility.  Old versions of bash exported
-            functions like name()=() {...} */
-         if (name[char_index - 1] == ')' && name[char_index - 2] == '(')
-           name[char_index - 2] = '\0';
+         /* Don't import function names that are invalid identifiers from the
+            environment. */
+         if (legal_identifier (name))
+           parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD);
 
          if (temp_var = find_function (name))
            {
@@ -361,10 +359,6 @@ initialize_shell_variables (env, privmode)
            }
          else
            report_error (_("error importing function definition for `%s'"), name);
-
-         /* ( */
-         if (name[char_index - 1] == ')' && name[char_index - 2] == '\0')
-           name[char_index - 2] = '(';         /* ) */
        }
 #if defined (ARRAY_VARS)
 #  if 0