From: Chet Ramey Date: Sat, 3 Dec 2011 17:54:47 +0000 (-0500) Subject: commit bash-20040218 snapshot X-Git-Tag: bash-3.0-beta~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb65be05d0c7d9e229a7c62bd4b3f347a34072a9;p=thirdparty%2Fbash.git commit bash-20040218 snapshot --- diff --git a/CHANGES b/CHANGES index 51f588cb6..e7797c765 100644 --- a/CHANGES +++ b/CHANGES @@ -78,6 +78,9 @@ w. Fixed a bug that caused "$@" to expand incorrectly when used as the right x. Fixed a slight cosmetic problem when printing commands containing a `>&word' redirection. +y. Fixed a problem that could cause here documents to not be created correctly + if the system temporary directory did not allow writing. + 2. Changes to Readline a. Change to history expansion functions to treat `^' as equivalent to word diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 0bc0bd261..08bdada33 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9177,3 +9177,28 @@ aclocal.m4 config.h.in - add HAVE_WCSDUP define + + 2/9 + --- +builtins/shift.def + - fix a call to sh_erange that possibly dereferences a NULL pointer + + 2/12 + ---- +general.c + - start at a general set of file property checking functions: + file_isdir(), file_iswdir() (is writable directory) + +general.h + - extern declarations for new functions + +lib/sh/tmpfile.c + - use file_iswdir() to make sure the temporary directory used for + here documents and other temp files is writable in get_sys_tmpdir() + + 2/17 + ---- +bashline.c + - fix conditional binding of emacs-mode M-~ -- there is a default + binding for it (rl_tilde_expand), so a straight call to + rl_bind_key_if_unbound_in_map doesn't do the right thing diff --git a/bashline.c b/bashline.c index 84679694e..aa390999d 100644 --- a/bashline.c +++ b/bashline.c @@ -419,7 +419,14 @@ initialize_readline () rl_bind_key_if_unbound_in_map ('/', bash_complete_filename, emacs_meta_keymap); rl_bind_key_if_unbound_in_map ('/', bash_possible_filename_completions, emacs_ctlx_keymap); - rl_bind_key_if_unbound_in_map ('~', bash_complete_username, emacs_meta_keymap); + /* Have to jump through hoops here because there is a default binding for + M-~ (rl_tilde_expand) */ + kseq[0] = '~'; + kseq[1] = '\0'; + func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); + if (func == 0 || func == rl_tilde_expand) + rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap); + rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap); rl_bind_key_if_unbound_in_map ('@', bash_complete_hostname, emacs_meta_keymap); diff --git a/builtins/shift.def b/builtins/shift.def index 9744b814b..e20b4d542 100644 --- a/builtins/shift.def +++ b/builtins/shift.def @@ -63,7 +63,7 @@ shift_builtin (list) return (EXECUTION_SUCCESS); else if (times < 0) { - sh_erange (list->word->word, _("shift count")); + sh_erange (list ? list->word->word : NULL, _("shift count")); return (EXECUTION_FAILURE); } else if (times > number_of_args ()) diff --git a/general.c b/general.c index 3754e2eb9..7b92f6a1f 100644 --- a/general.c +++ b/general.c @@ -460,6 +460,29 @@ check_binary_file (sample, sample_len) return (0); } +/* **************************************************************** */ +/* */ +/* Functions to inspect pathnames */ +/* */ +/* **************************************************************** */ + +int +file_isdir (fn) + char *fn; +{ + struct stat sb; + + return ((stat (fn, &sb) == 0) && S_ISDIR (sb.st_mode)); +} + +int +file_iswdir (fn) + char *fn; +{ + return (file_isdir (fn) && test_eaccess (fn, W_OK) == 0); +} + + /* **************************************************************** */ /* */ /* Functions to manipulate pathnames */ diff --git a/general.h b/general.h index 96e350346..78be4ecbe 100644 --- a/general.h +++ b/general.h @@ -289,6 +289,9 @@ extern int check_binary_file __P((char *, int)); extern int same_file __P((char *, char *, struct stat *, struct stat *)); #endif +extern int file_isdir __P((char *)); +extern int file_iswdir __P((char *)); + extern char *make_absolute __P((char *, char *)); extern int absolute_pathname __P((const char *)); extern int absolute_program __P((const char *)); diff --git a/lib/sh/tmpfile.c b/lib/sh/tmpfile.c index e28f94d05..fb7b732dd 100644 --- a/lib/sh/tmpfile.c +++ b/lib/sh/tmpfile.c @@ -62,20 +62,20 @@ get_sys_tmpdir () #ifdef P_tmpdir sys_tmpdir = P_tmpdir; - if (stat (sys_tmpdir, &sb) == 0) + if (file_iswdir (sys_tmpdir)) return sys_tmpdir; #endif sys_tmpdir = "/tmp"; - if (stat (sys_tmpdir, &sb) == 0) + if (file_iswdir (sys_tmpdir)) return sys_tmpdir; sys_tmpdir = "/var/tmp"; - if (stat (sys_tmpdir, &sb) == 0) + if (file_iswdir (sys_tmpdir)) return sys_tmpdir; sys_tmpdir = "/usr/tmp"; - if (stat (sys_tmpdir, &sb) == 0) + if (file_iswdir (sys_tmpdir)) return sys_tmpdir; sys_tmpdir = DEFAULT_TMPDIR;