Repository navigation
[backport 5.2] out_file: create parent directories with a loop - #12913
Conversation
Rework mkpath() to walk the path in a loop over a private copy: find the deepest existing parent, then create one level at a time. The three per-platform variants become a single implementation with small helpers for the separator and the create call. A directory created by another writer in the meantime is now accepted, and a trailing separator no longer counts as a level. Signed-off-by: Eduardo Silva <eduardo@chronosphere.io> (cherry picked from commit d1b4d0c) Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Check that out_file creates several missing directory levels below an existing parent when the configured path ends with a separator. Signed-off-by: Eduardo Silva <eduardo@chronosphere.io> (cherry picked from commit 2a29b50) Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Backport of #12909 to
5.2. Both commits cherry-pick cleanly with nochanges.
Scope
plugins/out_file/file.c:mkpath()is now a single implementation thatworks in a loop over a private copy of the path: it walks back to the
deepest directory that exists and then creates one level at a time. Two
small helpers hold the platform differences (path separator and the
create call).
tests/runtime/out_file.c: newmkdir_nestedcase covering severalmissing levels below an existing parent, with a trailing separator in
the configured path.
No configuration options change.
Compatibility notes
call is now accepted instead of reported as an error.
additional level.
\and/areaccepted as separators. This platform was not exercised locally; CI
covers it.
Testing
Linux x86_64, built from this branch:
ctest --test-dir build -R flb-rt-out_file --output-on-failureflb-rt-out_file,flb-rt-out_file_rotation)valgrind --leak-check=full ./build/bin/flb-rt-out_file mkdir mkdir_nestedpython -m pytest tests/integration/scenarios/out_file -qVALGRIND=1 VALGRIND_STRICT=1 python -m pytest tests/integration/scenarios/out_file -qin_httpandout_fileusingMkdir On: records written, clean shutdown.commit_prefix_check.pyover the PR range: passedFluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.