]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20040218 snapshot
authorChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 17:54:47 +0000 (12:54 -0500)
committerChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 17:54:47 +0000 (12:54 -0500)
CHANGES
CWRU/CWRU.chlog
bashline.c
builtins/shift.def
general.c
general.h
lib/sh/tmpfile.c

diff --git a/CHANGES b/CHANGES
index 51f588cb6efda37cc865ec7a963990ae33067733..e7797c765695451ddf6a6403f53d698208ba2732 100644 (file)
--- 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
index 0bc0bd261c52ac53f3db88ba02345d6e539f2443..08bdada33693e658c6e45193de1d5b9bd79592fe 100644 (file)
@@ -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
index 84679694ebf326d9db47bb0253596f7fe782af0d..aa390999d2d7e8e116d66556cad65115bd4b1e67 100644 (file)
@@ -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);
index 9744b814bcacb76a583b0288aafe9b2da58b91be..e20b4d54202e7eee4ab6ed4e1d7f171a4235520a 100644 (file)
@@ -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 ())
index 3754e2eb9b123396d7eab0f6fe3389e460431e45..7b92f6a1fc4bb80b5b5f6266af4edbd512672cd9 100644 (file)
--- 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               */
index 96e3503461c6bc339b2354c88f461c1728b6edcb..78be4ecbe02afde4e01dbadf8b95f4b64ce99c1e 100644 (file)
--- 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 *));
index e28f94d052d0561676d393878c2faf13a180243d..fb7b732dd682453f3303e1b7467ce3e27b9c5efb 100644 (file)
@@ -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;