Previously, the import path within the runfiles was only correct for the case `--legacy_external_runfiles=True` (which copied the runfiles into `$RUNFILES/<main repo>/external/<external repo>/<path>` in addition to `$RUNFILES/<external repo>/<path>`. This flag was flipped to False in Bazel 8.0.0.
This is identical to the change made to rules_python in https://github.com/bazelbuild/rules_python/pull/2516.
Work towards https://github.com/bazelbuild/rules_python/pull/2581.
PiperOrigin-RevId: 722690855
The sync callback is replaced with a single global injection point. We don't need it to exist per instance. It still needs to be injected to prevent a direct dependency from the parser into the reflection runtime.
The GetPrototype function is replaced with the prototype itself. We don't need a function to get the prototype when we can much more cheaply just store the prototype.
Also, move the check for GetMap/MutableMap to be inlined to avoid a regression in the table-driven parser.
PiperOrigin-RevId: 722656293
For historical reasons, our internal copy of the codebase uses
`proto2_unittest` while the open source one uses `protobuf_unittest`. This adds
a lot of friction to syncing between the two, and there's no great reason to
keep maintaining this difference, so let's just go with `proto2_unittest`.
PiperOrigin-RevId: 721951543
We use the address of a variable as the seed for upb's hash function, and this
allows us to get some randomness from ASLR.
The randomness is not perfect, especially since it won't necessarily help when
ASLR is not enabled. However, it seems to be enough to prevent unit tests from
relying on a deterministic map ordering.
PiperOrigin-RevId: 721950394
Enables bzlmod for most CI tests, except python (and thus upb) since infra for system python headers for python dist are not bzlmod compatible and require further work.
#test-continuous
PiperOrigin-RevId: 721946253
Debug output is unstable and redacts fields marked directly with debug_redact, and indirectly via options. This is a breaking change for anyone who depends on DebugString output to be stable and/or redacting.
See https://protobuf.dev/news/2024-12-04/
PiperOrigin-RevId: 721918779
unparser.cc, arenaz_sampler_test.cc, and message_module.cc included port_def.inc but forgot to include the undef file. This can cause some issues on which absl macros are defined:
In file included from
/opt/protobuf-29/include/google/protobuf/arena.h:36: In file included from
/opt/protobuf-29/include/google/protobuf/arena_align.h:63: /opt/protobuf-29/include/google/protobuf/port_def.inc:542:5: error: function-like macro 'ABSL_HAVE_FEATURE' is not defined \#if ABSL_HAVE_FEATURE(address_sanitizer)
Closes#20052
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/20052 from wilstoff:port_undef_fix 861d2e654f
PiperOrigin-RevId: 721863566
Found this bug where if `_ConvertFieldValuePair` fails while parsing an
Any from a dictionary value then the `@type` field gets removed from
the original object. Adding a simple `try/finally` to ensure we always
restore the original object.
Closes#20111
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/20111 from atulmerchia:fix-destructive-anyparser 58aea1911f
PiperOrigin-RevId: 721850901
In optimized builds, this test currently calls `__builtin_assume()` on a false
statement, which is undefined behavior that trips up ubsan. This change fixes
that by skipping the test case when `NDEBUG` is defined.
PiperOrigin-RevId: 721617118
I'm not sure why, but it seems that some tests are not running via Bazel. CI uses Bazel. So I think we should add those to test correctly.
Also, I fixed some tests to pass.
* Run memory tests against CRuby native implementation
* These tests are for CRuby native implementation. So this doesn't work with FFI and JRuby.
* Ref: https://github.com/protocolbuffers/protobuf/pull/15840/
* Run service options extension test against CRuby native implementation
* It seems that JRuby doesn't support this so far.
* And, service options are frozen objects. But, in CRuby FFI, can't get a Message instance if the message is frozen. So this doesn't work.
* d406cae013/ruby/lib/google/protobuf/ffi/message.rb (L419)
* So the service options extension test only passes in CRuby native.
Closes#19870
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/19870 from y-yagi:add_some_missing_tests d51158def9
PiperOrigin-RevId: 721603213
This silences a javac lint:
```
java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java:28: warning: [dep-ann] deprecated item is not annotated with @Deprecated
public class RepeatedFieldBuilderV3<
^
```
Closes#20030
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/20030 from benjaminp:dep-ann 183fb200ce
PiperOrigin-RevId: 721207574
Historically this was tracked on the fields, but the state is
now always on the enum descriptor. Update to ensure the two trackings
match, but move the functionality over to use the info from the
descriptor so the field part can eventually be mored.
PiperOrigin-RevId: 721012133
- Potential warnings related to sign conversions.
- Potential warnings around implicit 64/32 bit issues.
- Unneeded conversions.
PiperOrigin-RevId: 721000930
An opt-out flag `--define=protobuf_allow_msvc=true` will be available until our 2026 breaking release 34.0. See https://github.com/protocolbuffers/protobuf/issues/20085 for more details.
#test-continuous
PiperOrigin-RevId: 720822739
- Switch our MSAN tests to use Memory instead of MemoryWithOrigins
- Enable minimal (-O1) optimizations for all sanitized builds
The new optimization shook loose some ODR issues we've hit before due to the cyclic dependency of cc_proto_library. This will fix itself once we finish taking over the rule, and shouldn't affect users. It can be worked around by forcing static linkage in sanitized builds.
#test-continuous
PiperOrigin-RevId: 720686491
When generating skipmaps, the parse function generator keeps track of a
"line_entries" variable that's mostly introduced to condense line wrapping in
some cases where the number of entries is small. This does make the generated
code a bit shorter but it's also keeping track of a lot of state that hinders
readability. It's been raised in a separate CL review that maybe all this
additional complexity is not worth it. We can deal with a few extra generated
lines in the codegen.
PiperOrigin-RevId: 720671921
In particular, reworked `MapFieldAccessor` to be a minimalistic subclass of `RepeatedPtrFieldMessageAccessor`, with only 2 overrides of transitive virtual APIs inherited from `RepeatedPtrFieldWrapper<>`.
PiperOrigin-RevId: 720647073