Roll src/third_party/ced/src/ ba412eaaa..d127078ce (7 commits) [chromium/src : main]

0 views
Skip to first unread message

Jiewei Qian (Gerrit)

unread,
May 31, 2026, 8:48:27 PM (4 hours ago) May 31
to Archit Jain, Joey Scarr, Alejandro Rivera, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Alejandro Rivera, Archit Jain and Joey Scarr

Jiewei Qian added 1 comment

File third_party/ced/BUILD.gn
Line 10, Patchset 2 (Latest): if (is_linux || is_chromeos || is_android) {
defines = [ "HAVE_MEMRCHR" ]
}
Jiewei Qian . unresolved
Open in Gerrit

Related details

Attention is currently required from:
  • Alejandro Rivera
  • Archit Jain
  • Joey Scarr
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2ebbae7b109597c30218e4b1e71b3696b6d44590
Gerrit-Change-Number: 7882588
Gerrit-PatchSet: 2
Gerrit-Owner: Archit Jain <archi...@google.com>
Gerrit-Reviewer: Alejandro Rivera <aleja...@google.com>
Gerrit-Reviewer: Archit Jain <archi...@google.com>
Gerrit-Reviewer: Jiewei Qian <q...@chromium.org>
Gerrit-Reviewer: Joey Scarr <js...@google.com>
Gerrit-Attention: Joey Scarr <js...@google.com>
Gerrit-Attention: Archit Jain <archi...@google.com>
Gerrit-Attention: Alejandro Rivera <aleja...@google.com>
Gerrit-Comment-Date: Mon, 01 Jun 2026 00:47:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Archit Jain (Gerrit)

unread,
May 31, 2026, 10:43:42 PM (2 hours ago) May 31
to Joey Scarr, Jiewei Qian, Alejandro Rivera, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Alejandro Rivera, Jiewei Qian and Joey Scarr

Archit Jain added 1 comment

File third_party/ced/BUILD.gn
Line 10, Patchset 2: if (is_linux || is_chromeos || is_android) {
defines = [ "HAVE_MEMRCHR" ]
}
Jiewei Qian . unresolved

why this change?

---

I would expect https://github.com/google/compact_enc_det/blob/d127078cedef9c6642cbe592dacdd2292b50bb19/util/string_util.h#L44-L59 to handle this already

Archit Jain

As part of the CED (Compact Encoding Detection) library roll, a compilation failure was identified on several platforms (Android, Linux, ChromeOS) due to a conflict in the `memrchr` function definition. The root cause is a change in the upstream CED source that restricts the detection of the system-provided `memrchr` strictly to environments where `__GLIBC__` is defined. This incorrectly triggers a fallback implementation on platforms like Android (which uses Bionic) and Fuchsia (which uses a Musl-based libc), both of which provide `memrchr` but do not define `__GLIBC__`.

The following design document outlines the strategy to resolve this by utilizing GN build configurations to correctly signal the presence of `memrchr` to the CED library, thereby bypassing the problematic fallback and restoring a green build.

**§1. Problem Statement**
- **Core Problem**: The CED roll (`ba412eaaa`..`d127078ce`) introduced a regression where `memrchr` is redefined on non-GLIBC platforms that already provide it. This leads to compilation errors such as "functions that differ only in their return type cannot be overloaded" or "redefinition of 'memrchr'".
- **Primary Deliverable**: A modified `third_party/ced/BUILD.gn` that injects the `HAVE_MEMRCHR` preprocessor define for all affected Chromium platforms.
- **Scope Boundary**:
- **In Scope**: Fixing the build configuration for Android, Linux, ChromeOS, and Fuchsia.
- **Out of Scope**: Modifying the upstream CED source code (located in `src/third_party/ced/src`), which is restricted.

**§2. Terminology**
| Term | Definition |
| :--- | :--- |
| **CED** | Compact Encoding Detection; a library for identifying text encoding (e.g., UTF-8, Shift-JIS). |
| **memrchr** | A standard GNU extension function that searches for a character in a memory buffer from right to left. |
| **Bionic** | The C library used by the Android platform. |
| **HAVE_MEMRCHR** | A preprocessor macro used by many libraries (including CED) to indicate that the system provides a `memrchr` implementation. |

**§3. Requirements**
- **Functional Requirements**:
- Suppress CED's internal `memrchr` fallback on Android, Linux, ChromeOS, and Fuchsia.
- Ensure the fallback remains active for Windows, macOS, and iOS (where `memrchr` is not available).
- **Non-Functional Requirements**:
- **Testability**: The change must be verified via `ced_unittests`.
- **Maintainability**: The solution must avoid patching upstream source to simplify future rolls.

**§4. Contract Definitions and Interfaces**
The fix relies on the existing contract in `third_party/ced/src/util/string_util.h`, which checks for the `HAVE_MEMRCHR` macro before attempting to define a fallback. By providing this macro via the compiler command line (`-DHAVE_MEMRCHR`), we fulfill the contract and prevent the redefinition.

**§4.1 Error Handling and Recovery Matrix**
| Scenario | Impact | Recovery |
| :--- | :--- | :--- |
| `HAVE_MEMRCHR` missing on Android | Build fails with redefinition error. | Add `is_android` to the GN condition. |
| `HAVE_MEMRCHR` defined on Windows | Linker fails (missing symbol). | Ensure `is_win` is excluded from the condition. |
| Upstream changes macro name | Build fails with redefinition error. | Update GN to match the new macro name. |

**§5. Architecture Overview**
The solution uses GN's `config` mechanism to propagate the `HAVE_MEMRCHR` define. Since `string_util.h` is a public header within the `ced` target, the define is placed in a `public_config` to ensure all consumers of the library (like `base:i18n`) also see the correct state, preventing ODR (One Definition Rule) violations.

**§5.1 Interaction Sequence Diagram**
```text
+----------------+ +-------------------+ +-----------------------+
| GN Build Sys | ----> | ced_config (GN) | ----> | util/string_util.h |
+----------------+ +-------------------+ +-----------------------+
| | |
| [Evaluation] | |
| If Target OS in: | |
| {Android, Linux, | [Compile Step] |
| ChromeOS, Fuchsia} | |
| | Inject -DHAVE_MEMRCHR |
+-------------------------+ |
| |
| #ifndef HAVE_MEMRCHR |
| // Skipped! |
| #endif |
+------------------------------+
Open in Gerrit

Related details

Attention is currently required from:
  • Alejandro Rivera
  • Jiewei Qian
  • Joey Scarr
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2ebbae7b109597c30218e4b1e71b3696b6d44590
Gerrit-Change-Number: 7882588
Gerrit-PatchSet: 3
Gerrit-Owner: Archit Jain <archi...@google.com>
Gerrit-Reviewer: Alejandro Rivera <aleja...@google.com>
Gerrit-Reviewer: Archit Jain <archi...@google.com>
Gerrit-Reviewer: Jiewei Qian <q...@chromium.org>
Gerrit-Reviewer: Joey Scarr <js...@google.com>
Gerrit-Attention: Joey Scarr <js...@google.com>
Gerrit-Attention: Alejandro Rivera <aleja...@google.com>
Gerrit-Attention: Jiewei Qian <q...@chromium.org>
Gerrit-Comment-Date: Mon, 01 Jun 2026 02:43:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Jiewei Qian <q...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Archit Jain (Gerrit)

unread,
May 31, 2026, 10:43:57 PM (2 hours ago) May 31
to Joey Scarr, Jiewei Qian, Alejandro Rivera, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Alejandro Rivera, Jiewei Qian and Joey Scarr

Archit Jain added 1 comment

File third_party/ced/BUILD.gn
Line 10, Patchset 2: if (is_linux || is_chromeos || is_android) {
defines = [ "HAVE_MEMRCHR" ]
}
Jiewei Qian . resolved
Archit Jain

Marked as resolved.

Open in Gerrit

Related details

Attention is currently required from:
  • Alejandro Rivera
  • Jiewei Qian
  • Joey Scarr
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I2ebbae7b109597c30218e4b1e71b3696b6d44590
    Gerrit-Change-Number: 7882588
    Gerrit-PatchSet: 3
    Gerrit-Owner: Archit Jain <archi...@google.com>
    Gerrit-Reviewer: Alejandro Rivera <aleja...@google.com>
    Gerrit-Reviewer: Archit Jain <archi...@google.com>
    Gerrit-Reviewer: Jiewei Qian <q...@chromium.org>
    Gerrit-Reviewer: Joey Scarr <js...@google.com>
    Gerrit-Attention: Joey Scarr <js...@google.com>
    Gerrit-Attention: Alejandro Rivera <aleja...@google.com>
    Gerrit-Attention: Jiewei Qian <q...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Jun 2026 02:43:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Archit Jain <archi...@google.com>
    Comment-In-Reply-To: Jiewei Qian <q...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jiewei Qian (Gerrit)

    unread,
    May 31, 2026, 11:59:44 PM (1 hour ago) May 31
    to Archit Jain, Rachael Newitt, Joey Scarr, Alejandro Rivera, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Alejandro Rivera, Archit Jain, Joey Scarr and Rachael Newitt

    Jiewei Qian voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alejandro Rivera
    • Archit Jain
    • Joey Scarr
    • Rachael Newitt
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I2ebbae7b109597c30218e4b1e71b3696b6d44590
      Gerrit-Change-Number: 7882588
      Gerrit-PatchSet: 3
      Gerrit-Owner: Archit Jain <archi...@google.com>
      Gerrit-Reviewer: Alejandro Rivera <aleja...@google.com>
      Gerrit-Reviewer: Archit Jain <archi...@google.com>
      Gerrit-Reviewer: Jiewei Qian <q...@chromium.org>
      Gerrit-Reviewer: Joey Scarr <js...@google.com>
      Gerrit-Reviewer: Rachael Newitt <rene...@google.com>
      Gerrit-Attention: Joey Scarr <js...@google.com>
      Gerrit-Attention: Archit Jain <archi...@google.com>
      Gerrit-Attention: Rachael Newitt <rene...@google.com>
      Gerrit-Attention: Alejandro Rivera <aleja...@google.com>
      Gerrit-Comment-Date: Mon, 01 Jun 2026 03:59:19 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages