fix: set HOME from user config for sync and log path resolution#247
Merged
Conversation
The sync watcher and log file path were resolved using $HOME which defaults to /root in the container. This caused: - Sync watcher monitoring /root/.config/kilo/ instead of the user's config directory, missing new file events - Log entries written to /root/.config/kilo-docker/logs/ instead of the user's log file Fix by loading user config and setting HOME before the first Log() call in main(), and in ensureSyncForCurrentUser() before starting the sync process. Refs #245, #246
|
🎉 This PR is included in version 3.49.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
/root/.config/kilo-docker/logs/instead of the user's log fileProblem
The container runs as root with
HOME=/root. Two code paths usedconstants.GetHomeDir()(which reads$HOME) before the user's home directory was set:Sync watcher (
ensureSyncForCurrentUser) — spawnedkilo-entrypoint syncas root withHOME=/root, causing the watcher to monitor/root/.config/kilo/rules/instead of/home/kd-<hash>/.config/kilo/rules/. New files were never detected.Log path (
getLogFile) — initialized on firstLog()call atmain.go:476, beforerunUserInitset HOME. All entrypoint logs went to/root/.config/kilo-docker/logs/kilo-docker.loginstead of the user's log file.Solution
main(): load user config vialoadUserConfig()and setHOMEbefore the first log callensureSyncForCurrentUser(): setHOMEbefore callingstartSyncWithTokens()Both match the existing pattern in
runUserInit()at line 314.Changes
cmd/kilo-entrypoint/main.go— Set HOME from user config at program startcmd/kilo-entrypoint/userinit.go— Set HOME inensureSyncForCurrentUserTesting
HOME=/home/kd-8647b8environmentRelated