Merge ubiquity:usr-merge into ubiquity:master

Proposed by Dimitri John Ledkov on 2018-11-06
Status: Rejected
Rejected by: Adam Conrad on 2018-11-06
Proposed branch: ubiquity:usr-merge
Merge into: ubiquity:master
Diff against target: 49 lines (+24/-2)
2 files modified
debian/changelog (+1/-0)
scripts/install.py (+23/-2)
Reviewer Review Type Date Requested Status
Ubuntu Installer Team 2018-11-06 Pending
Review via email: mp+358383@code.launchpad.net

Commit message

Support usr-merge in ubiquity.

With introduction of usr-merge in disco, we started to have top-level symlinks to dirs i.e. /sbin -> /usr/sbin which broke with blacklisting logic. Because such a symlink may not be blacklisted, even though blacklisted packages ship /sbin directory. A simple check if that is a dir is no longer sufficient. Instead extended the blacklisting logic to prevent blacklisting symlinks to dirs.

LP: #1801408

To post a comment you must log in.
Dimitri John Ledkov (xnox) wrote :

Hm, maybe i went overboard with this checks, since top-level things must be dirs or symlinks to dirs, thus `and '/' in relpath` would actually be sufficient.

Unmerged commits

bc3a7d8... by Dimitri John Ledkov on 2018-11-06

Support usr-merge in ubiquity.

With introduction of usr-merge in disco, we started to have top-level
symlinks to dirs i.e. /sbin -> /usr/sbin which broke with blacklisting
logic. Because such a symlink may not be blacklisted, even though
blacklisted packages ship /sbin directory. A simple check if that is a
dir is no longer sufficient. Instead extended the blacklisting logic
to prevent blacklisting symlinks to dirs.

LP: #1801408

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 226963a..a9dcce5 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -3,6 +3,7 @@ ubiquity (19.04.1) UNRELEASED; urgency=medium
6 * Update d-i sources to point at disco
7 * Automatic update of included source packages: choose-mirror
8 2.78ubuntu5, preseed 1.71ubuntu9.
9+ * Support usr-merge in ubiquity. LP: #1801408
10
11 -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 06 Nov 2018 13:25:41 +0000
12
13diff --git a/scripts/install.py b/scripts/install.py
14index fb89ceb..69a0c9d 100755
15--- a/scripts/install.py
16+++ b/scripts/install.py
17@@ -436,9 +436,30 @@ class Install(install_misc.InstallBase):
18 targetpath = os.path.join(self.target, relpath)
19 st = os.lstat(sourcepath)
20
21+ def blacklisted(st, sourcepath, relpath):
22+ # Not blacklisted, we are done
23+ if '/%s' % relpath not in self.blacklist:
24+ return False
25+ # If a path is blacklisted, it gets tricky
26+ # Directories are not blacklistable
27+ if stat.S_ISDIR(st.st_mode):
28+ return False
29+ # Everything else is... but symlinks are special
30+ if not stat.S_ISLNK(st.st_mode):
31+ return True
32+ # Does it exist?!
33+ if not os.path.exists(os.path.realpath(sourcepath)):
34+ return True
35+ # mostly blacklistable, unless they point to a dir
36+ if not stat.S_ISDIR(os.stat(sourcepath).st_mode):
37+ return True
38+ # thus final condition
39+ # top-level symlink to a dir is not blacklistable
40+ # ie. /sbin -> /usr/sbin
41+ return '/' in relpath
42+
43 # Is the path blacklisted?
44- if (not stat.S_ISDIR(st.st_mode) and
45- '/%s' % relpath in self.blacklist):
46+ if blacklisted(st, sourcepath, relpath):
47 if debug:
48 syslog.syslog('Not copying %s' % relpath)
49 continue

Subscribers

People subscribed via source and target branches