Merge ubiquity:usr-merge into ubiquity:master

Proposed by Dimitri John Ledkov
Status: Rejected
Rejected by: Adam Conrad
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 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.
Revision history for this message
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

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
diff --git a/debian/changelog b/debian/changelog
index 226963a..a9dcce5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ ubiquity (19.04.1) UNRELEASED; urgency=medium
3 * Update d-i sources to point at disco3 * Update d-i sources to point at disco
4 * Automatic update of included source packages: choose-mirror4 * Automatic update of included source packages: choose-mirror
5 2.78ubuntu5, preseed 1.71ubuntu9.5 2.78ubuntu5, preseed 1.71ubuntu9.
6 * Support usr-merge in ubiquity. LP: #1801408
67
7 -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 06 Nov 2018 13:25:41 +00008 -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 06 Nov 2018 13:25:41 +0000
89
diff --git a/scripts/install.py b/scripts/install.py
index fb89ceb..69a0c9d 100755
--- a/scripts/install.py
+++ b/scripts/install.py
@@ -436,9 +436,30 @@ class Install(install_misc.InstallBase):
436 targetpath = os.path.join(self.target, relpath)436 targetpath = os.path.join(self.target, relpath)
437 st = os.lstat(sourcepath)437 st = os.lstat(sourcepath)
438438
439 def blacklisted(st, sourcepath, relpath):
440 # Not blacklisted, we are done
441 if '/%s' % relpath not in self.blacklist:
442 return False
443 # If a path is blacklisted, it gets tricky
444 # Directories are not blacklistable
445 if stat.S_ISDIR(st.st_mode):
446 return False
447 # Everything else is... but symlinks are special
448 if not stat.S_ISLNK(st.st_mode):
449 return True
450 # Does it exist?!
451 if not os.path.exists(os.path.realpath(sourcepath)):
452 return True
453 # mostly blacklistable, unless they point to a dir
454 if not stat.S_ISDIR(os.stat(sourcepath).st_mode):
455 return True
456 # thus final condition
457 # top-level symlink to a dir is not blacklistable
458 # ie. /sbin -> /usr/sbin
459 return '/' in relpath
460
439 # Is the path blacklisted?461 # Is the path blacklisted?
440 if (not stat.S_ISDIR(st.st_mode) and462 if blacklisted(st, sourcepath, relpath):
441 '/%s' % relpath in self.blacklist):
442 if debug:463 if debug:
443 syslog.syslog('Not copying %s' % relpath)464 syslog.syslog('Not copying %s' % relpath)
444 continue465 continue

Subscribers

People subscribed via source and target branches