Skip to content

cfg-lexer: fix handling of glob return values on musl #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

bazsi
Copy link
Member

@bazsi bazsi commented Aug 29, 2024

In case an error happens during glob(), glibc returns GLOB_NOMATCH while musl returns GLOB_ABORTED. Handle both properly.

In case an error happens during glob(), glibc returns GLOB_NOMATCH while
musl returns GLOB_ABORTED. Handle both properly.

Signed-off-by: Balazs Scheidler <[email protected]>
@bazsi
Copy link
Member Author

bazsi commented Aug 29, 2024

One additional context: glibc seems to ignore ENOTDIR errors, while musl does not. So to trigger the issue, one needs to

@include "foo/*/*.conf"

and then place a symlink to "foo/" that points to an existing file. In this case, glob finds the symlink, tries to use it as a directory, fails with ENOTDIR. On musl, this calls the glob error callback and prints:

Error processing path for inclusion; path='/etc/syslog-ng/foo/symlink/', errno='Not a directory (20)'

and then returns GLOB_ABORTED.

Our wrapper function was incorrectly returning success in this case, without the include file list being populated and then it crashes.

@MrAnno MrAnno merged commit a7869ba into axoflow:main Aug 29, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants