Merge lp:~nononoha/command-not-found/command-not-found into lp:command-not-found

Proposed by Noah Gorny
Status: Needs review
Proposed branch: lp:~nononoha/command-not-found/command-not-found
Merge into: lp:command-not-found
Diff against target: 21 lines (+4/-0)
1 file modified
CommandNotFound/db/ (+4/-0)
To merge this branch: bzr merge lp:~nononoha/command-not-found/command-not-found
Reviewer Review Type Date Requested Status
Adrian Wilkins (community) Approve
Michael Vogt Pending
Review via email:

Commit message

Fix file permissions of db on creation

Description of the change

As noted in
The db file is sometimes created with incorrect permissions, which causes crashes
This fixes the problem by chmoding the db file to 644 on creation.

To post a comment you must log in.
279. By Noah Gorny

db: creator: Fix file permissions of db on creation

Revision history for this message
Noah Gorny (nononoha) wrote :

I can not link to the bug for some reason, but it resolves

Revision history for this message
Adrian Wilkins (adrian-wilkins) wrote :

Looks good.

review: Approve

Unmerged revisions

279. By Noah Gorny

db: creator: Fix file permissions of db on creation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CommandNotFound/db/'
2--- CommandNotFound/db/ 2018-03-20 11:31:18 +0000
3+++ CommandNotFound/db/ 2020-10-16 09:24:39 +0000
4@@ -7,6 +7,7 @@
5 import sqlite3
6 import sys
7 import time
8+import stat
10 import apt_pkg
11 apt_pkg.init()
12@@ -95,6 +96,9 @@
13 rm_f(metadata_file)
14 # put database in place
15 os.rename(tmpdb, dbname)
16+ # change mode to 644
17+ mode = stat.S_IREAD | stat.S_IWRITE | stat.S_IRGRP | stat.S_IROTH
18+ os.chmod(dbname, mode)
19 # add new metadata
20 with open(metadata_file, "w") as fp:
21 json.dump(self._calc_input_metadata(), fp)


People subscribed via source and target branches

to all changes: