Skip to content

posix: fnmatch: fix known bugs #55186

@cfriedt

Description

@cfriedt

Describe the bug
It appears as though the original fnmatch() implementation that was checked-in with 486b731 has bugs. This is not surprising since it was checked-in without any test coverage.

The actual failing cases are commented-out in tests/lib/posix/common/src/fnmatch.c (part of #55184)

Please also mention any information which could help others to understand
the problem you're facing:

  • What target platform are you using? N/A
  • What have you tried to diagnose or workaround this issue? Comment-out known failure modes in the test
  • Is this a regression? No, the bugs have always been present

To Reproduce
Steps to reproduce the behavior:

  1. Uncomment failure modes in tests/lib/posix/common/src/fnmatch.c
    2.west build -p auto -b qemu_cortex_a53 -t run tests/posix/common/
  2. See error

Expected behavior
All test cases should pass, including known failure modes.

Impact
The shell has been using a buggy version of fnmatch() since approximately 2018.

Logs and console output

*** Booting Zephyr OS build zephyr-v3.3.0-475-gec19849fec26 ***
Running TESTSUITE posix_apis
===================================================================
START - fnmatch

    Assertion failed at WEST_TOPDIR/zephyr/tests/posix/common/src/fnmatch.c:35: posix_apis_fnmatch: fnmatch("[[?*\\]", "\\", 0) is non-zero

 FAIL - fnmatch in 0.001 seconds
===================================================================

Environment (please complete the following information):

  • OS: Any
  • Toolchain (e.g Zephyr SDK, ...): Zephyr SDK v0.15.2
  • Commit SHA or Version used: b83cf1f but goes as far back as 486b731

Additional context
Noticed in the context of #55185

Metadata

Metadata

Assignees

Labels

Good first issueGood for a first time contributor to takearea: POSIXPOSIX API LibrarybugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions