chiark / gitweb /
Disable all exported shell functions
[bash.git] / debian / patches / 0001-Disable-all-exported-shell-functions.dpatch
1 #! /bin/sh -e
2
3 if [ $# -eq 3 -a "$2" = '-d' ]; then
4     pdir="-d $3"
5 elif [ $# -ne 1 ]; then
6     echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
7     exit 1
8 fi
9 case "$1" in
10     -patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;;
11     -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;;
12     *)
13         echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
14         exit 1
15 esac
16 exit 0
17
18 # DP: [PATCH] Disable all exported shell functions.
19
20 diff --git a/variables.c b/variables.c
21 index 92a5a10..fe0832e 100644
22 --- a/variables.c
23 +++ b/variables.c
24 @@ -347,6 +347,7 @@ initialize_shell_variables (env, privmode)
25  
26        temp_var = (SHELL_VAR *)NULL;
27  
28 +#if 0 /* Disable exporting shell functions because they are mad. */
29        /* If exported function, define it now.  Don't import functions from
30          the environment in privileged mode. */
31        if (privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4))
32 @@ -380,6 +381,9 @@ initialize_shell_variables (env, privmode)
33               report_error (_("error importing function definition for `%s'"), name);
34             }
35         }
36 +#else
37 +      if (0) ; /* needed for syntax */
38 +#endif
39  #if defined (ARRAY_VARS)
40  #  if ARRAY_EXPORT
41        /* Array variables may not yet be exported. */
42 -- 
43 1.7.10.4
44