sources.list rewrite doesn't preserve original permissions
Bug #804548 reported by
Andreas Hasenack
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Landscape Client |
Fix Released
|
Medium
|
Alberto Donato |
Bug Description
With the repository profiles feature, /etc/apt/
The original ownership and permissions of the file, and the ones in sources.list.d (didn't check) should be preserved.
An example of a bad consequence of the tighter permissions can be seen on a desktop system. Pretty soon the user will see a big red "forbidden" icon in the notification area complaining about problems reading sources.list (see attached screenshot).
Related branches
lp://qastaging/~ack/landscape-client/sources.list-preserve-old-permissions
- Thomas Herve (community): Approve
- Kevin McDermott (community): Approve
-
Diff: 66 lines (+28/-2)2 files modifiedlandscape/manager/aptsources.py (+6/-2)
landscape/manager/tests/test_aptsources.py (+22/-0)
tags: |
added: story-apt-sources removed: theme-repo-management |
Changed in landscape-client: | |
milestone: | backlog → 11.07.1 |
Changed in landscape-client: | |
status: | New → In Progress |
assignee: | nobody → Alberto Donato (ack) |
Changed in landscape-client: | |
status: | In Progress → Fix Committed |
Changed in landscape-client: | |
status: | In Progress → Fix Committed |
tags: | added: verified |
Changed in landscape-client: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
As a side note, os.rename() doesn't work accross devices, so if /tmp happens to be on a different partition, something common in certain server installations, the operation would fail.
def _handle_ sources( self, ignored, sources):
os.rename( path, self.SOURCES_LIST)
"""Handle sources repositories."""
fd, path = tempfile.mkstemp()
(...)
Example: path,"/ home/andreas/ foo")
>>> import os,tempfile
>>> fd,path = tempfile.mkstemp()
>>> os.close(fd)
>>> path
'/tmp/tmp57KbcG'
>>> os.rename(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 18] Invalid cross-device link
>>>
From the docs at http:// docs.python. org/library/ os.html? highlight= os.rename# os.rename:
"The operation may fail on some Unix flavors if src and dst are on different filesystems"