Merge ~krenshaw/ubuntu/+source/command-not-found:focal-lp1953610 into ubuntu/+source/command-not-found:ubuntu/focal-proposed

Proposed by Kellen Renshaw
Status: Merged
Merge reported by: Robie Basak
Merged at revision: a7e9755ab845661b1328cc28ea244b00a24530d4
Proposed branch: ~krenshaw/ubuntu/+source/command-not-found:focal-lp1953610
Merge into: ubuntu/+source/command-not-found:ubuntu/focal-proposed
Diff against target: 59 lines (+20/-1)
4 files modified
CommandNotFound/CommandNotFound.py (+1/-1)
cnf-update-db (+2/-0)
debian/changelog (+12/-0)
debian/tests/smoke (+5/-0)
Reviewer Review Type Date Requested Status
Julian Andres Klode (community) Approve
git-ubuntu import Pending
Review via email: mp+414978@code.launchpad.net

Description of the change

Cherry-picks the patches contributed to cnf by Arnaud Rebillout to Focal to address LP: #1953610.

To post a comment you must log in.
a7e9755... by Kellen Renshaw

Cherry-pick of cnf-update-db fixes from 22.04

 Fixes: LP: #1953610

Signed-off-by: Kellen Renshaw <email address hidden>

Revision history for this message
Julian Andres Klode (juliank) wrote :

We sponsored these uploads, this should be merged

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/CommandNotFound/CommandNotFound.py b/CommandNotFound/CommandNotFound.py
index 742851b..dfdd21c 100644
--- a/CommandNotFound/CommandNotFound.py
+++ b/CommandNotFound/CommandNotFound.py
@@ -75,7 +75,7 @@ class CommandNotFound(object):
75 def __init__(self, data_dir="/usr/share/command-not-found"):75 def __init__(self, data_dir="/usr/share/command-not-found"):
76 self.sources_list = self._getSourcesList()76 self.sources_list = self._getSourcesList()
77 # a new style DB means we can skip loading the old legacy static DB77 # a new style DB means we can skip loading the old legacy static DB
78 if os.path.exists(dbpath):78 if os.path.exists(dbpath) and os.access(dbpath, os.R_OK):
79 self.db = SqliteDatabase(dbpath)79 self.db = SqliteDatabase(dbpath)
80 else:80 else:
81 raise FileNotFoundError("Cannot find database")81 raise FileNotFoundError("Cannot find database")
diff --git a/cnf-update-db b/cnf-update-db
index 18cba1e..6174635 100755
--- a/cnf-update-db
+++ b/cnf-update-db
@@ -22,6 +22,8 @@ if __name__ == "__main__":
2222
23 command_files = glob.glob("/var/lib/apt/lists/*Commands-*")23 command_files = glob.glob("/var/lib/apt/lists/*Commands-*")
24 if len(command_files) > 0:24 if len(command_files) > 0:
25 umask = os.umask(0o22)
25 col = DbCreator(command_files)26 col = DbCreator(command_files)
26 col.create(db)27 col.create(db)
28 os.umask(umask)
2729
diff --git a/debian/changelog b/debian/changelog
index d435bf3..9504cc9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
1command-not-found (20.04.6) focal; urgency=medium
2
3 [ Arnaud Rebillout ]
4 * cnf: Bail out early if the database is not readable
5 * cnf-update-db: Creates a world-readable database (Closes: #986461)
6 * Add test to make sure that the database is world-readable
7
8 [ Kellen Renshaw ]
9 * Cherry-pick cnf-update-db umask fixes from 22.04 (LP: #1953610)
10
11 -- Kellen Renshaw <kellen.renshaw@canonical.com> Mon, 14 Feb 2022 10:10:22 -0700
12
1command-not-found (20.04.5) focal; urgency=medium13command-not-found (20.04.5) focal; urgency=medium
214
3 * Correctly handle compressed APT index files (LP: #1876034)15 * Correctly handle compressed APT index files (LP: #1876034)
diff --git a/debian/tests/smoke b/debian/tests/smoke
index 4f0e5ae..949e637 100755
--- a/debian/tests/smoke
+++ b/debian/tests/smoke
@@ -18,3 +18,8 @@ adduser --gecos="no" --disabled-password testuser
1818
19echo "Ensure c-n-f works as user"19echo "Ensure c-n-f works as user"
20su -l testuser -c "/usr/lib/command-not-found --ignore-installed konsole" 2>&1 | grep konsole20su -l testuser -c "/usr/lib/command-not-found --ignore-installed konsole" 2>&1 | grep konsole
21
22echo "Ensure c-n-f database is world-readable" # cf. #986461
23rm -f /var/lib/command-not-found/*
24(umask 0077 && /usr/lib/cnf-update-db)
25su -l testuser -c "/usr/lib/command-not-found --ignore-installed emacs" 2>&1 | grep emacs

Subscribers

People subscribed via source and target branches