Skip to content

out_file: Replace SHCreateDirectoryExA to work for recursive directories correctly#10579

Merged
edsiper merged 4 commits intomasterfrom
cosmo0920-replace-SHCreateDirectoryExA-function-to-work-recursive-dirs-correctly
Jul 14, 2025
Merged

out_file: Replace SHCreateDirectoryExA to work for recursive directories correctly#10579
edsiper merged 4 commits intomasterfrom
cosmo0920-replace-SHCreateDirectoryExA-function-to-work-recursive-dirs-correctly

Conversation

@cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Jul 11, 2025

It's been a while this issue could be a long standing issue and avoding to use SHCreateDirectoryExA is a removing nonexisting API for Windows Nano Server.
This API is not listed in the supported API list here: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/mt588480(v=vs.85)

Related to #10255


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:

  • Example configuration file for the change
[INPUT]
  Name dummy
  Tag win.dummy

[OUTPUT]
  Name file
  Match *
  Path output_dir/in_dummy/deepened
  Mkdir True
  • Debug log output from testing the change
Fluent Bit v4.0.5
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___  _____
|  ___| |                | |   | ___ (_) |           /   ||  _  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| || |/' |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| ||  /| |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |\ |_/ /
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/


[2025/07/11 17:43:43] [ info] Configuration:
[2025/07/11 17:43:43] [ info]  flush time     | 1.000000 seconds
[2025/07/11 17:43:43] [ info]  grace          | 5 seconds
[2025/07/11 17:43:43] [ info]  daemon         | 0
[2025/07/11 17:43:43] [ info] ___________
[2025/07/11 17:43:43] [ info]  inputs:
[2025/07/11 17:43:43] [ info]      dummy
[2025/07/11 17:43:43] [ info] ___________
[2025/07/11 17:43:43] [ info]  filters:
[2025/07/11 17:43:43] [ info] ___________
[2025/07/11 17:43:43] [ info]  outputs:
[2025/07/11 17:43:43] [ info]      file.0
[2025/07/11 17:43:43] [ info] ___________
[2025/07/11 17:43:43] [ info]  collectors:
[2025/07/11 17:43:43] [ info] [fluent bit] version=4.0.5, commit=1af29e72ab, pid=54864
[2025/07/11 17:43:43] [debug] [engine] maxstdio set: 512
[2025/07/11 17:43:43] [debug] [engine] coroutine stack size: 98302 bytes (96.0K)
[2025/07/11 17:43:43] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/07/11 17:43:43] [ info] [simd    ] disabled
[2025/07/11 17:43:43] [ info] [cmetrics] version=1.0.4
[2025/07/11 17:43:43] [ info] [ctraces ] version=0.6.6
[2025/07/11 17:43:43] [ info] [input:dummy:dummy.0] initializing
[2025/07/11 17:43:43] [ info] [input:dummy:dummy.0] storage_strategy='memory' (memory only)
[2025/07/11 17:43:43] [debug] [dummy:dummy.0] created event channels: read=840 write=844
[2025/07/11 17:43:43] [debug] [file:file.0] created event channels: read=848 write=852
[2025/07/11 17:43:43] [ info] [sp] stream processor started
[2025/07/11 17:43:43] [ info] [output:file:file.0] worker #0 started
[2025/07/11 17:43:43] [ info] [engine] Shutdown Grace Period=5, Shutdown Input Grace Period=2
[2025/07/11 17:43:45] [debug] [task] created task=000001BDD75D6BC0 id=0 OK
[2025/07/11 17:43:45] [debug] [output:file:file.0] task_id=0 assigned to thread #0
[2025/07/11 17:43:45] [debug] [output:file:file.0] processing path 'output_dir\in_dummy\deepened'
[2025/07/11 17:43:45] [debug] [output:file:file.0] creating directory (recursive) output_dir\in_dummy
[2025/07/11 17:43:45] [debug] [output:file:file.0] processing path 'output_dir\in_dummy'
[2025/07/11 17:43:45] [debug] [output:file:file.0] creating directory (recursive) output_dir
[2025/07/11 17:43:45] [debug] [output:file:file.0] processing path 'output_dir'
[2025/07/11 17:43:45] [debug] [output:file:file.0] attempting to create final directory 'output_dir'
[2025/07/11 17:43:45] [debug] [output:file:file.0] attempting to create final directory 'output_dir\in_dummy'
[2025/07/11 17:43:45] [debug] [output:file:file.0] attempting to create final directory 'output_dir/in_dummy/deepened'
[2025/07/11 17:43:45] [debug] [out flush] cb_destroy coro_id=0
[2025/07/11 17:43:45] [debug] [task] destroy task=000001BDD75D6BC0 (task_id=0)
[2025/07/11 17:43:46] [debug] [task] created task=000001BDD75D6EE0 id=0 OK
[2025/07/11 17:43:46] [debug] [output:file:file.0] task_id=0 assigned to thread #0
[2025/07/11 17:43:46] [debug] [out flush] cb_destroy coro_id=1
[2025/07/11 17:43:46] [debug] [task] destroy task=000001BDD75D6EE0 (task_id=0)
[2025/07/11 17:43:47] [engine] caught signal (SIGINT)
[2025/07/11 17:43:47] [debug] [task] created task=000001BDD75D7200 id=0 OK
[2025/07/11 17:43:47] [debug] [output:file:file.0] task_id=0 assigned to thread #0
[2025/07/11 17:43:47] [debug] [out flush] cb_destroy coro_id=2
[2025/07/11 17:43:47] [debug] [task] destroy task=000001BDD75D7200 (task_id=0)
[2025/07/11 17:43:47] [debug] [task] created task=000001BDD75D6800 id=0 OK
[2025/07/11 17:43:47] [debug] [output:file:file.0] task_id=0 assigned to thread #0
[2025/07/11 17:43:47] [ warn] [engine] service will shutdown in max 5 seconds
[2025/07/11 17:43:47] [debug] [engine] retry=0000000000000000 for task 0 already scheduled to run, not re-scheduling it.
[2025/07/11 17:43:47] [ info] [input] pausing dummy.0
[2025/07/11 17:43:47] [debug] [out flush] cb_destroy coro_id=3
[2025/07/11 17:43:47] [debug] [task] destroy task=000001BDD75D6800 (task_id=0)
[2025/07/11 17:43:48] [ info] [engine] service has stopped (0 pending tasks)
[2025/07/11 17:43:48] [ info] [output:file:file.0] thread worker #0 stopping...
[2025/07/11 17:43:48] [ info] [input] pausing dummy.0
[2025/07/11 17:43:48] [ info] [output:file:file.0] thread worker #0 stopped
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

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.

…ies correctly

It's been a while this issue could be a long standing issue and avoding
to use SHCreateDirectoryExA is a removing nonexisting API for Windows
Nano Server.
This API is not listed in the supported API list here:
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/mt588480(v=vs.85)

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@edsiper edsiper merged commit c9f65ca into master Jul 14, 2025
53 checks passed
@edsiper edsiper deleted the cosmo0920-replace-SHCreateDirectoryExA-function-to-work-recursive-dirs-correctly branch July 14, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants