Repository navigation
fix: back up the stylesheet next to it, and don't copy read-only permissions - #584
Open
mattchristenson wants to merge 1 commit into
Open
mattchristenson wants to merge 1 commit into
mattchristenson wants to merge 1 commit into
Conversation
…issions patchCss() named the backup after this.configMgr.stylesheetFileName, which doesn't exist, so it went to "undefined.bak" in GNOME Shell's working directory (the home folder). Both copies took their source's permissions: with a read-only install (e.g. NixOS) the user's stylesheet and the backup became read-only, and at the next update the copy failed with "Permission denied" and Forge didn't start. The backup is stylesheet.css.bak next to the stylesheet, the copies get default permissions, a read-only copy left by an earlier version is replaced, and a failed update is logged instead of stopping Forge. Fixes forge-ext#266 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #266.
Problem. After each Forge update (setting
css-last-updatediffers from Forge's own tag),patchCss()backs up the user's stylesheet (~/.config/forge/stylesheet/forge/stylesheet.css) and copies the default stylesheet over it. That had two bugs, both reported in #266:this.configMgr.stylesheetFileName, a property that doesn't exist. So the backup was written toundefined.bakin GNOME Shell's working directory, which is usually the home folder.Gio.File.copy()gives the copy its source's permissions unless it is passedTARGET_DEFAULT_PERMS. Where the extension's files are read-only (NixOS, as in the report, or a package that installs them 0444), the user's stylesheet and the backup became read-only too. At the next update, copying over them failed with "Permission denied",enable()threw, and Forge didn't start until both files werechmoded.Change.
stylesheet.css.bak, next to the stylesheet.TARGET_DEFAULT_PERMS, so they get the usual permissions of a new file.PERMISSION_DENIEDand the target exists and isn't writable, the target is deleted and copied again. An unreadable source never deletes anything.console.warnand starts with the stylesheet it has. It tries again at the next start.A
~/undefined.bakleft by earlier versions stays where it is; it can be deleted.Testing. Scenario
scenarios/31_stylesheet_update_backup.py. It uses the sandbox's own directories, and makes the sandbox's copy of Forge read-only, as such an install is:stylesheet.css.baknext to the stylesheet, and noundefined.bakis written to GNOME Shell's working directory;On
main, the permission error from the issue stops Forge:With this PR:
main0/4 → 4/4. The rest of the suite (scenarios 01–30) gives the same results as onmain, apart from checks whose results vary between runs onmainitself (3.4, a key-repeat resize; 23.1, #268).prettier@2.7.1 --checkis clean.🤖 Generated with Claude Code