• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

c-ares / c-ares / 29194961879
90%

Build:
DEFAULT BRANCH: main
Ran 12 Jul 2026 01:52PM UTC
Jobs 1
Files 177
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Jul 2026 01:44PM UTC coverage: 90.146% (+0.06%) from 90.083%
29194961879

push

github

web-flow
ares_hosts_file: store /etc/hosts as a bipartite adjacency (fixes #1049) (#1233)

Fixes #1049.

## Problem
`/etc/hosts` entries were merged into a single record whenever they were
transitively connected through a shared address, and lookups returned
that record's **union**. Two failure modes:
1. **Leak:** a forward lookup returned addresses belonging to
*unrelated* hostnames that merely shared an address (the reported
symptom — `mullvad-no-svg` returned `mullvad-no-osl`'s addresses).
2. **Dropped "bridge" lines:** a line whose address already belonged to
one entry and whose hostname to another was discarded entirely by the
merge's first-match-wins rule, silently losing that address (the
reporter's fallback `10.64.0.1 mullvad-no-svg` never applied).

## Approach: bipartite adjacency
The data is a set of `(hostname, address)` edges, one per line-token.
Store them directly and index both ways:
- `hosthash`: hostname → list of its addresses (file order)
- `iphash`: address → list of its hostnames (file order)

A lookup builds a correctly-scoped result on demand — forward returns
the queried name's **own** addresses plus **address-scoped** aliases
(names sharing one of those addresses); reverse returns the queried
address and its own hostnames. This is **correct by construction**:
bridges, chains, cross-family merges, and reverse lookups all resolve
the way glibc's `multi on` does, with no merging, filtering, or dropped
lines. `to_addrinfo`/`to_hostent` go back to simple consumers.

> **Note:** an earlier revision of this PR kept the merged store and
filtered results at lookup time to save memory. Review found that
approach could not represent bridge lines (it inherited the merge's drop
behavior), leaving #1049 only ~90% fixed. This revision replaces it with
the bipartite model, which fully fixes it.

## Memory
This is done in two commits so the second can be dropped independently:
1. **the bipartite model** (correctness), and
2. **cached lookup entries** ... (continued)

243 of 245 new or added lines in 5 files covered. (99.18%)

16 existing lines in 5 files now uncovered.

25330 of 28099 relevant lines covered (90.15%)

24327.35 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
95.23
1.62% src/lib/ares_hosts_file.c

Coverage Regressions

Lines Coverage ∆ File
7
81.65
-1.9% src/lib/dsa/ares_llist.c
5
82.02
-5.62% src/lib/dsa/ares_htable_strvp.c
2
97.75
0.56% src/lib/dsa/ares_htable.c
1
95.62
-0.4% src/lib/ares_init.c
1
68.41
-0.11% src/lib/record/ares_dns_mapping.c
Jobs
ID Job ID Ran Files Coverage
1 29194961879.1 12 Jul 2026 01:52PM UTC 177
90.15
GitHub Action Run
Source Files on build 29194961879
  • Tree
  • List 177
  • Changed 12
  • Source Changed 5
  • Coverage Changed 12
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #29194961879
  • 589b5887 on github
  • Prev Build on main (#28942451702)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc