Skip to content

Conversation

himself65
Copy link
Member

@himself65 himself65 commented Jun 25, 2025

Fixes: #58826

-1 is a special input for chown, means won't change anything according to the spec.

https://stackoverflow.com/questions/21370094/is-the-uid-t-type-signed-or-unsigned

@himself65 himself65 marked this pull request as ready for review June 25, 2025 17:35
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Jun 25, 2025
@himself65 himself65 requested review from jasnell and joyeecheung June 25, 2025 17:36
@himself65
Copy link
Member Author

I didn't see any test about valid input in chown. well do we need add one?

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.07%. Comparing base (a705e24) to head (0a3e989).
Report is 31 commits behind head on main.

Files with missing lines Patch % Lines
src/util-inl.h 25.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58836      +/-   ##
==========================================
- Coverage   90.08%   90.07%   -0.01%     
==========================================
  Files         640      640              
  Lines      188375   188447      +72     
  Branches    36939    36966      +27     
==========================================
+ Hits       169698   169745      +47     
- Misses      11397    11405       +8     
- Partials     7280     7297      +17     
Files with missing lines Coverage Δ
src/node_file.cc 75.79% <100.00%> (-0.04%) ⬇️
src/util-inl.h 81.90% <25.00%> (-0.28%) ⬇️

... and 33 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.

@himself65 himself65 force-pushed the himself65/2025/06/25/loose branch from f912834 to 6fa93e5 Compare June 25, 2025 23:34
@himself65 himself65 changed the title fs: edge case -1 input on chown fs: special input -1 on chown, lchown and fchown Jun 25, 2025
@himself65 himself65 force-pushed the himself65/2025/06/25/loose branch from 74479c1 to 64f6f95 Compare June 25, 2025 23:42
@himself65 himself65 force-pushed the himself65/2025/06/25/loose branch from 64f6f95 to 0a3e989 Compare June 26, 2025 16:03
@himself65 himself65 requested a review from joyeecheung June 26, 2025 16:04
@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@nodejs-github-bot
Copy link
Collaborator

@himself65 himself65 added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@nodejs-github-bot
Copy link
Collaborator

} else {
CHECK(value->IsNumber());
}
return static_cast<T>(value.As<v8::Uint32>()->Value());
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure that at least according to the V8 API contract, IsUint32() is a prerequisite for this case to be valid in the first place – overall, I'd say it's better to handle these values in the *Chown functions rather than in the generic helpers here

@himself65 himself65 added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@nodejs-github-bot
Copy link
Collaborator

@himself65 himself65 added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2025
@nodejs-github-bot
Copy link
Collaborator

@himself65 himself65 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 27, 2025
@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 Jun 27, 2025
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/58836
✔  Done loading data for nodejs/node/pull/58836
----------------------------------- PR info ------------------------------------
Title      fs: special input `-1` on `chown`, `lchown` and `fchown` (#58836)
Author     Alex Yang <himself65@outlook.com> (@himself65)
Branch     himself65:himself65/2025/06/25/loose -> nodejs:main
Labels     c++, fs, needs-ci
Commits    1
 - fs: special input `-1` on `chown`, `lchown` and `fchown`
Committers 1
 - Alex Yang <alex@runllama.ai>
PR-URL: https://github.com/nodejs/node/pull/58836
Fixes: https://github.com/nodejs/node/issues/58826
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/58836
Fixes: https://github.com/nodejs/node/issues/58826
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 25 Jun 2025 17:35:29 GMT
   ✔  Approvals: 1
   ✔  - Joyee Cheung (@joyeecheung) (TSC): https://github.com/nodejs/node/pull/58836#pullrequestreview-2965372044
   ✘  This PR needs to wait 116 more hours to land (or 0 hours if there is one more approval)
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2025-06-27T20:21:59Z: https://ci.nodejs.org/job/node-test-pull-request/67691/
- Querying data for job/node-test-pull-request/67691/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/15936207250

@himself65 himself65 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 27, 2025
@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jun 28, 2025
@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 Jun 28, 2025
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/hostedtoolcache/node/22.16.0/x64/lib/node_modules/@node-core/utils/node_modules/css-select/lib/esm/index.js' imported from /opt/hostedtoolcache/node/22.16.0/x64/lib/node_modules/@node-core/utils/node_modules/cheerio-select/lib/esm/index.js
Did you mean to import "css-select/lib/index.js"?
at finalizeResolution (node:internal/modules/esm/resolve:275:11)
at moduleResolve (node:internal/modules/esm/resolve:860:10)
at defaultResolve (node:internal/modules/esm/resolve:984:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:780:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:704:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:687:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:305:38)
at ModuleJob._link (node:internal/modules/esm/module_job:137:49) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///opt/hostedtoolcache/node/22.16.0/x64/lib/node_modules/@node-core/utils/node_modules/css-select/lib/esm/index.js'
}

Node.js v22.16.0

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

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jun 28, 2025
@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 Jun 28, 2025
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/58836
✔  Done loading data for nodejs/node/pull/58836
----------------------------------- PR info ------------------------------------
Title      fs: special input `-1` on `chown`, `lchown` and `fchown` (#58836)
Author     Alex Yang <himself65@outlook.com> (@himself65)
Branch     himself65:himself65/2025/06/25/loose -> nodejs:main
Labels     c++, fs, author ready, needs-ci
Commits    1
 - fs: special input `-1` on `chown`, `lchown` and `fchown`
Committers 1
 - Alex Yang <alex@runllama.ai>
PR-URL: https://github.com/nodejs/node/pull/58836
Fixes: https://github.com/nodejs/node/issues/58826
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/58836
Fixes: https://github.com/nodejs/node/issues/58826
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 25 Jun 2025 17:35:29 GMT
   ✔  Approvals: 1
   ✔  - Joyee Cheung (@joyeecheung) (TSC): https://github.com/nodejs/node/pull/58836#pullrequestreview-2965372044
   ✘  This PR needs to wait 94 more hours to land (or 0 hours if there is one more approval)
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2025-06-27T21:22:30Z: https://ci.nodejs.org/job/node-test-pull-request/67691/
- Querying data for job/node-test-pull-request/67691/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/15947155809

@himself65 himself65 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 29, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 29, 2025
@nodejs-github-bot nodejs-github-bot merged commit 8b199ee into nodejs:main Jun 29, 2025
100 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 8b199ee

@himself65 himself65 deleted the himself65/2025/06/25/loose branch June 29, 2025 22:29
targos pushed a commit that referenced this pull request Jul 3, 2025
PR-URL: #58836
Fixes: #58826
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2025
PR-URL: #58836
Fixes: #58826
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 24, 2025
PR-URL: #58836
Fixes: #58826
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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++. commit-queue-failed An error occurred while landing this pull request using GitHub Actions. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fs.chown crashes when uid is -1

6 participants