Repository navigation
Backport: Fix directory detection bug in Os::FileSystem::getPathType (#3727) - #5542
Conversation
…asa#3727) This backports nasa#3727 into v3.6.x. The existing commit applied nearly cleanly, with only a small touch-up done in getPathType() in Os/FileSystem.cpp Upstream commit message: * Fixing directory detection bug. * Removed some superfluous whitespace * Adding branch path for non-directory and non-file to return PathType::OTHER. Fixing a spelling mistake. * Moving getPathType to OS specific FileSystem implementations * Incorporating PR comments and cleaning up comments * Reverting unnecessary comment changes * Incorporating fixes for static analysis findings
lntutor
left a comment
There was a problem hiding this comment.
Reviewed exact head 1ea03c1 against upstream fix 20d1b54. The implementation-specific _getPathType delegation, POSIX lstat classification, stub plumbing, and focused tests are preserved; the remaining file-content differences are expected v3.6-era type/formatting context. In an isolated release/v3.6.0-hotfixes worktree, both touched targets compiled and CTest passed 2/2: StubFileSystemTest and PosixFileSystemTest. I generated with -DVALGRIND=/usr/bin/true to suppress the v3.6 root CMakeLists ASan injection, because macOS 26.5.2 hangs in ASan shadow-memory initialization before main; the unsanitized binaries ran normally. Non-blocking cleanup: git diff --check reports trailing whitespace on the blank lines at PosixFileSystemTests.cpp:59 and :62, inherited from the upstream patch.
This backports #3727 into v3.6.x.
The existing commit applied nearly cleanly, with only a small touch-up done in getPathType() in Os/FileSystem.cpp
Upstream commit message was:
Change Description
Several smaller commits were in the final merge commit upstream 20d1b54, which included the following list of fine-grained commits:
Fixing directory detection bug.
Removed some superfluous whitespace
Adding branch path for non-directory and non-file to return PathType::OTHER. Fixing a spelling mistake.
Moving getPathType to OS specific FileSystem implementations
Incorporating PR comments and cleaning up comments
Reverting unnecessary comment changes
Incorporating fixes for static analysis findings
Rationale
This fix is useful for an external project using release/3.6.0-hotfixes, and it applies with a trivially-resolved merge conflict.
Testing/Review Recommendations
I've tested these changes under Linux in the context of another project. The fix is also expected to work as they did when the upstream issue was worked.
Future Work
N/A
AI Usage (see policy)
N/A