You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.9 KiB

  1. Index: bash-4.4/bashline.c
  2. ===================================================================
  3. --- bash-4.4.orig/bashline.c
  4. +++ bash-4.4/bashline.c
  5. @@ -142,7 +142,7 @@ static int executable_completion __P((co
  6. static rl_icppfunc_t *save_directory_hook __P((void));
  7. static void restore_directory_hook __P((rl_icppfunc_t));
  8. -static int directory_exists __P((const char *));
  9. +static int directory_exists __P((const char *, int));
  10. static void cleanup_expansion_error __P((void));
  11. static void maybe_make_readline_line __P((char *));
  12. @@ -3102,18 +3102,20 @@ restore_directory_hook (hookf)
  13. rl_directory_rewrite_hook = hookf;
  14. }
  15. -/* Check whether not the (dequoted) version of DIRNAME, with any trailing slash
  16. - removed, exists. */
  17. +/* Check whether not DIRNAME, with any trailing slash removed, exists. If
  18. + SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */
  19. static int
  20. -directory_exists (dirname)
  21. +directory_exists (dirname, should_dequote)
  22. const char *dirname;
  23. + int should_dequote;
  24. {
  25. char *new_dirname;
  26. int dirlen, r;
  27. struct stat sb;
  28. - /* First, dequote the directory name */
  29. - new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character);
  30. + /* We save the string and chop the trailing slash because stat/lstat behave
  31. + inconsistently if one is present. */
  32. + new_dirname = should_dequote ? bash_dequote_filename ((char *)dirname, rl_completion_quote_character) : savestring (dirname);
  33. dirlen = STRLEN (new_dirname);
  34. if (new_dirname[dirlen - 1] == '/')
  35. new_dirname[dirlen - 1] = '\0';
  36. @@ -3145,7 +3147,7 @@ bash_filename_stat_hook (dirname)
  37. else if (t = mbschr (local_dirname, '`')) /* XXX */
  38. should_expand_dirname = '`';
  39. - if (should_expand_dirname && directory_exists (local_dirname))
  40. + if (should_expand_dirname && directory_exists (local_dirname, 0))
  41. should_expand_dirname = 0;
  42. if (should_expand_dirname)
  43. @@ -3155,7 +3157,7 @@ bash_filename_stat_hook (dirname)
  44. have to worry about restoring this setting. */
  45. global_nounset = unbound_vars_is_error;
  46. unbound_vars_is_error = 0;
  47. - wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
  48. + wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */
  49. unbound_vars_is_error = global_nounset;
  50. if (wl)
  51. {
  52. @@ -3244,13 +3246,13 @@ bash_directory_completion_hook (dirname)
  53. should_expand_dirname = '`';
  54. }
  55. - if (should_expand_dirname && directory_exists (local_dirname))
  56. + if (should_expand_dirname && directory_exists (local_dirname, 1))
  57. should_expand_dirname = 0;
  58. if (should_expand_dirname)
  59. {
  60. new_dirname = savestring (local_dirname);
  61. - wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
  62. + wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */
  63. if (wl)
  64. {
  65. *dirname = string_list (wl);
  66. Index: bash-4.4/patchlevel.h
  67. ===================================================================
  68. --- bash-4.4.orig/patchlevel.h
  69. +++ bash-4.4/patchlevel.h
  70. @@ -25,6 +25,6 @@
  71. regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
  72. looks for to find the patch level (for the sccs version string). */
  73. -#define PATCHLEVEL 6
  74. +#define PATCHLEVEL 7
  75. #endif /* _PATCHLEVEL_H_ */
  76. Index: bash-4.4/subst.c
  77. ===================================================================
  78. --- bash-4.4.orig/subst.c
  79. +++ bash-4.4/subst.c
  80. @@ -9458,6 +9458,10 @@ add_twochars:
  81. tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS); /* affects $@ */
  82. if (word->flags & W_COMPLETE)
  83. tword->flags |= W_COMPLETE; /* for command substitutions */
  84. + if (word->flags & W_NOCOMSUB)
  85. + tword->flags |= W_NOCOMSUB;
  86. + if (word->flags & W_NOPROCSUB)
  87. + tword->flags |= W_NOPROCSUB;
  88. temp = (char *)NULL;