fix: allow running export-login twice to the same file - #6302
Open
mbeijen wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression/bug in snapcraft export-login where re-exporting credentials to the same (now owner-read-only) file could fail with a PermissionError, and adds coverage + release note entry for the behavior.
Changes:
- Adjust
export-loginto restore owner write permission on an existing credentials file before rewriting it. - Add a unit test that runs
export-logintwice against the same file and asserts the final permissions remain owner-read-only. - Document the fix in the Snapcraft 9.0.0 release notes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
snapcraft/commands/account.py |
Adds a pre-write chmod to allow rewriting an existing owner-read-only credentials file. |
tests/unit/commands/test_account.py |
Adds regression test for running export-login twice to the same file and preserving 0400 permissions. |
docs/release-notes/snapcraft-9-0.rst |
Adds a 9.0.0 fixed-issues bullet referencing #6301. |
mbeijen
force-pushed
the
6301-fix-export-login-two-times
branch
from
June 23, 2026 10:35
701f770 to
04f8bb8
Compare
mbeijen
force-pushed
the
6301-fix-export-login-two-times
branch
from
June 23, 2026 10:38
04f8bb8 to
7dfe29c
Compare
medubelko
requested changes
Jul 13, 2026
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.
Closes #6301
Makes sure there is no 'internal error' when generating credentials twice to the same file.
make lint && make test.