GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Auto-port 4.1: Fix AsciiString.contains(...) false negatives after a partial match by netty-project-bot · Pull Request #17986 · netty/netty

Conversation

@netty-project-bot

@netty-project-bot netty-project-bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Auto-port of #17975 to 4.1
Cherry-picked commit: b7f1c9c


Motivation:

AsciiString.contains(CharSequence, CharSequence) and containsIgnoreCase(CharSequence, CharSequence) compare b with a one character at a time. When a character does not match after a partial match, they continue with the next character of a and start over with the first character of b, so a match that begins inside the partial match is missed: contains("aab", "ab") and contains("ababc", "abc") return false, as does containsIgnoreCase("xxYz", "xyz").

Netty does not call these methods itself, but they are public API and have behaved like this since they were added in 4.1.0.Beta7.

Modification:

Check every start position in a with regionMatchesCharSequences(...) and the same CharEqualityComparator. Add these cases to testContains.

Result:

contains(...) and containsIgnoreCase(...) return true whenever b occurs in a.

Before:

AsciiString.contains("aab", "ab") = false (String.contains: true)
AsciiString.contains("ababc", "abc") = false (String.contains: true)
AsciiString.contains("Mississippi", "issip") = false (String.contains: true)
AsciiString.containsIgnoreCase("xxYz", "xyz") = false

After:

AsciiString.contains("aab", "ab") = true (String.contains: true)
AsciiString.contains("ababc", "abc") = true (String.contains: true)
AsciiString.contains("Mississippi", "issip") = true (String.contains: true)
AsciiString.containsIgnoreCase("xxYz", "xyz") = true

I also compared both methods with String.contains(...) (on ASCII lower-cased input for containsIgnoreCase) for 1,000,000 random pairs over {a, b, A, B}, with a as String, StringBuilder and AsciiString: 9076 and 43016 differences before the change, none after.

The new assertions fail before the change. common tests pass.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@CCCLL @netty-project-bot
Fix AsciiString.contains(...) false negatives after a partial match (#…
4b3867a
…17975)

Motivation:

`AsciiString.contains(CharSequence, CharSequence)` and
`containsIgnoreCase(CharSequence, CharSequence)` compare `b` with `a`
one character at a time. When a character does not match after a partial
match, they continue with the next character of `a` and start over with
the first character of `b`, so a match that begins inside the partial
match is missed: `contains("aab", "ab")` and `contains("ababc", "abc")`
return `false`, as does `containsIgnoreCase("xxYz", "xyz")`.

Netty does not call these methods itself, but they are public API and
have behaved like this since they were added in 4.1.0.Beta7.

Modification:

Check every start position in `a` with `regionMatchesCharSequences(...)`
and the same `CharEqualityComparator`. Add these cases to
`testContains`.

Result:

`contains(...)` and `containsIgnoreCase(...)` return `true` whenever `b`
occurs in `a`.

(cherry picked from commit b7f1c9c)
@netty-project-bot netty-project-bot mentioned this pull request Oct 21, 2026
Fix AsciiString.contains(...) false negatives after a partial match #17975
Merged
@testlens-app

testlens-app Bot commented Oct 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🚨 TestLens detected 4 failed tests 🚨

Test Summary

Tip

Inspect all details with the TestLens CLI: testlens pr 17986

Build PR / macos-aarch64-java8-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo) ❌ 2% 🟡
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeMixedByteBuf(TestInfo) ❌ 3% 🟡
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) ❌ 3% 🟡

Build PR / macos-x86_64-java8-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueETSocketHalfClosedTest > testAutoCloseFalseDoesShutdownOutput(TestInfo) ❌ 1% 🟡

🏷️ Commit: 4b3867a
▶️ Tests: 53098 executed
⚪️ Checks: 19/19 completed

Test Failures

KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java8-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:352)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:184)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeHeapByteBuf(DatagramUnicastTest.java:135)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$4.run(DatagramUnicastTest.java:126)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$4.run(DatagramUnicastTest.java:123)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeHeapByteBuf(DatagramUnicastTest.java:123)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeMixedByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java8-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:352)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:184)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeMixedByteBuf(DatagramUnicastTest.java:157)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$5.run(DatagramUnicastTest.java:148)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$5.run(DatagramUnicastTest.java:145)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeMixedByteBuf(DatagramUnicastTest.java:145)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java8-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect0(DatagramUnicastTest.java:406)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:367)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:202)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$7.run(DatagramUnicastTest.java:196)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$7.run(DatagramUnicastTest.java:193)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:193)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
KQueueETSocketHalfClosedTest > testAutoCloseFalseDoesShutdownOutput(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java8-boringssl build)
java.util.concurrent.TimeoutException: testAutoCloseFalseDoesShutdownOutput(org.junit.jupiter.api.TestInfo) timed out after 20000 milliseconds
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	Suppressed: java.lang.InterruptedException
		at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1000)
		at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1308)
		at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest.testAutoCloseFalseDoesShutdownOutput(SocketHalfClosedTest.java:538)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest.testAutoCloseFalseDoesShutdownOutput(SocketHalfClosedTest.java:496)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest$13.run(SocketHalfClosedTest.java:487)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest$13.run(SocketHalfClosedTest.java:484)
		at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
		at io.netty.testsuite.transport.socket.SocketHalfClosedTest.testAutoCloseFalseDoesShutdownOutput(SocketHalfClosedTest.java:484)
		at java.lang.reflect.Method.invoke(Method.java:498)
		... 2 more

Rerun Controls

Select tests to mute in this pull request:

  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo)
  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeMixedByteBuf(TestInfo)
  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo)
  • KQueueETSocketHalfClosedTest > testAutoCloseFalseDoesShutdownOutput(TestInfo)

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer merged commit 5b54565 into 4.1 Oct 22, 2026
18 of 20 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer added this to the 4.1.140.Final milestone Oct 22, 2026
@normanmaurer
normanmaurer deleted the auto-port-pr-17975-to-4.1 branch October 22, 2026 05:25
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @CCCLL @lltopk
Auto-port 4.1: Fix AsciiString.contains(...) false negatives after a …
d4305a4
…partial match (netty#17986)

Auto-port of netty#17975 to 4.1
Cherry-picked commit: b7f1c9c

---
Motivation:

`AsciiString.contains(CharSequence, CharSequence)` and
`containsIgnoreCase(CharSequence, CharSequence)` compare `b` with `a`
one character at a time. When a character does not match after a partial
match, they continue with the next character of `a` and start over with
the first character of `b`, so a match that begins inside the partial
match is missed: `contains("aab", "ab")` and `contains("ababc", "abc")`
return `false`, as does `containsIgnoreCase("xxYz", "xyz")`.

Netty does not call these methods itself, but they are public API and
have behaved like this since they were added in 4.1.0.Beta7.

Modification:

Check every start position in `a` with `regionMatchesCharSequences(...)`
and the same `CharEqualityComparator`. Add these cases to
`testContains`.

Result:

`contains(...)` and `containsIgnoreCase(...)` return `true` whenever `b`
occurs in `a`.


Co-authored-by: CCCLL <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.1.140.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@netty-project-bot @normanmaurer @CCCLL
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.