ngclient: Fix symlink usage on Windows - #2981
Open
jku wants to merge 1 commit into
Open
Conversation
Running ngclient on Windows (I believe NTFS only) leads to OSError: [WinError 1314] A required privilege is not held by the client symlinking is apparently a high privilege operation: let's add a fallback. Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
jku
force-pushed
the
workaround-symlink-on-windows
branch
from
August 7, 2026 08:08
79ab351 to
29a7c5b
Compare
lukpueh
approved these changes
Aug 7, 2026
| os.symlink(current, linkname) | ||
| try: | ||
| os.symlink(current, linkname) | ||
| except OSError: |
Member
Author
There was a problem hiding this comment.
Kind of... but I don't actually have a Windows/NTFS machine to test the more complicated code that would check for specific error codes, and the workaround should be harmless even if it happens for other reasons: just an extra copy of root.json
Contributor
|
Tested on Windows (Python 3.13.12, NTFS) without Developer Mode: With shutil.copyfile fallback: 196/198 tests pass but test_intermediate_root_cache and test_load_metadata_from_cache fail due to unexpected extra root.json 'wb' writes that the test mocks catch. Replacing shutil.copyfile with os.link fixes both issues — all 198 tests pass without Developer Mode and no test changes needed. |
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.
Running ngclient on Windows (I believe NTFS only) leads to
OSError: [WinError 1314] A required privilege is not held by the client
symlinking is apparently a high privilege operation: let's add a fallback, a real file will work just as well.
Fixes #2980
PR is partially AI generated