Skip to content

dns: address compile-time warnings#64355

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
aduh95:dns-c-ares-warnings
Jul 10, 2026
Merged

dns: address compile-time warnings#64355
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
aduh95:dns-c-ares-warnings

Conversation

@aduh95

@aduh95 aduh95 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
../../src/cares_wrap.cc:227:16: warning: 'ares_parse_a_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  227 |       status = ares_parse_a_reply(buf,
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1098:14: note: 'ares_parse_a_reply' has been explicitly marked deprecated here
 1098 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_a_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:234:16: warning: 'ares_parse_aaaa_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  234 |       status = ares_parse_aaaa_reply(buf,
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1102:14: note: 'ares_parse_aaaa_reply' has been explicitly marked deprecated here
 1102 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_aaaa_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:241:16: warning: 'ares_parse_ns_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  241 |       status = ares_parse_ns_reply(buf, len, &host);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1113:14: note: 'ares_parse_ns_reply' has been explicitly marked deprecated here
 1113 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_ns_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:244:16: warning: 'ares_parse_ptr_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  244 |       status = ares_parse_ptr_reply(buf, len, nullptr, 0, AF_INET, &host);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1109:14: note: 'ares_parse_ptr_reply' has been explicitly marked deprecated here
 1109 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_ptr_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:320:16: warning: 'ares_parse_mx_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  320 |   int status = ares_parse_mx_reply(buf, len, &mx_start);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1119:14: note: 'ares_parse_mx_reply' has been explicitly marked deprecated here
 1119 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_mx_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:366:16: warning: 'ares_parse_caa_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  366 |   int status = ares_parse_caa_reply(buf, len, &caa_start);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1106:14: note: 'ares_parse_caa_reply' has been explicitly marked deprecated here
 1106 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_caa_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:494:16: warning: 'ares_parse_txt_reply_ext' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  494 |   int status = ares_parse_txt_reply_ext(buf, len, &txt_out);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1125:14: note: 'ares_parse_txt_reply_ext' has been explicitly marked deprecated here
 1125 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_txt_reply_ext(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:581:16: warning: 'ares_parse_srv_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  581 |   int status = ares_parse_srv_reply(buf, len, &srv_start);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1116:14: note: 'ares_parse_srv_reply' has been explicitly marked deprecated here
 1116 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_srv_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:636:16: warning: 'ares_parse_naptr_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  636 |   int status = ares_parse_naptr_reply(buf, len, &naptr_start);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1128:14: note: 'ares_parse_naptr_reply' has been explicitly marked deprecated here
 1128 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_naptr_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:984:3: warning: 'ares_get_servers_ports' is deprecated: Use ares_get_servers_csv instead [-Wdeprecated-declarations]
  984 |   ares_get_servers_ports(channel_, &servers);
      |   ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1187:1: note: 'ares_get_servers_ports' has been explicitly marked deprecated here
 1187 | CARES_DEPRECATED_FOR(ares_get_servers_csv)
      | ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:1688:16: warning: 'ares_parse_soa_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
 1688 |   int status = ares_parse_soa_reply(buf, len, &soa_out);
      |                ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1131:14: note: 'ares_parse_soa_reply' has been explicitly marked deprecated here
 1131 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_soa_reply(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^

The 2 remaining warnings are ares_set_servers / ares_set_servers_ports in setServers(), which IIUC would require a breaking change to address.

N.B.: this is mostly vibe-coded

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. needs-ci PRs that need a full CI run. labels Jul 8, 2026
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.68641% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.24%. Comparing base (1d87a24) to head (71e5a4b).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
src/cares_wrap.cc 69.68% 47 Missing and 40 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64355      +/-   ##
==========================================
- Coverage   90.25%   90.24%   -0.02%     
==========================================
  Files         741      741              
  Lines      240990   241113     +123     
  Branches    45402    45441      +39     
==========================================
+ Hits       217502   217587      +85     
- Misses      15066    15067       +1     
- Partials     8422     8459      +37     
Files with missing lines Coverage Δ
src/cares_wrap.cc 62.91% <69.68%> (+1.26%) ⬆️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 8, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 10, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/64355
✔  Done loading data for nodejs/node/pull/64355
----------------------------------- PR info ------------------------------------
Title      dns: address compile-time warnings (#64355)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     aduh95:dns-c-ares-warnings -> nodejs:main
Labels     c++, cares, author ready, needs-ci
Commits    2
 - dns: address compile-time warnings
 - squash! format-cpp
Committers 1
 - Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64355
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/64355
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 08 Jul 2026 10:49:29 GMT
   ✔  Approvals: 3
   ✔  - Yagiz Nizipli (@anonrig) (TSC): https://github.com/nodejs/node/pull/64355#pullrequestreview-4655080157
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/64355#pullrequestreview-4657048517
   ✔  - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/64355#pullrequestreview-4663743030
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-07-08T17:40:03Z: https://ci.nodejs.org/job/node-test-pull-request/74673/
- Querying data for job/node-test-pull-request/74673/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 64355
From https://github.com/nodejs/node
 * branch                  refs/pull/64355/merge -> FETCH_HEAD
✔  Fetched commits as 4140d4c2c8ed..71e5a4bf7579
--------------------------------------------------------------------------------
[main 5615ca05ff] dns: address compile-time warnings
 Author: Antoine du Hamel <duhamelantoine1995@gmail.com>
 Date: Wed Jul 8 12:38:11 2026 +0200
 1 file changed, 350 insertions(+), 223 deletions(-)
[main 56e2d0c7ce] squash! format-cpp
 Author: Antoine du Hamel <duhamelantoine1995@gmail.com>
 Date: Wed Jul 8 14:47:32 2026 +0200
 1 file changed, 17 insertions(+), 24 deletions(-)
   ✔  Patches applied
Please run the following commands to complete landing

$ git rebase origin/main --no-keep-empty -i -x "git node land --amend" --autosquash
$ git node land --continue

https://github.com/nodejs/node/actions/runs/29089975276

@richardlau richardlau added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jul 10, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 10, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 116302d into nodejs:main Jul 10, 2026
87 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 116302d

@davidje13

Copy link
Copy Markdown
Contributor

Hi, it looks like this PR might have broken the test-internet pipeline (which only runs if certain files have been changed, but cares_wrap.cc is not one of them).

I only say that because this PR and the failure both relate to DNS, and this was merged between the last successful run and the first unsuccessful run of the pipeline. This PR also makes several references to ENODATA, which is the error message that's now appearing. I haven't checked through to identify an exact cause though. At a guess: something that previously could return an empty entity is now returning ENODATA instead.

The new error is:

=== release test-dns-txt-sigsegv ===
Path: internet/test-dns-txt-sigsegv
node:internal/assert/utils:146
  throw error;
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ Error: queryTxt ENODATA www.microsoft.com
+     at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/callback_resolver:45:19) {
+   code: 'ENODATA',
+   errno: undefined,
+   hostname: 'www.microsoft.com',
+   syscall: 'queryTxt'
+ }
- null

    at QueryReqWrap.<anonymous> (/home/runner/work/node/node/test/internet/test-dns-txt-sigsegv.js:13:10)
    at QueryReqWrap.callback (/home/runner/work/node/node/test/common/index.js:510:15)
    at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/callback_resolver:45:10) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: Error: queryTxt ENODATA www.microsoft.com
      at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/callback_resolver:45:19) {
    errno: undefined,
    code: 'ENODATA',
    syscall: 'queryTxt',
    hostname: 'www.microsoft.com'
  },
  expected: null,
  operator: 'strictEqual',
  diff: 'simple'
}

The failing test was added in #960, and is checking behaviour when reading TXT DNS entries for a domain which doesn't have any.

@davidje13

davidje13 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

I did some experiments with the state before this PR and found:

  • If a domain is resolved which has none of the requested records, and no CNAME, the old code would return ENODATA.
  • If a domain is resolved which has none of the requested records, but does have a CNAME which points to another domain that has none of the requested records, the old code would return an empty array.

The new code returns ENODATA in both cases.

The easiest way to check this for yourself is to run:

const dns = require('node:dns/promises');
await dns.resolveTxt('www.microsoft.com');

In the currently released versions of Node.js, it returns []. With these changes, it throws ENODATA.

It seems reasonable that these two behaviours should be made consistent, but it is still a user-facing change which perhaps needs to be considered semver major? (ping @aduh95 @jasnell @anonrig @cjihrig)

I have created #64624 to codify these behaviours in the tests (and fix the current failing test by updating it to match the new behaviour), and ensure they run if this file is changed in the future.

aduh95 added a commit that referenced this pull request Jul 21, 2026
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: #64355
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@aduh95
aduh95 deleted the dns-c-ares-warnings branch July 21, 2026 16:59
@aduh95 aduh95 added dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. dont-land-on-v26.x PRs that should not land on the v26.x-staging branch and should not be released in v26.x. labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. dont-land-on-v26.x PRs that should not land on the v26.x-staging branch and should not be released in v26.x. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants