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 — fs: make `mkdtemp` accept buffers and URL by LiviaMedeiros · Pull Request #48828 · nodejs/node

Conversation

@LiviaMedeiros

@LiviaMedeiros LiviaMedeiros commented Jul 18, 2023

Copy link
Copy Markdown
Member

mkdtemp() seems to be the only fs method that doesn't support URL objects yet.

Sorry, something went wrong.

Uh oh!

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

bricss and Kifzy reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run. labels Jul 18, 2023
@LiviaMedeiros
LiviaMedeiros force-pushed the fs-mkdtemp-url branch from 976f66b to f61da69 Compare July 18, 2023 16:05
LiviaMedeiros
LiviaMedeiros commented Jul 18, 2023
View reviewed changes
Comment thread lib/internal/fs/utils.js Outdated

@LiviaMedeiros LiviaMedeiros Jul 18, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String.prototype.endsWith always strigifies this value but explicit coercion wouldn't hurt

Sorry, something went wrong.

Uh oh!

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

All reactions

@aduh95 aduh95 Jul 19, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a mistake to attempt to stringify a TypedArray, let's not bother with this warning if the template is not a string, wdyt?

Suggested change
if (nonPortableTemplateWarn && StringPrototypeEndsWith(`${template}`, 'X')) {
if (nonPortableTemplateWarn && typeof template === 'string' && StringPrototypeEndsWith(template, 'X')) {

Sorry, something went wrong.

Uh oh!

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

All reactions

@LiviaMedeiros LiviaMedeiros Jul 19, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's right, it can be native Uint8Array, too. Fixed that in the actual functions. 😅

As for warning, AFAICT there's no utf character that ends with 0x58 except for one-byte X, so Array.prototype.at.call(template, -1) === 0x58 should suffice for buffers.

Sorry, something went wrong.

Uh oh!

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

All reactions

@aduh95 aduh95 Jul 19, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's an always correct assumption that the system would be using a UTF encoding set, but maybe it's fair to consider so as it's certainly very common 🤔 but probably folks who are using a Buffer/Uint8Array are doing so precisely so it can work on weird encoding sets? Maybe it's not worth overthinking it, it's just emitting a warning, so it's not like it would block anyone to have false positive.

Sorry, something went wrong.

Uh oh!

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

All reactions

@LiviaMedeiros LiviaMedeiros Jul 20, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning makes sense because the underlying implementation still might get confused.
glibc performs multibyte-unfriendly check with strspn, and it might be likely for mkdtemp on exotic platforms supporting prefixes longer than 6 to be as rough as for (int i = strlen(template); template[--i] == 'X'; template[i] = getRandomChar()) {}.
IMHO if someone writes precise code for specific platforms and charsets, it's probably up to them to simply ignore warning about template not being portable.

Sorry, something went wrong.

Uh oh!

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

All reactions
@LiviaMedeiros LiviaMedeiros 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 Jul 18, 2023
@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 Jul 18, 2023
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
VoltrexKeyva
VoltrexKeyva approved these changes Jul 18, 2023
View reviewed changes
@LiviaMedeiros LiviaMedeiros 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 Jul 18, 2023
@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 Jul 18, 2023
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
aduh95
aduh95 reviewed Jul 19, 2023
View reviewed changes
Comment thread lib/internal/fs/utils.js Resolved

Uh oh!

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

@github-actions github-actions Bot mentioned this pull request Jul 20, 2023
CI Reliability 2023-07-20 nodejs/reliability#618
Open
22 tasks
@LiviaMedeiros LiviaMedeiros 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 Jul 20, 2023
@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 Jul 20, 2023
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

nodejs-github-bot commented Jul 20, 2023

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

aduh95
aduh95 approved these changes Jul 20, 2023
View reviewed changes
@github-actions github-actions Bot mentioned this pull request Jul 21, 2023
CI Reliability 2023-07-21 nodejs/reliability#619
Open
16 tasks
@LiviaMedeiros
LiviaMedeiros force-pushed the fs-mkdtemp-url branch from cf63c24 to e589bd3 Compare July 21, 2023 15:50
@LiviaMedeiros LiviaMedeiros added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Jul 21, 2023
@LiviaMedeiros
LiviaMedeiros force-pushed the fs-mkdtemp-url branch 2 times, most recently from 68703a6 to 85c0566 Compare July 21, 2023 16:06
@LiviaMedeiros

LiviaMedeiros commented Jul 21, 2023

Copy link
Copy Markdown
Member Author

Rebased with 68703a6 for linter

All reactions

Sorry, something went wrong.

Uh oh!

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

@LiviaMedeiros LiviaMedeiros 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 Jul 21, 2023
@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 Jul 21, 2023
@LiviaMedeiros

LiviaMedeiros commented Jul 26, 2023

Copy link
Copy Markdown
Member Author

Landed in 6cd6789...1eae568

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot mentioned this pull request Jul 27, 2023
CI Reliability 2023-07-27 nodejs/reliability#625
Open
18 tasks
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Jul 27, 2023
@LiviaMedeiros @Ceres6
fs: make mkdtemp accept buffers and URL
1f9ae42
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Jul 27, 2023
@LiviaMedeiros @Ceres6
fs: mention URL in NUL character error message
a7e3fa6
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
This was referenced Jul 28, 2023
CI Reliability 2023-07-28 nodejs/reliability#626
Open
CI Reliability 2023-07-29 nodejs/reliability#627
Open
CI Reliability 2023-07-30 nodejs/reliability#628
Open
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @Ceres6
fs: make mkdtemp accept buffers and URL
e014452
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @Ceres6
fs: mention URL in NUL character error message
b22843d
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @Ceres6
fs: make mkdtemp accept buffers and URL
6bd6214
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @Ceres6
fs: mention URL in NUL character error message
6252a3a
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
UlisesGascon pushed a commit to UlisesGascon/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @UlisesGascon
fs: make mkdtemp accept buffers and URL
bb4f60d
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
UlisesGascon pushed a commit to UlisesGascon/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @UlisesGascon
fs: mention URL in NUL character error message
5352f41
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 15, 2023
@LiviaMedeiros @RafaelGSS
fs: make mkdtemp accept buffers and URL
f8b421e
PR-URL: #48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 15, 2023
@LiviaMedeiros @RafaelGSS
fs: mention URL in NUL character error message
d2e92b9
PR-URL: #48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@UlisesGascon UlisesGascon mentioned this pull request Aug 15, 2023
v20.6.0 proposal #49185
Merged
RafaelGSS pushed a commit that referenced this pull request Aug 17, 2023
@LiviaMedeiros @RafaelGSS
fs: make mkdtemp accept buffers and URL
d634d78
PR-URL: #48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 17, 2023
@LiviaMedeiros @RafaelGSS
fs: mention URL in NUL character error message
c14ff69
PR-URL: #48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Nov 11, 2023
@LiviaMedeiros @targos
fs: make mkdtemp accept buffers and URL
4ffa98f
PR-URL: nodejs#48828
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@targos targos mentioned this pull request Nov 11, 2023
[v18.x] Backport most ESM and customization hook changes #50669
Closed
@targos targos added backported-to-v18.x and removed commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. labels Nov 23, 2023
targos pushed a commit that referenced this pull request Nov 23, 2023
@LiviaMedeiros @targos
fs: make mkdtemp accept buffers and URL
48c25b1
PR-URL: #48828
Backport-PR-URL: #50669
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@targos targos mentioned this pull request Nov 28, 2023
v18.19.0 release proposal #50953
Merged
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
fs: make mkdtemp accept buffers and URL
d7ad627
PR-URL: nodejs/node#48828
Backport-PR-URL: nodejs/node#50669
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
fs: make mkdtemp accept buffers and URL
a57483b
PR-URL: nodejs/node#48828
Backport-PR-URL: nodejs/node#50669
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aduh95 aduh95 aduh95 approved these changes
+1 more reviewer
@VoltrexKeyva VoltrexKeyva VoltrexKeyva approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run.

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.

5 participants

@LiviaMedeiros @nodejs-github-bot @aduh95 @VoltrexKeyva @targos
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 01402503 — 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.