1 |
On Sun, 3 May 2015 23:01:58 -0700 |
2 |
Zac Medico <zmedico@g.o> wrote: |
3 |
|
4 |
> This handles two cases where varexpand incremented the index without |
5 |
> checking bounds. |
6 |
> |
7 |
> X-Gentoo-Bug: 548556 |
8 |
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548556 |
9 |
> X-Gentoo-forum-thread: |
10 |
> https://forums.gentoo.org/viewtopic-t-1016432.html --- |
11 |
> pym/portage/util/__init__.py | 12 ++++++++++++ |
12 |
> 1 file changed, 12 insertions(+) |
13 |
> |
14 |
> diff --git a/pym/portage/util/__init__.py |
15 |
> b/pym/portage/util/__init__.py index 48cd1b7..c0b509b 100644 |
16 |
> --- a/pym/portage/util/__init__.py |
17 |
> +++ b/pym/portage/util/__init__.py |
18 |
> @@ -850,8 +850,20 @@ def varexpand(mystring, mydict=None, |
19 |
> error_leader=None): continue |
20 |
> elif current == "$": |
21 |
> pos += 1 |
22 |
> + if pos == length: |
23 |
> + # shells handle this like \$ |
24 |
> + newstring.append(current) |
25 |
> + continue |
26 |
> + |
27 |
> if mystring[pos] == "{": |
28 |
> pos += 1 |
29 |
> + if pos == length: |
30 |
> + msg = |
31 |
> _varexpand_unexpected_eof_msg |
32 |
> + if error_leader is |
33 |
> not None: |
34 |
> + msg = |
35 |
> error_leader() + msg |
36 |
> + writemsg(msg + "\n", |
37 |
> noiselevel=-1) |
38 |
> + return "" |
39 |
> + |
40 |
> braced = True |
41 |
> else: |
42 |
> braced = False |
43 |
|
44 |
|
45 |
Yeah, good idea, looks good. |
46 |
|
47 |
-- |
48 |
Brian Dolbec <dolsen> |