*** ../bash-3.2-patched/execute_cmd.c 2007-12-14 21:12:39.000000000 -0500 --- execute_cmd.c 2008-02-22 21:20:40.000000000 -0500 *************** *** 2547,2551 **** if (arg1 == 0) arg1 = nullstr; ! arg2 = cond_expand_word (cond->right->op, rmatch ? 2 : (patmatch ? 1 : 0)); if (arg2 == 0) arg2 = nullstr; --- 2552,2557 ---- if (arg1 == 0) arg1 = nullstr; ! arg2 = cond_expand_word (cond->right->op, ! (rmatch && shell_compatibility_level > 31) ? 2 : (patmatch ? 1 : 0)); if (arg2 == 0) arg2 = nullstr; *** ../bash-3.2-patched/shell.h 2003-06-01 15:04:36.000000000 -0400 --- shell.h 2008-02-22 21:16:48.000000000 -0500 *************** *** 90,93 **** --- 90,94 ---- extern int interactive, interactive_shell; extern int startup_state; + extern int shell_compatibility_level; /* Structure to pass around that holds a bitmap of file descriptors *** ../bash-3.2-patched/version.c 2007-12-14 21:12:29.000000000 -0500 --- version.c 2008-04-10 08:22:22.000000000 -0400 *************** *** 44,47 **** --- 44,50 ---- const char *sccs_version = SCCSVERSION; + /* If == 31, shell compatible with bash-3.1, = =32 with bash-3.2, and so on */ + int shell_compatibility_level = 32; + /* Functions for getting, setting, and displaying the shell version. */ *** ../bash-3.2-patched/builtins/shopt.def 2005-02-19 17:25:03.000000000 -0500 --- builtins/shopt.def 2008-04-10 08:13:32.000000000 -0400 *************** *** 102,105 **** --- 102,107 ---- static int set_shellopts_after_change __P((int)); + static int set_compatibility_level __P((int)); + #if defined (RESTRICTED_SHELL) static int set_restricted_shell __P((int)); *************** *** 107,110 **** --- 109,113 ---- static int shopt_login_shell; + static int shopt_compat31; typedef int shopt_set_func_t __P((int)); *************** *** 122,125 **** --- 125,129 ---- { "cmdhist", &command_oriented_history, (shopt_set_func_t *)NULL }, #endif + { "compat31", &shopt_compat31, set_compatibility_level }, { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL }, { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL }, *************** *** 460,463 **** --- 464,479 ---- } + static int + set_compatibility_level (mode) + int mode; + { + /* Need to change logic here as we add more compatibility levels */ + if (shopt_compat31) + shell_compatibility_level = 31; + else + shell_compatibility_level = 32; + return 0; + } + #if defined (RESTRICTED_SHELL) /* Don't allow the value of restricted_shell to be modified. */