Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic_modules: use size_t for length of buffers #37357

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mathetake
Copy link
Member

@mathetake mathetake commented Nov 25, 2024

Commit Message: dynamic_modules: use size_t for length of buffers

Additional Description:
Previously, int was used for the length of buffer/string, which was
obviously a bug as its size is 16-bit and signed. size_t is usually
used for expressing the memory buffer by a pair of pointer and the length,
so this commit switches to use it.

Risk Level: n/a
Testing: done
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #37357 was opened by mathetake.

see: more, trace.

Signed-off-by: Takeshi Yoneda <[email protected]>
@mathetake
Copy link
Member Author

mathetake commented Nov 25, 2024

clang version 10.0.0-4ubuntu1 

@phlax I found in the test log that somewhere in the CI container we have a very old clang toolchain (10.0.0). can we identify and remove it? If we can put the /opt/llvm/bin/clang into PATH together with that would be helpful as well.

Signed-off-by: Takeshi Yoneda <[email protected]>
@mathetake mathetake changed the title wip - dynamic_modules: try using stddef dynamic_modules: use size_t for length of buffers Nov 25, 2024
Comment on lines +5 to +16
// This is Envoy CI specific: Check if "/opt/llvm/bin/clang" exists, and if it does, set the
// CLANG_PATH environment variable. CLANG_PATH is for clang-sys used by bindgen:
// https://github.com/KyleMayes/clang-sys?tab=readme-ov-file#environment-variables
//
// "/opt/llvm/bin/clang" exists in Envoy CI containers. If the clang doesn't exist there, bindgen
// will try to use the system clang from PATH. So, this doesn't affect the local builds.
// In any case, clang must be found to build the bindings.
//
// TODO: add /opt/llvm/bin to PATH in the CI containers. That would be a better solution.
if std::fs::metadata("/opt/llvm/bin/clang").is_ok() {
env::set_var("CLANG_PATH", "/opt/llvm/bin/clang");
}
Copy link
Member Author

@mathetake mathetake Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this is the only functional addition and others are formatting. This is needed otherwise bindgen will end up using the very old (i think some installation garbage in the past) clang and cannot find the stdlibs on RBE envs.

@mathetake mathetake marked this pull request as ready for review November 25, 2024 23:35
@mathetake
Copy link
Member Author

/retest

mathetake added a commit to mathetake/envoy that referenced this pull request Nov 26, 2024
Signed-off-by: Takeshi Yoneda <[email protected]>
@phlax
Copy link
Member

phlax commented Nov 26, 2024

... a very old clang toolchain (10.0.0). can we identify ...

im reasonably confident that is not the case with CI - it was until relatively recently with one of the wasm engines, but that has gone - ndk (for mobile/android) also brings its own toolchain but iirc not that old

could it be this?

$ git grep llvm-10
.bazelci/presubmit.yml:#     - "bazel/setup_clang.sh /usr/lib/llvm-10"

@phlax
Copy link
Member

phlax commented Nov 26, 2024

actually probably not - its commented out

@phlax
Copy link
Member

phlax commented Nov 26, 2024

re hardcoding PATH - this is problematic and the reason the setup_clang.sh pattern exists i believe - certainly the reason i didnt manage to get rid of it (yet)

@mathetake
Copy link
Member Author

yeah sorry nvm on the PATH stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants