node icon indicating copy to clipboard operation
node copied to clipboard

path: update win32 toNamespacedPath to support device namespace paths

Open injunchoi98 opened this issue 1 year ago • 14 comments

Updated the win32 toNamespacedPath function to support device namespace paths as per #54180 and #54161. url.pathToFileURL was not modified since device namespace paths are not valid file URIs.

injunchoi98 avatar Aug 14 '24 09:08 injunchoi98

Codecov Report

Attention: Patch coverage is 85.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 88.23%. Comparing base (880c446) to head (9eb494a). Report is 477 commits behind head on main.

Files with missing lines Patch % Lines
src/path.cc 57.14% 6 Missing and 3 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54367      +/-   ##
==========================================
+ Coverage   87.09%   88.23%   +1.14%     
==========================================
  Files         648      651       +3     
  Lines      182216   183895    +1679     
  Branches    34965    35847     +882     
==========================================
+ Hits       158704   162267    +3563     
+ Misses      16785    14913    -1872     
+ Partials     6727     6715      -12     
Files with missing lines Coverage Δ
lib/path.js 95.61% <100.00%> (+0.44%) :arrow_up:
src/path.cc 67.39% <57.14%> (-1.66%) :arrow_down:

... and 248 files with indirect coverage changes

codecov[bot] avatar Aug 14 '24 10:08 codecov[bot]

I believe this is already being fixed in https://github.com/nodejs/node/pull/54224

targos avatar Aug 15 '24 06:08 targos

Thank you for let me know sir. I'll close this PR

injunchoi98 avatar Aug 15 '24 07:08 injunchoi98

sir Im bit confused that #54224 seems to be focused on fixing an issue where a trailing backslash was incorrectly added in the resolve function, whereas my PR is specifically aimed at converting file paths to namespace paths in the tonamespaced function. It seems these are addressing different concerns..?

injunchoi98 avatar Aug 15 '24 07:08 injunchoi98

I would work on this issue after finishing my current work. So, I reviewed this PR.

This PR fixes a different problem than https://github.com/nodejs/node/pull/54224 and LGTM.

I think the author can continue working on this by reopening it.

huseyinacacak-janea avatar Aug 15 '24 11:08 huseyinacacak-janea

I believe this PR could fix https://github.com/nodejs/node/issues/54161 as well. The conout$ and conin$ could be added as regular expressions. What do you think? Refs: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file Refs: https://learn.microsoft.com/en-us/windows/console/console-handles

huseyinacacak-janea avatar Aug 15 '24 12:08 huseyinacacak-janea

Thank you for your valuable feedback. I initially included only CON as a regular expression, but I completely agree that conout$ and conin$ should also be added as regular expressions. I will reopen this PR tomorrow. I appreciate your guidance.

injunchoi98 avatar Aug 15 '24 13:08 injunchoi98

Note that toNamespacedPath also has a C++ implementation that would have to be updated as well.

targos avatar Aug 16 '24 08:08 targos

Thank you for let me know. I just updated C++ implementation as well.

injunchoi98 avatar Aug 17 '24 09:08 injunchoi98

@targos I made the changes based on your feedback. Could you review this PR when you have a moment?

injunchoi98 avatar Aug 24 '24 23:08 injunchoi98

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

nodejs-github-bot avatar Aug 29 '24 15:08 nodejs-github-bot

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

nodejs-github-bot avatar Sep 01 '24 16:09 nodejs-github-bot

Could you update the doc also?

daeyeon avatar Sep 25 '24 03:09 daeyeon

Of course. Thank you for let me know. I updated the doc also according to your feedback.

injunchoi98 avatar Sep 25 '24 05:09 injunchoi98

Hi, is the original issue still relevant? I was in the process of backporting https://github.com/nodejs/node/pull/52135 which seems to have caused some regressions and it seems this is fixing one of the them that are still around?

joyeecheung avatar Jan 23 '25 23:01 joyeecheung

The original issue (the lack of support for the device namespace in toNamespace on Windows) still seems unresolved. However, if #52135 modified the C++ implementation of toNamespace, it seems likely that the C++ portion of this PR would also need adjustments.

injunchoi98 avatar Jan 26 '25 01:01 injunchoi98