fix(plugin): Use UTF-8 paths on Windows#2841
fix(plugin): Use UTF-8 paths on Windows#2841geraldcombs wants to merge 2 commits intofalcosecurity:masterfrom
Conversation
|
Please double check driver/SCHEMA_VERSION file. See versioning. /hold |
|
Tested locally by placing a plugin in a directory named "fptest-😀" and loading a capture using sinsp-example. |
Perf diff from master - unit testsHeap diff from master - unit testsHeap diff from master - scap fileBenchmarks diff from master |
db51e72 to
4a61592
Compare
4a61592 to
e160589
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2841 +/- ##
=======================================
Coverage 75.38% 75.38%
=======================================
Files 295 295
Lines 31306 31306
Branches 4898 4898
=======================================
Hits 23601 23601
Misses 7705 7705
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
ping @geraldcombs some formatting changes still required. ping @ekoops, I'm not sure what is going wrong with a few driver tests: 404? |
I fixed them on the mainline. If @geraldcombs rebases, they will go away. |
e160589 to
e3e115b
Compare
|
I rebased and pushed from an environment that has clang-format installed. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: geraldcombs, terror96 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hey @geraldcombs , any update on this? |
e3e115b to
62669ee
Compare
userspace/libsinsp/examples/test.cpp
Outdated
| char** utf8_argv = nullptr; | ||
|
|
||
| if(utf16_argv && utf16_argc == argc) { | ||
| utf8_argv = (char**)malloc((argc + 1) * sizeof(char*)); |
There was a problem hiding this comment.
Also this can fail. We should add a check on the returned value here.
userspace/libsinsp/examples/test.cpp
Outdated
|
|
||
| #ifdef _WIN32 | ||
| if(utf8_argv) { | ||
| free(utf8_argv); |
There was a problem hiding this comment.
... and here... At this point, it's better to have a separate function that check that utf8_argv is not NULL and free each of its elements
There was a problem hiding this comment.
Related to this: I did not find a way to cleanly comment lines that were not part of this PR when I noticed a few missing free operations: #2872.
|
Why is test-drivers-arm64 failing? |
Suppress
C:\path\to\driver\ppm_events_public.h(2304,23): warning C4200: nonstandard extension used: zero-sized array in struct/union
Signed-off-by: Gerald Combs <[email protected]>
62669ee to
9f61775
Compare
Document that plugin paths should be UTF-8 on Windows, and convert them to UTF-16 internally. In sinsp-example, add an application manifest that sets activeCodePage to UTF-8 on Windows. Signed-off-by: Gerald Combs <[email protected]>
9f61775 to
56cd265
Compare
What type of PR is this?
/kind bug
/kind cleanup
Any specific area of the project related to this PR?
/area libscap
Does this PR require a change in the driver versions?
What this PR does / why we need it:
This ensures that we can load plugins on Windows independent of the system code page. It adds a requirement that plugin paths on Windows be encoded as UTF-8.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: