Repository navigation
logging: Use the default file mode for dir_mode from_file - #8225
Merged
steadytao merged 1 commit intoOct 16, 2026
Merged
Conversation
Without a mode, from_file derived the directory permissions from 0, so directories were created as 0200 and opening the log file failed with permission denied. Use 0600, the mode the file is created with.
This was referenced Nov 3, 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 #8224
With
dir_mode from_fileand nomode, directory permissions were derived from 0, so missing directories were created as0200and opening the log file failed with "permission denied". In that case the file is created with 0600, so the directories now derive from that and get0700.Test:
TestDirMode_FromFilegets a third case withoutModethat expects0700. Without the change it fails withopen .../logs3/app.log: permission denied.go test ./...passes.Manual check with the config from the issue: v2.11.7 fails to start and leaves a
d-w-------directory; with the change Caddy starts, the directory isdrwx------and requests are logged.Assistance Disclosure
AI used (Claude Code).