From 8bbf735e8684b1610196e0e761d58f8cf0ac1fec Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 30 2018 05:13:29 +0000 Subject: import bash-4.2.46-31.el7 --- diff --git a/SOURCES/bash-4.3-dircomp-append-slash.patch b/SOURCES/bash-4.3-dircomp-append-slash.patch new file mode 100644 index 0000000..0697ca6 --- /dev/null +++ b/SOURCES/bash-4.3-dircomp-append-slash.patch @@ -0,0 +1,99 @@ +diff --git a/bashline.c b/bashline.c +--- a/bashline.c ++++ b/bashline.c +@@ -117,6 +117,7 @@ static char *restore_tilde __P((char *, char *)); + + static char *bash_filename_rewrite_hook __P((char *, int)); + static void bash_directory_expansion __P((char **)); ++static int bash_filename_stat_hook __P((char **)); + static int bash_directory_completion_hook __P((char **)); + static int filename_completion_ignore __P((char **)); + static int bash_push_line __P((void)); +@@ -1414,7 +1415,7 @@ bash_default_completion (text, start, end, qc, compflags) + const char *text; + int start, end, qc, compflags; + { +- char **matches; ++ char **matches, *t; + + matches = (char **)NULL; + +@@ -1424,7 +1425,19 @@ bash_default_completion (text, start, end, qc, compflags) + if (qc != '\'' && text[1] == '(') /* ) */ + matches = rl_completion_matches (text, command_subst_completion_function); + else +- matches = rl_completion_matches (text, variable_completion_function); ++ { ++ matches = rl_completion_matches (text, variable_completion_function); ++ if (matches && matches[0] && matches[1] == 0) ++ { ++ t = savestring (matches[0]); ++ bash_filename_stat_hook (&t); ++ /* doesn't use test_for_directory because that performs tilde ++ expansion */ ++ if (file_isdir (t)) ++ rl_completion_append_character = '/'; ++ free (t); ++ } ++ } + } + + /* If the word starts in `~', and there is no slash in the word, then +@@ -2763,6 +2776,57 @@ restore_directory_hook (hookf) + rl_directory_rewrite_hook = hookf; + } + ++static int ++bash_filename_stat_hook (dirname) ++ char **dirname; ++{ ++ char *local_dirname, *new_dirname, *t; ++ int should_expand_dirname, return_value; ++ WORD_LIST *wl; ++ struct stat sb; ++ ++ local_dirname = *dirname; ++ should_expand_dirname = return_value = 0; ++ if (t = mbschr (local_dirname, '$')) ++ should_expand_dirname = '$'; ++ else if (t = mbschr (local_dirname, '`')) /* XXX */ ++ should_expand_dirname = '`'; ++ ++#if defined (HAVE_LSTAT) ++ if (should_expand_dirname && lstat (local_dirname, &sb) == 0) ++#else ++ if (should_expand_dirname && stat (local_dirname, &sb) == 0) ++#endif ++ should_expand_dirname = 0; ++ ++ if (should_expand_dirname) ++ { ++ new_dirname = savestring (local_dirname); ++ wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB); /* does the right thing */ ++ if (wl) ++ { ++ free (new_dirname); ++ new_dirname = string_list (wl); ++ /* Tell the completer we actually expanded something and change ++ *dirname only if we expanded to something non-null -- stat ++ behaves unpredictably when passed null or empty strings */ ++ if (new_dirname && *new_dirname) ++ { ++ free (local_dirname); /* XXX */ ++ local_dirname = *dirname = new_dirname; ++ return_value = STREQ (local_dirname, *dirname) == 0; ++ } ++ else ++ free (new_dirname); ++ dispose_words (wl); ++ } ++ else ++ free (new_dirname); ++ } ++ ++ return (return_value); ++} ++ + /* Handle symbolic link references and other directory name + expansions while hacking completion. This should return 1 if it modifies + the DIRNAME argument, 0 otherwise. It should make sure not to modify diff --git a/SPECS/bash.spec b/SPECS/bash.spec index 4b2ec49..2bbedcd 100644 --- a/SPECS/bash.spec +++ b/SPECS/bash.spec @@ -6,7 +6,7 @@ Version: %{baseversion}%{patchleveltag} Name: bash Summary: The GNU Bourne Again shell -Release: 30%{?dist} +Release: 31%{?dist} Group: System Environment/Shells License: GPLv3+ Url: http://www.gnu.org/software/bash @@ -195,6 +195,9 @@ Patch152: bash-4.3-pipefd-leak.patch #1487615 - bash fails to execute commands containing multibyte characters Patch153: bash-4.3-wshouldquote.patch +#1495398 - Append '/' while tab completing directory names +Patch154: bash-4.3-dircomp-append-slash.patch + BuildRequires: texinfo bison BuildRequires: ncurses-devel BuildRequires: autoconf, gettext @@ -326,6 +329,7 @@ This package contains documentation files for %{name}. %patch151 -p1 -b .cve-2016-9401 %patch152 -p1 -b .pipefd-leak %patch153 -p1 -b .wshouldquote +%patch154 -p1 -b .append-slash echo %{version} > _distribution echo %{release} > _patchlevel @@ -518,6 +522,10 @@ end #%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt %changelog +* Tue May 22 2018 Siteshwar Vashisht - 4.2.46-31 +- Append '/' while tab completing directory names + Resolves: #1495398 + * Mon Sep 25 2017 Siteshwar Vashisht - 4.2.46-30 - Check for multibyte characters in commands Resolves: #1487615