add fileSystemType - #331
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #331 +/- ##
===========================================
+ Coverage 67.58% 67.64% +0.05%
===========================================
Files 1182 1183 +1
Lines 61862 62123 +261
Branches 4675 4680 +5
===========================================
+ Hits 41810 42021 +211
- Misses 20052 20102 +50 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The new fileSystemType() implementation/test behaviour is inconsistent across supported platforms (notably FreeBSD/unsupported OS paths) and can lead to failing tests or silent “unknown” results where an error is expected.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a new fileSystemType() query to LocalPathName/PathName (plumbed through BasePathName/BasePathNameT) and introduces tests to validate the returned filesystem type and error behaviour.
Changes:
- Add
fileSystemType()to thePathName/LocalPathNamepublic APIs and propagate it through theBasePathNamepolymorphic layer. - Implement
LocalPathName::fileSystemType()usingstatfs()(Linux magic-to-name mapping; macOS viaf_fstypename). - Add/adjust filesystem tests and update a filesystem test fake to include the new method.
File summaries
| File | Description |
|---|---|
| tests/filesystem/test_localpathname.cc | Adds a test case for fileSystemType() behaviour and error handling. |
| tests/filesystem/test_filespace_strategies.cc | Updates FakeFileSystem with a stub fileSystemType() to satisfy the new API surface. |
| src/eckit/filesystem/PathName.h | Declares PathName::fileSystemType() with documentation. |
| src/eckit/filesystem/PathName.cc | Implements PathName::fileSystemType() by delegating to the underlying BasePathName. |
| src/eckit/filesystem/LocalPathName.h | Declares LocalPathName::fileSystemType() with documentation. |
| src/eckit/filesystem/LocalPathName.cc | Implements LocalPathName::fileSystemType() via statfs() and adds Linux filesystem magic mapping. |
| src/eckit/filesystem/BasePathName.h | Extends the BasePathName interface with pure-virtual fileSystemType(). |
| src/eckit/filesystem/BasePathNameT.h | Adds the fileSystemType() override to BasePathNameT. |
| src/eckit/filesystem/BasePathNameT.cc | Implements BasePathNameT<T>::fileSystemType() by delegating to T. |
Review details
Suppressed comments (2)
src/eckit/filesystem/LocalPathName.cc:940
- fileSystemType() currently only calls statfs() on Linux/macOS. On FreeBSD this will fall through to the unsupported-platform branch even though statfs() is available, and the new test would fail there. Consider enabling the statfs() implementation for FreeBSD as well.
#if defined(__linux__) || defined(__APPLE__)
src/eckit/filesystem/LocalPathName.cc:965
- On unsupported platforms this returns the literal string "unknown", which contradicts the header contract (documents an error) and makes missing/invalid paths silently succeed. It should fail explicitly (e.g. NotImplemented) when the filesystem cannot be interrogated on this platform.
#else
return "unknown";
#endif
- Files reviewed: 9/9 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
improve fileSystemType improve test fileSystemType test real nfs if found
4d1e8b2 to
74b90ce
Compare
Description
Contributor Declaration
By opening this pull request, I affirm the following:
🌦️ >> Documentation << 🌦️
https://sites.ecmwf.int/docs/dev-section/eckit/pull-requests/PR-331