node icon indicating copy to clipboard operation
node copied to clipboard

Revert "path: fix bugs and inconsistencies"

Open avivkeller opened this issue 1 year ago • 17 comments

This (uncleanly) reverts commit efbba60.

Fixes #55410


The commit efbba60 introduced a change where paths would retain trailing / characters. This change led to issues in npm and likely other libraries, because trailing / characters are not typically expected to be preserved.

The purpose of using resolve() on a path is to fully resolve it to its canonical form, regardless of how it is written (e.g., both /hello/../world and /hello/../hello/../world should resolve to the same path). However, this commit altered that behavior, making /hello/ resolve differently from /hello. That made the resolution of identical paths (one with / and one without) return different results. This reverts that behavior

avivkeller avatar Oct 17 '24 01:10 avivkeller

Review requested:

  • [ ] @nodejs/loaders
  • [ ] @nodejs/url

nodejs-github-bot avatar Oct 17 '24 01:10 nodejs-github-bot

Codecov Report

Attention: Patch coverage is 86.04651% with 6 lines in your changes missing coverage. Please review.

Project coverage is 88.40%. Comparing base (7ae193d) to head (c9d8289). Report is 65 commits behind head on main.

Files with missing lines Patch % Lines
src/path.cc 20.00% 3 Missing and 1 partial :warning:
lib/internal/url.js 90.00% 0 Missing and 1 partial :warning:
lib/path.js 96.15% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55414      +/-   ##
==========================================
- Coverage   88.40%   88.40%   -0.01%     
==========================================
  Files         653      653              
  Lines      187600   187518      -82     
  Branches    36117    36089      -28     
==========================================
- Hits       165854   165770      -84     
+ Misses      14974    14971       -3     
- Partials     6772     6777       +5     
Files with missing lines Coverage Δ
lib/internal/modules/cjs/loader.js 97.74% <100.00%> (+0.30%) :arrow_up:
lib/internal/url.js 97.63% <90.00%> (-0.36%) :arrow_down:
lib/path.js 95.99% <96.15%> (+<0.01%) :arrow_up:
src/path.cc 69.04% <20.00%> (+1.65%) :arrow_up:

... and 26 files with indirect coverage changes

codecov[bot] avatar Oct 17 '24 02:10 codecov[bot]

FWIW the npm issue was already reported in the comments of the original PR, see https://github.com/nodejs/node/pull/54224#issuecomment-2361850159.

lpinca avatar Oct 17 '24 06:10 lpinca

FWIW the npm issue was already reported in the comments of the original PR, see #54224 (comment).

I wonder why no one (besides you) followed up on that. It should never have landed. Still, we should have more tests on CITGM to verify these changes.

ovflowd avatar Oct 17 '24 07:10 ovflowd

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

nodejs-github-bot avatar Oct 17 '24 11:10 nodejs-github-bot

Since my PR to fix inconsistencies between functions broke a lot of things in other dependencies, it would be better to revert the PR rather than fix all the other dependencies. Thank you for the PR to revert the changes.

huseyinacacak-janea avatar Oct 17 '24 11:10 huseyinacacak-janea

FWIW the npm issue was already reported in the comments of the original PR, see #54224 (comment).

I wonder why no one (besides you) followed up on that. It should never have landed. Still, we should have more tests on CITGM to verify these changes.

We used to test npm in CITGM, but it often failed (https://github.com/nodejs/citgm/issues/897). I think it was removed as part of one of the clear outs of persistently failing modules.

There's a (stalled?) PR to add it back: https://github.com/nodejs/citgm/pull/979

richardlau avatar Oct 17 '24 12:10 richardlau

fixes https://github.com/nodejs/node/issues/55424

vzaidman avatar Oct 17 '24 14:10 vzaidman

This also broke a ton of Yarn's e2e tests, did CITGM miss that too? 🤔

RDIL avatar Oct 17 '24 14:10 RDIL

For discussion of the CITGM, see https://github.com/nodejs/citgm/issues/1067

avivkeller avatar Oct 17 '24 14:10 avivkeller

This also broke a ton of Yarn's e2e tests, did CITGM miss that too? 🤔

I'm not sure if our tests cover it :) https://github.com/nodejs/citgm/tree/main/test/yarn

ovflowd avatar Oct 17 '24 14:10 ovflowd

Oh, yeah, good point.

RDIL avatar Oct 17 '24 14:10 RDIL

This also broke a ton of Yarn's e2e tests, did CITGM miss that too? 🤔

I'm not sure if our tests cover it :) https://github.com/nodejs/citgm/tree/main/test/yarn

I think @RDIL was referring to https://github.com/nodejs/citgm/blob/9ac6cc9159697eade2fa3725e3117982260a7209/lib/lookup.json#L28-L44.

merceyz avatar Oct 18 '24 08:10 merceyz

This has a conflict now.

richardlau avatar Oct 18 '24 12:10 richardlau

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

nodejs-github-bot avatar Oct 18 '24 14:10 nodejs-github-bot

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

nodejs-github-bot avatar Oct 18 '24 23:10 nodejs-github-bot

Hey, can this land with the passing CI and approvals?

avivkeller avatar Oct 19 '24 23:10 avivkeller

Looking forward to see 👀 this in the next semver minor or patch release asap ⏰ coz current Node 23 version a little bit broken, atm 🫠

bricss avatar Oct 20 '24 10:10 bricss

Landed in ee46d2297c648dc6cc8cbc0327c453514b878294

nodejs-github-bot avatar Oct 21 '24 07:10 nodejs-github-bot

Great! Should this go out in a patch, or in the next minor?

avivkeller avatar Oct 21 '24 12:10 avivkeller

This also broke a ton of Yarn's e2e tests, did CITGM miss that too? 🤔

great question, when will this fix land?

jkoenig134 avatar Oct 23 '24 14:10 jkoenig134

npm is very broken; it should go out in a patch asap if possible.

ljharb avatar Oct 23 '24 14:10 ljharb

FWIW I just asked about a potential v23.0.1 patch in slack https://openjs-foundation.slack.com/archives/C019MGJQ8RH/p1729695807771819

avivkeller avatar Oct 23 '24 15:10 avivkeller