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 — util: fix inspect indentation of detached DataView by Kjubikstronk · Pull Request #66421 · nodejs/node

Conversation

@Kjubikstronk

@Kjubikstronk Kjubikstronk commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

util.inspect() of a DataView whose buffer was detached comes out indented too far, and so does everything after it in the same output:

const util = require('node:util');
const ab = new ArrayBuffer(4);
const dv = new DataView(ab);
structuredClone(ab, { transfer: [ab] });
console.log(util.inspect(dv));
DataView {
      [byteLength]: 0,
      [byteOffset]: undefined,
      [buffer]: ArrayBuffer { (detached), [byteLength]: 0 }
    }

The cause was formatExtraProperties(): it raised ctx.indentationLvl before reading value[key]. On a detached DataView the byteLength and byteOffset getters throw, so the -= 2 never runs and 2 spaces leak per key, 4 in total.

The bug came in with #60131, and the test added there asserted the leaked output.

Fix: read the value before indenting.

I built Node on Windows and tested it: the changed test fails without the fix and passes with it, as do 428 related tests.

I used Claude Code to find the bug and write the fix. I reviewed the diff and the changed assertion myself.

Refs: #60131

Sorry, something went wrong.

Uh oh!

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

All reactions
@Kjubikstronk
util: fix inspect indentation of detached DataView
c90d878
formatExtraProperties() raised ctx.indentationLvl before reading the
property. The getters of a detached DataView throw, so the level was
never lowered again, and the DataView and everything inspected after it
in the same call ended up indented too far. Read the value first.

Signed-off-by: Miodrag Obradovic <[email protected]>
Assisted-by: a closed-source coding agent
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

  • the guide for first-time contributors
  • the contribution and automation policies
  • the pull request guide
  • the AI use policy
  • the Code of Conduct

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

All reactions

Sorry, something went wrong.

Uh oh!

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

ljharb
ljharb approved these changes Oct 1, 2026
View reviewed changes
@codecov

codecov Bot commented Oct 1, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.37%. Comparing base (d7ea02d) to head (c90d878).
⚠️ Report is 27 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #66421   +/-   ##
=======================================
  Coverage   90.37%   90.37%           
=======================================
  Files         792      792           
  Lines      275683   275686    +3     
  Branches    52854    52854           
=======================================
+ Hits       249147   249159   +12     
+ Misses      16947    16935   -12     
- Partials     9589     9592    +3     
Files with missing lines Coverage Δ
lib/internal/util/inspect.js 97.04% <100.00%> (+<0.01%) ⬆️

... and 21 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.
All reactions

Sorry, something went wrong.

Uh oh!

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

@MikeMcC399 MikeMcC399 added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 1, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 1, 2026
@nodejs-github-bot

nodejs-github-bot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/78126/

All reactions

Sorry, something went wrong.

Uh oh!

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

lpinca
lpinca approved these changes Oct 1, 2026
View reviewed changes
@MikeMcC399 MikeMcC399 added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 1, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 1, 2026
@nodejs-github-bot

nodejs-github-bot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/78131/

All reactions

Sorry, something went wrong.

Uh oh!

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

@MikeMcC399

This comment was marked as resolved.

Sign in to view
@MikeMcC399 MikeMcC399 added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 2, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 2, 2026
@nodejs-github-bot

nodejs-github-bot commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/78137/

All reactions

Sorry, something went wrong.

Uh oh!

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

@MikeMcC399 MikeMcC399 added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Oct 2, 2026
@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 3, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 1ee5d29 into nodejs:main Oct 3, 2026
95 checks passed

Uh oh!

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

@nodejs-github-bot

nodejs-github-bot commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Landed in 1ee5d29

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 3, 2026
aduh95 pushed a commit that referenced this pull request Oct 3, 2026
@Kjubikstronk @aduh95
util: fix inspect indentation of detached DataView
5d68405
formatExtraProperties() raised ctx.indentationLvl before reading the
property. The getters of a detached DataView throw, so the level was
never lowered again, and the DataView and everything inspected after it
in the same call ended up indented too far. Read the value first.

Signed-off-by: Miodrag Obradovic <[email protected]>
Assisted-by: a closed-source coding agent
PR-URL: #66421
Refs: #60131
Reviewed-By: Jordan Harband <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Oct 3, 2026
@Kjubikstronk @aduh95
util: fix inspect indentation of detached DataView
83a1697
formatExtraProperties() raised ctx.indentationLvl before reading the
property. The getters of a detached DataView throw, so the level was
never lowered again, and the DataView and everything inspected after it
in the same call ended up indented too far. Read the value first.

Signed-off-by: Miodrag Obradovic <[email protected]>
Assisted-by: a closed-source coding agent
PR-URL: #66421
Refs: #60131
Reviewed-By: Jordan Harband <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@github-actions github-actions Bot mentioned this pull request Oct 5, 2026
2026-10-07, Version 26.11.0 (Current) #66546
Merged
aduh95 pushed a commit that referenced this pull request Oct 23, 2026
@Kjubikstronk @aduh95
util: fix inspect indentation of detached DataView
8e84a29
formatExtraProperties() raised ctx.indentationLvl before reading the
property. The getters of a detached DataView throw, so the level was
never lowered again, and the DataView and everything inspected after it
in the same call ended up indented too far. Read the value first.

Signed-off-by: Miodrag Obradovic <[email protected]>
Assisted-by: a closed-source coding agent
PR-URL: #66421
Refs: #60131
Reviewed-By: Jordan Harband <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Oct 28, 2026
@Kjubikstronk @aduh95
util: fix inspect indentation of detached DataView
7360801
formatExtraProperties() raised ctx.indentationLvl before reading the
property. The getters of a detached DataView throw, so the level was
never lowered again, and the DataView and everything inspected after it
in the same call ended up indented too far. Read the value first.

Signed-off-by: Miodrag Obradovic <[email protected]>
Assisted-by: a closed-source coding agent
PR-URL: #66421
Refs: #60131
Reviewed-By: Jordan Harband <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@robobun robobun mentioned this pull request Oct 29, 2026
util.inspect: print numbers, errors, tags and getters as Node.js v26.12.1 does oven-sh/bun#47303
Closed
@leapmux-renovate leapmux-renovate Bot mentioned this pull request Nov 1, 2026
chore(deps): Update Node.js to v26 leapmux/leapmux#578
Merged
aduh95 pushed a commit that referenced this pull request Nov 11, 2026
@Kjubikstronk @aduh95
util: fix inspect indentation of detached DataView
b55aa45
formatExtraProperties() raised ctx.indentationLvl before reading the
property. The getters of a detached DataView throw, so the level was
never lowered again, and the DataView and everything inspected after it
in the same call ended up indented too far. Read the value first.

Signed-off-by: Miodrag Obradovic <[email protected]>
Assisted-by: a closed-source coding agent
PR-URL: #66421
Refs: #60131
Reviewed-By: Jordan Harband <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
2026-11-30, Version 24.23.0 'Krypton' (LTS) #67663
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ljharb ljharb ljharb approved these changes
@lpinca lpinca lpinca approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

6 participants

@Kjubikstronk @nodejs-github-bot @MikeMcC399 @ljharb @lpinca @panva
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.