fix(windows): enable SYMLINK import strategy on Windows with allow_symlinks_on_windows flag#604
Closed
fatbob01 wants to merge 0 commit into
Closed
fix(windows): enable SYMLINK import strategy on Windows with allow_symlinks_on_windows flag#604fatbob01 wants to merge 0 commit into
fatbob01 wants to merge 0 commit into
Conversation
Owner
|
Instead of adding a new config allow_symlink_in_windows can you just relay on the symlink enabled config and just remove the windows limitation? |
Owner
|
im removing the flag here #607 and just using the symlink, sorry about adding the flag in the first place |
Contributor
Author
|
Thanks for the feedback and for implementing a cleaner fix directly! Agreed that removing the guard entirely is better than gating it behind a flag. Also good catch that the health handler was ignoring the flag anyway. Appreciate the quick turnaround! |
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.
Summary
Three related bugs prevented the
SYMLINKimport strategy from working on Windows even when the user explicitly setallow_symlinks_on_windows: true. All three need to be fixed together for Windows symlink support to work end-to-end.Bug 1: viper/mapstructure silently drops
*boolfields (config/manager.go)viper.Unmarshalleaves pointer-to-bool (*bool) fields asnilwhen the key is present in the YAML config but mapstructure cannot resolve it to a non-nil pointer. This meansAllowSymlinksOnWindowsis alwaysnilafter startup even when set totruein the config file.Fix: Added a
viper.GetBoolfallback afterUnmarshalin bothreloadConfigandLoadConfigto ensure the field is always populated from the actual config value.Bug 2: Validator blocks SYMLINK on Windows unconditionally (
config/manager.go)The config validator returned an error for any
Windows + SYMLINKcombination without checking theAllowSymlinksOnWindowsopt-in flag.Fix: Only reject when
AllowSymlinksOnWindowsisnilorfalse.Bug 3:
handleRegenerateLibraryFilesignores the flag (api/health_handlers.go)The Regenerate Library Files handler hardcoded "symlinks not supported on Windows" regardless of the flag, blocking the feature even when explicitly enabled.
Fix: Check
AllowSymlinksOnWindowsbefore blocking symlink creation.Bonus:
AllowSymlinksOnWindowsmissing from API response (api/types.go)The field was not included in
ImportAPIResponse/ToImportAPIResponse, making it invisible in API responses and causing confusion about whether the config was loading correctly.Notes
os.Symlinkto succeed (Windows OS requirement)import_strategy: SYMLINK— confirmed working end-to-end after these fixesTest plan
import_strategy: SYMLINKandallow_symlinks_on_windows: trueon Windows with Developer Mode enabled — altmount should start without validation errorGET /api/configresponse includesallow_symlinks_on_windows: truein the import sectionallow_symlinks_on_windowsunset orfalsestill blocks SYMLINK on Windows with a clear error message