Conversation
WalkthroughReplaces Windows directory creation with a custom recursive implementation, changes directory-checking to use GetFileAttributesA, and removes the Shlwapi.lib link dependency. No public API changes or non-Windows behavior modifications. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant cio_os as cio_os_mkpath (Windows)
participant FS as Windows FS APIs
Caller->>cio_os: mkpath(path)
cio_os->>cio_os: _fullpath(path)
alt _fullpath fails
cio_os-->>Caller: return 1
else success
loop per path segment
cio_os->>FS: CreateDirectoryA(partial)
alt ERROR_ALREADY_EXISTS
Note right of FS: continue
else on error
cio_os-->>Caller: return 1
end
end
cio_os-->>Caller: return 0
end
sequenceDiagram
autonumber
actor Client
participant dirent as opendir (Windows)
participant FS as GetFileAttributesA
Client->>dirent: opendir(path)
dirent->>FS: GetFileAttributesA(path)
alt attributes invalid or not directory
dirent-->>Client: return NULL
else is directory
dirent-->>Client: proceed with enumeration
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
lib/chunkio/src/CMakeLists.txt (1)
26-26: Drop unnecessary Shell32.lib in chunkioNo Shell32-dependent APIs remain in
lib/chunkio, so it’s safe to remove the Windows link. Update lib/chunkio/src/CMakeLists.txt:@@ lib/chunkio/src/CMakeLists.txt - set(libs - ${libs} - Shell32.lib) + set(libs + ${libs} + )Optionally, you can also clean up now-unused headers in
lib/chunkio/src/cio_os.c(e.g. remove the#include <Shlobj.h>if no Shell APIs are called).lib/chunkio/src/win32/dirent.c (1)
77-95: Make path_is_directory file-local and add a minimal guardThis helper isn’t used outside this file; give it internal linkage and defensively handle NULL/empty input.
-BOOL path_is_directory(LPCSTR pszPath) { +static BOOL path_is_directory(LPCSTR pszPath) { + if (pszPath == NULL || *pszPath == '\0') { + return FALSE; + } DWORD dwAttrib = GetFileAttributesA(pszPath); if (dwAttrib == INVALID_FILE_ATTRIBUTES) { return FALSE; } if (dwAttrib & FILE_ATTRIBUTE_DIRECTORY) { return TRUE; } return FALSE; }lib/chunkio/src/cio_os.c (2)
127-130: Prefer explicit 0/1 check over ERROR_SUCCESScio_os_win32_make_recursive_path returns 0/1, not Win32 error codes. Comparing against ERROR_SUCCESS is misleading. Use != 0.
- if (cio_os_win32_make_recursive_path(path) != ERROR_SUCCESS) { + if (cio_os_win32_make_recursive_path(path) != 0) { return 1; }
52-90: Follow-up: You can also drop Shlobj.h include nowSince SHCreateDirectoryExA is no longer used, <Shlobj.h> can be removed to avoid implying a Shell32 dependency.
Proposed change outside the edited hunk (do this if the repo-wide search confirms no Shell32 usage):
C code (outside this hunk):
#ifdef _WIN32 -#include <Shlobj.h> #endif
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
lib/chunkio/src/CMakeLists.txt(1 hunks)lib/chunkio/src/cio_os.c(2 hunks)lib/chunkio/src/win32/dirent.c(1 hunks)
🔇 Additional comments (1)
lib/chunkio/src/win32/dirent.c (1)
100-102: LGTM: Replacing PathIsDirectoryA with GetFileAttributesA-based checkEarly return when not a directory keeps behavior clear and removes Shlwapi dependency.
|
This PR itself would be good because merged patch is sent as a PR but coderabbitai suggested more rigid approach of this issue. So, I just converted this PR as a draft and will revisit after the fluent/chunkio#110 patch is merged into chunkio upstream. |
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
9326119 to
2e353ee
Compare
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
T eliminate Shlwapi.lib dependency, we need to sync the current revision of chunkio from its upstream.
Backporting
Fluent 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.
Summary by CodeRabbit
Bug Fixes
Chores