Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
Date: Wed, 09 Jan 2019 17:50:35
Message-Id: 1547056224.8dd00bb17128098d6ac2f4c43ccd797519340e9f.polynomial-c@gentoo
1 commit: 8dd00bb17128098d6ac2f4c43ccd797519340e9f
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 9 17:50:01 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 9 17:50:24 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8dd00bb1
7
8 app-shells/bash: Fixed weird insert of backslashes
9
10 Package-Manager: Portage-2.3.54, Repoman-2.3.12
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 app-shells/bash/bash-5.0.ebuild | 2 +
14 .../files/bash-5.0-glob-pattern-backslash.patch | 133 +++++++++++++++++++++
15 2 files changed, 135 insertions(+)
16
17 diff --git a/app-shells/bash/bash-5.0.ebuild b/app-shells/bash/bash-5.0.ebuild
18 index dcfccc608f9..9dd564847ad 100644
19 --- a/app-shells/bash/bash-5.0.ebuild
20 +++ b/app-shells/bash/bash-5.0.ebuild
21 @@ -97,6 +97,8 @@ src_prepare() {
22 sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
23 touch -r . doc/*
24
25 + eapply -p0 "${FILESDIR}"/${P}-glob-pattern-backslash.patch
26 +
27 eapply_user
28 }
29
30
31 diff --git a/app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch b/app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch
32 new file mode 100644
33 index 00000000000..40379b3d4cc
34 --- /dev/null
35 +++ b/app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch
36 @@ -0,0 +1,133 @@
37 +*** ../bash-5.0/bashline.c 2018-11-27 13:20:16.000000000 -0500
38 +--- bashline.c 2019-01-09 09:44:26.000000000 -0500
39 +***************
40 +*** 232,235 ****
41 +--- 232,236 ----
42 + static int bash_possible_command_completions __P((int, int));
43 +
44 ++ static int completion_glob_pattern __P((const char *));
45 + static char *glob_complete_word __P((const char *, int));
46 + static int bash_glob_completion_internal __P((int));
47 +***************
48 +*** 1742,1746 ****
49 + /* This could be a globbing pattern, so try to expand it using pathname
50 + expansion. */
51 +! if (!matches && glob_pattern_p (text))
52 + {
53 + matches = rl_completion_matches (text, glob_complete_word);
54 +--- 1743,1747 ----
55 + /* This could be a globbing pattern, so try to expand it using pathname
56 + expansion. */
57 +! if (!matches && completion_glob_pattern (text))
58 + {
59 + matches = rl_completion_matches (text, glob_complete_word);
60 +***************
61 +*** 1851,1855 ****
62 + }
63 +
64 +! globpat = glob_pattern_p (hint_text);
65 +
66 + /* If this is an absolute program name, do not check it against
67 +--- 1852,1856 ----
68 + }
69 +
70 +! globpat = completion_glob_pattern (hint_text);
71 +
72 + /* If this is an absolute program name, do not check it against
73 +***************
74 +*** 3714,3717 ****
75 +--- 3715,3773 ----
76 + }
77 +
78 ++ static int
79 ++ completion_glob_pattern (string)
80 ++ const char *string;
81 ++ {
82 ++ register int c;
83 ++ char *send;
84 ++ int open;
85 ++
86 ++ DECLARE_MBSTATE;
87 ++
88 ++ open = 0;
89 ++ send = string + strlen (string);
90 ++
91 ++ while (c = *string++)
92 ++ {
93 ++ switch (c)
94 ++ {
95 ++ case '?':
96 ++ case '*':
97 ++ return (1);
98 ++
99 ++ case '[':
100 ++ open++;
101 ++ continue;
102 ++
103 ++ case ']':
104 ++ if (open)
105 ++ return (1);
106 ++ continue;
107 ++
108 ++ case '+':
109 ++ case '@':
110 ++ case '!':
111 ++ if (*string == '(') /*)*/
112 ++ return (1);
113 ++ continue;
114 ++
115 ++ case '\\':
116 ++ if (*string == 0)
117 ++ return (0);
118 ++ }
119 ++
120 ++ /* Advance one fewer byte than an entire multibyte character to
121 ++ account for the auto-increment in the loop above. */
122 ++ #ifdef HANDLE_MULTIBYTE
123 ++ string--;
124 ++ ADVANCE_CHAR_P (string, send - string);
125 ++ string++;
126 ++ #else
127 ++ ADVANCE_CHAR_P (string, send - string);
128 ++ #endif
129 ++ }
130 ++ return (0);
131 ++ }
132 ++
133 + static char *globtext;
134 + static char *globorig;
135 +***************
136 +*** 3878,3882 ****
137 + }
138 +
139 +! if (t && glob_pattern_p (t) == 0)
140 + rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
141 + FREE (t);
142 +--- 3934,3938 ----
143 + }
144 +
145 +! if (t && completion_glob_pattern (t) == 0)
146 + rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
147 + FREE (t);
148 +*** ../bash-5.0/lib/glob/glob_loop.c 2018-12-31 13:35:15.000000000 -0500
149 +--- lib/glob/glob_loop.c 2019-01-09 09:44:36.000000000 -0500
150 +***************
151 +*** 55,59 ****
152 +
153 + case L('\\'):
154 +- #if 0
155 + /* Don't let the pattern end in a backslash (GMATCH returns no match
156 + if the pattern ends in a backslash anyway), but otherwise return 1,
157 +--- 55,58 ----
158 +***************
159 +*** 61,69 ****
160 + and it can be removed. */
161 + return (*p != L('\0'));
162 +- #else
163 +- /* The pattern may not end with a backslash. */
164 +- if (*p++ == L('\0'))
165 +- return 0;
166 +- #endif
167 + }
168 +
169 +--- 60,63 ----