Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 3/3] CONFIG_PROTECT: protect symlinks, bug #485598
Date: Mon, 03 Nov 2014 03:55:52
Message-Id: 20141102195454.4ca2a724.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 3/3] CONFIG_PROTECT: protect symlinks, bug #485598 by Zac Medico
1 On Mon, 27 Oct 2014 13:35:19 -0700
2 Zac Medico <zmedico@g.o> wrote:
3
4 > Users may not want some symlinks to get clobbered, so protect them
5 > with CONFIG_PROTECT. Changes were required in the dblink.mergeme
6 > method and the new_protect_filename function.
7 >
8 > The changes to dblink.mergeme do 3 things:
9 >
10 > * Move the bulk of config protection logic from dblink.mergeme to a
11 > new dblink._protect method. The new method only returns 3
12 > variables, which makes it easier to understand how config protection
13 > interacts with the dblink.mergeme code that uses those variables.
14 > This is important, since dblink.mergeme has so many variables.
15 >
16 > * Initialize more variables at the beginning of dblink.mergeme, since
17 > those variables are used by the dblink._protect method.
18 >
19 > * Use the variables returned from dblink._protect to trigger
20 > appropriate behavior later in dblink.mergeme.
21 >
22 > The new_protect_filename changes are required since this function
23 > compares the new file to old ._cfg* files that may already exist, in
24 > order to avoid creating duplicate ._cfg* files. In these comparisons,
25 > it needs to handle symlinks differently from regular files.
26 >
27 > The unit tests demonstrate operation in many different scenarios,
28 > including:
29 >
30 > * regular file replaces regular file
31 > * regular file replaces symlink
32 > * regular file replaces directory
33 > * symlink replaces symlink
34 > * symlink replaces regular file
35 > * symlink replaces directory
36 > * directory replaces regular file
37 > * directory replaces symlink
38 >
39 > X-Gentoo-Bug: 485598
40 > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=485598
41 > ---
42 > This updated patch only adds to the commit message in order to
43 > provide some information that may be helpful to reviewers of the
44 > patch. There are no changes to the code.
45 >
46 > pym/portage/dbapi/vartree.py | 255
47 > ++++++++++++--------- pym/portage/tests/emerge/test_config_protect.py
48 > | 292 ++++++++++++++++++++++++
49 > pym/portage/util/__init__.py | 35 ++- 3 files
50 > changed, 463 insertions(+), 119 deletions(-) create mode 100644
51 > pym/portage/tests/emerge/test_config_protect.py
52 >
53
54 See my github inline comments re: use of my* variables
55
56
57 --
58 Brian Dolbec <dolsen>