zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.02k stars 6.17k forks source link

posix: fnmatch: fix known bugs #55186

Open cfriedt opened 1 year ago

cfriedt commented 1 year ago

Describe the bug It appears as though the original fnmatch() implementation that was checked-in with 486b731b40717a16f619b07e5d58aaf7d5143e78 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:

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):

Additional context Noticed in the context of #55185

cfriedt commented 1 year ago

Changed to priority low, as these are not new bugs by any means, just newly discovered, and so any code that exists already in main is should continue to be stable even without an immediate fix.

github-actions[bot] commented 1 year ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

github-actions[bot] commented 10 months ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

github-actions[bot] commented 6 months ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

AbhinavMir commented 5 months ago

Hi! Are there any hints for what could be wrong? I see quite a few cases covered in rangematch, but it's pretty confusing looking at all the code. I will take a stab at this again later today.

cfriedt commented 5 months ago

Hi! Are there any hints for what could be wrong? I see quite a few cases covered in rangematch, but it's pretty confusing looking at all the code. I will take a stab at this again later today.

@AbhinavMir - There are just a few cases commented-out in the test suite.

https://github.com/zephyrproject-rtos/zephyr/blob/main/tests/posix/common/src/fnmatch.c

For this ticket, we would need to uncomment those cases and ensure that tests pass.

github-actions[bot] commented 3 months ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

github-actions[bot] commented 1 month ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.