Skip to content

Conversation

@prydt
Copy link

@prydt prydt commented Dec 31, 2025

Current implementation of Buffer.toString does not match Node.js behavior when using undefined as encoding.

Folks have run into this here: mariadb-corporation/mariadb-connector-nodejs#322 (comment)

@prydt prydt requested review from a team as code owners December 31, 2025 20:41
@github-actions
Copy link

github-actions bot commented Dec 31, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@prydt
Copy link
Author

prydt commented Dec 31, 2025

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Dec 31, 2025
@anonrig
Copy link
Member

anonrig commented Dec 31, 2025

Can you add a test?

@prydt
Copy link
Author

prydt commented Dec 31, 2025

Can you add a test?

Added a test. My initial thought was to reuse normalizeEncoding but found that Buffer.toString should fail on null while streams which were using the same encoding function accept null as well (readable_setencoding_null), so I went back to using getEncodingOps but adding a special case for undefined.

@anonrig
Copy link
Member

anonrig commented Jan 1, 2026

We don't allow fix ups. Can you squash all your commits?

@prydt
Copy link
Author

prydt commented Jan 2, 2026

We don't allow fix ups. Can you squash all your commits?

Done. Thank you both!

@anonrig anonrig enabled auto-merge (squash) January 2, 2026 00:52
@codspeed-hq

This comment was marked as off-topic.

@anonrig
Copy link
Member

anonrig commented Jan 2, 2026

Eslint tests are failing.

@prydt
Copy link
Author

prydt commented Jan 2, 2026

Eslint tests are failing.

/root/.cache/bazel/_bazel_root/ebde65d3f8fba119063dd4cdef01aad0/sandbox/processwrapper-sandbox/176/execroot/_main/bazel-out/aarch64-fastbuild/bin/src/node/node@eslint_/node@eslint.runfiles/_main/src/node/internal/internal_utils.ts
   54:3   error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string
   60:16  error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string
   65:48  error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string
   75:16  error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string
   85:16  error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string
   93:12  error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string
  102:12  error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string
  111:12  error  'enc' may use Object's default stringification format ('[object Object]') when stringified  @typescript-eslint/no-base-to-string

When looking at the lint failures, it looks like it has to do with lines that I didn't touch within getEncodingOps. Should I change this other code to pass the lint or should I add enable / disable eslint comments? This function already disables certain lints.

auto-merge was automatically disabled January 2, 2026 16:07

Head branch was pushed to by a user without write access

@prydt
Copy link
Author

prydt commented Jan 2, 2026

I've added a fix for the lint, and it passes tests locally. Just put in a separate commit to make it easy to review since I'm not certain about why the code I'm modifying was written like this in the first place.

Will squash if you are okay with this approach.

@prydt prydt requested a review from anonrig January 2, 2026 17:41
@prydt
Copy link
Author

prydt commented Jan 2, 2026

Should be squashed and ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants