mintsources sets incorrect permissions on written files when user has umask set

Bug #1695731 reported by Luke Plant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux Mint
New
Undecided
Unassigned

Bug Description

I have 'umask 027' set in my profile, to protect my files from being read by other users on the system by default. (This allows me, for example, to have guest use my computer with a guest account while having private files in my own area).

When I run `mintsources` and choose a different mirror, the files `/etc/apt/sources.list.d/official-package-repositories.list` get rewritten, and at the same time, the new permissions get set using umask 027:

Before:

    ls -lh /etc/apt/sources.list.d/
    total 12K
    -rw-r--r-- 1 root root 189 May 18 12:08 google-chrome.list
    -rw-r--r-- 1 root root 561 Jun 4 15:35 official-package-repositories.list
    -rw-r--r-- 1 root root 585 Jun 4 15:35 official-source-repositories.list

After:

    ls -lh /etc/apt/sources.list.d/total 12K
    -rw-r--r-- 1 root root 189 May 18 12:08 google-chrome.list
    -rw-r----- 1 root root 545 May 31 14:55 official-package-repositories.list
    -rw-r----- 1 root root 569 May 31 14:55 official-source-repositories.list

The result is that various things that rely on users being able to read these files stop working. In particular, `apt-cache search foo` reports:

    E: Opening /etc/apt/sources.list.d/official-package-repositories.list - ifstream::ifstream (13: Permission denied)
    E: The list of sources could not be read.

Also, the Mint Update Manager often reports an error about the APT cache being corrupted.

These errors are fixed by changing the permissions back to what they were.

Expected behaviour:

Either, the new files should be written ignoring the user's umask (this is probably correct behaviour for a tool that runs as root),
Or, the new files should be written with permissions that allow Mint's own package management tools to continue working,
Or, the new files should be written with the same permissions that they were before.

Revision history for this message
Luke Plant (spookylukey) wrote :

Also reported here - https://github.com/linuxmint/mintsources/issues/97 - not sure which is the right place.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.