1 |
This fixes the ConfigProtect class, etc-update, and dispatch-conf to |
2 |
account for non-existent files (rather than directories) that are |
3 |
listed directly in CONFIG_PROTECT. It has been valid to list files |
4 |
directly in CONFIG_PROTECT since bug #14321. However, the support for |
5 |
non-existent files added for bug #523684 did not include support for |
6 |
non-existent files listed directly in CONFIG_PROTECT. |
7 |
|
8 |
Fixes: 5f7b4865ecaf ("dblink.mergeme: implement bug #523684") |
9 |
X-Gentoo-Bug: 523684 |
10 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523684 |
11 |
--- |
12 |
bin/dispatch-conf | 10 ++++++---- |
13 |
bin/etc-update | 5 ++++- |
14 |
pym/portage/util/__init__.py | 6 ++++-- |
15 |
3 files changed, 14 insertions(+), 7 deletions(-) |
16 |
|
17 |
diff --git a/bin/dispatch-conf b/bin/dispatch-conf |
18 |
index fb0a8af..6d2ae94 100755 |
19 |
--- a/bin/dispatch-conf |
20 |
+++ b/bin/dispatch-conf |
21 |
@@ -116,13 +116,15 @@ class dispatch: |
22 |
for path in config_paths: |
23 |
path = portage.normalize_path( |
24 |
os.path.join(config_root, path.lstrip(os.sep))) |
25 |
- try: |
26 |
- mymode = os.stat(path).st_mode |
27 |
- except OSError: |
28 |
+ |
29 |
+ # Protect files that don't exist (bug #523684). If the |
30 |
+ # parent directory doesn't exist, we can safely skip it. |
31 |
+ if not os.path.isdir(os.path.dirname(path)): |
32 |
continue |
33 |
+ |
34 |
basename = "*" |
35 |
find_opts = "-name '.*' -type d -prune -o" |
36 |
- if not stat.S_ISDIR(mymode): |
37 |
+ if not os.path.isdir(path): |
38 |
path, basename = os.path.split(path) |
39 |
find_opts = "-maxdepth 1" |
40 |
|
41 |
diff --git a/bin/etc-update b/bin/etc-update |
42 |
index 1a99231..7ac6f0b 100755 |
43 |
--- a/bin/etc-update |
44 |
+++ b/bin/etc-update |
45 |
@@ -74,7 +74,10 @@ scan() { |
46 |
path="${EROOT%/}${path}" |
47 |
|
48 |
if [[ ! -d ${path} ]] ; then |
49 |
- [[ ! -f ${path} ]] && continue |
50 |
+ # Protect files that don't exist (bug #523684). If the |
51 |
+ # parent directory doesn't exist, we can safely skip it. |
52 |
+ path=${path%/} |
53 |
+ [[ -d ${path%/*} ]] || continue |
54 |
local my_basename="${path##*/}" |
55 |
path="${path%/*}" |
56 |
find_opts=( -maxdepth 1 -name "._cfg????_${my_basename}" ) |
57 |
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py |
58 |
index 4105c19..fe79942 100644 |
59 |
--- a/pym/portage/util/__init__.py |
60 |
+++ b/pym/portage/util/__init__.py |
61 |
@@ -1572,12 +1572,14 @@ class ConfigProtect(object): |
62 |
for x in self.protect_list: |
63 |
ppath = normalize_path( |
64 |
os.path.join(self.myroot, x.lstrip(os.path.sep))) |
65 |
+ # Protect files that don't exist (bug #523684). If the |
66 |
+ # parent directory doesn't exist, we can safely skip it. |
67 |
+ if os.path.isdir(os.path.dirname(ppath)): |
68 |
+ self.protect.append(ppath) |
69 |
try: |
70 |
if stat.S_ISDIR(os.stat(ppath).st_mode): |
71 |
self._dirs.add(ppath) |
72 |
- self.protect.append(ppath) |
73 |
except OSError: |
74 |
- # If it doesn't exist, there's no need to protect it. |
75 |
pass |
76 |
|
77 |
self.protectmask = [] |
78 |
-- |
79 |
2.0.4 |