pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/shells/bash Disable function import by default, enable...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3e520d8df69d
branches:  trunk
changeset: 639817:3e520d8df69d
user:      christos <christos%pkgsrc.org@localhost>
date:      Thu Sep 25 20:28:32 2014 +0000

description:
Disable function import by default, enabled only with -import-functions.

diffstat:

 shells/bash/Makefile                  |   3 ++-
 shells/bash/distinfo                  |   4 +++-
 shells/bash/patches/patch-shell.c     |  22 ++++++++++++++++++++++
 shells/bash/patches/patch-variables.c |  23 +++++++++++++++++++++++
 4 files changed, 50 insertions(+), 2 deletions(-)

diffs (81 lines):

diff -r 77ebfb179dd1 -r 3e520d8df69d shells/bash/Makefile
--- a/shells/bash/Makefile      Thu Sep 25 20:13:09 2014 +0000
+++ b/shells/bash/Makefile      Thu Sep 25 20:28:32 2014 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.65 2014/09/25 14:02:34 tron Exp $
+# $NetBSD: Makefile,v 1.66 2014/09/25 20:28:32 christos Exp $
 
 BASH_VERSION=          4.3
 BASH_PATCHLEVEL=       025
+PKGREVISION=1
 
 DISTNAME=      bash-${BASH_VERSION}
 PKGNAME=       bash-${BASH_VERSION}.${BASH_PATCHLEVEL}
diff -r 77ebfb179dd1 -r 3e520d8df69d shells/bash/distinfo
--- a/shells/bash/distinfo      Thu Sep 25 20:13:09 2014 +0000
+++ b/shells/bash/distinfo      Thu Sep 25 20:28:32 2014 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.32 2014/09/25 14:02:34 tron Exp $
+$NetBSD: distinfo,v 1.33 2014/09/25 20:28:32 christos Exp $
 
 SHA1 (bash-4.3.tar.gz) = 45ac3c5727e7262334f4dfadecdf601b39434e84
 RMD160 (bash-4.3.tar.gz) = cd21a9f51ea7780994d4e2c9c7d16d5eb000f845
@@ -84,3 +84,5 @@
 SHA1 (patch-builtins_ulimit.def) = d4cb59bedc6a6199f9a99a3530c99374e428baeb
 SHA1 (patch-lib_readline_colors.c) = f2f47e7aa0b5c1e999368109de10f80e39fd4438
 SHA1 (patch-parse.y) = 41c747ef8095b43c6b077a3fab54105d338f156e
+SHA1 (patch-shell.c) = 08e55c3fa57a9e8eb6366c4eba91aa70f487acb2
+SHA1 (patch-variables.c) = 9fa0c4fc7650581b23d4fa768a0c76757a8874aa
diff -r 77ebfb179dd1 -r 3e520d8df69d shells/bash/patches/patch-shell.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/shells/bash/patches/patch-shell.c Thu Sep 25 20:28:32 2014 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-shell.c,v 1.1 2014/09/25 20:28:32 christos Exp $
+
+Add flag to disable importing of function unless explicitly enabled
+
+--- shell.c.christos   2014-01-14 08:04:32.000000000 -0500
++++ shell.c    2014-09-25 16:11:51.000000000 -0400
+@@ -229,6 +229,7 @@
+ #else
+ int posixly_correct = 0;      /* Non-zero means posix.2 superset. */
+ #endif
++int import_functions = 0;     /* Import functions from environment */
+ 
+ /* Some long-winded argument names.  These are obviously new. */
+ #define Int 1
+@@ -248,6 +249,7 @@
+   { "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 },
diff -r 77ebfb179dd1 -r 3e520d8df69d shells/bash/patches/patch-variables.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/shells/bash/patches/patch-variables.c     Thu Sep 25 20:28:32 2014 +0000
@@ -0,0 +1,23 @@
+$NetBSD: patch-variables.c,v 1.1 2014/09/25 20:28:32 christos Exp $
+
+Only read functions from environment if flag is set.
+
+--- variables.c.christos       2014-09-25 16:09:41.000000000 -0400
++++ variables.c        2014-09-25 16:12:10.000000000 -0400
+@@ -105,6 +105,7 @@
+ 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;
+@@ -349,7 +350,7 @@
+ 
+       /* If exported function, define it now.  Don't import functions from
+        the environment in privileged mode. */
+-      if (privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4))
++      if (import_functions && privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4))
+       {
+         string_length = strlen (string);
+         temp_string = (char *)xmalloc (3 + string_length + char_index);



Home | Main Index | Thread Index | Old Index