Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spices.py: Preserve original file permissions of downloaded spices #12174

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,11 @@ def _install(self, job):
try:
with zipfile.ZipFile(ziptempfile) as _zip:
tempfolder = tempfile.mkdtemp()
_zip.extractall(tempfolder)
for member in _zip.infolist():
_zip.extract(member, tempfolder)
permissions = member.external_attr >> 16
# Preserve file permissions
os.chmod(os.path.join(tempfolder, member.filename), permissions)

uuidfolder = tempfolder if self.actions else os.path.join(tempfolder, uuid)

Expand Down Expand Up @@ -751,12 +755,6 @@ def install_from_folder(self, folder, uuid, from_spices=False):
disabled_list.append(uuid_name)
self.settings.set_strv(self.enabled_key, disabled_list)

if not self.themes:
# ensure proper file permissions
for root, _, files in os.walk(dest):
for file in files:
os.chmod(os.path.join(root, file), 0o755)

meta_path = os.path.join(dest, 'metadata.json')
if self.themes and not os.path.exists(meta_path):
md = {}
Expand Down
Loading