fix: handle null results in get_dir_file_info()#10407
Conversation
|
One question - do you not know how to perform On the topic of PR: after reading the directory, can there be a cache in the file system? Take a look at |
michalsn
left a comment
There was a problem hiding this comment.
Adding clearstatcache() would not solve the race because the file could disappear immediately afterward. More importantly, this fixes a deterministic bug: with $topLevelOnly = true, directories produce incomplete entries containing only relative_path.
We need a test, a changelog entry, and a small update to the PR description.
|
Those older commits were from accidentally staging files to the wrong branch, which led to me creating and then closing a few incorrect PRs. Sorry for the confusion — the current PR #10407 only contains the two relevant commits (fix + test). |
fb86f72 to
18bdafb
Compare
michalsn
left a comment
There was a problem hiding this comment.
Please add a changelog entry.
0b73567 to
126dca2
Compare
126dca2 to
ff52364
Compare
|
The changelog entry seems to be removed. |
michalsn
left a comment
There was a problem hiding this comment.
The test added earlier is now missing.
| ********** | ||
|
|
||
| - **Content Security Policy:** Fixed a bug where empty ``Content-Security-Policy``, ``Content-Security-Policy-Report-Only``, and ``Reporting-Endpoints`` response headers were generated when no corresponding values existed. | ||
| - **Helpers:** Fixed a bug where ``get_dir_file_info()`` could cause a null pointer error when ``get_file_info()`` returns null. |
There was a problem hiding this comment.
| - **Helpers:** Fixed a bug where ``get_dir_file_info()`` could cause a null pointer error when ``get_file_info()`` returns null. | |
| - **Helpers:** Fixed a bug where ``get_dir_file_info()`` returned incomplete entries for subdirectories and missing files instead of omitting them. |
There was a problem hiding this comment.
The changelog entry is not accurate: "null pointer error"? Please change it as suggested.
904fc28 to
1431f85
Compare
Description
Add null check in
get_dir_file_info()for whenget_file_info()returnsnull(race condition: file deleted afterreaddir()but beforeget_file_info()). This prevents broken entries and fixes random test failures inCommands. Includes unit test.Ref: #9968
Checklist: