Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path.win32.isAbsolute considers relative paths absolute #56766

Open
reverofevil opened this issue Jan 26, 2025 · 4 comments
Open

path.win32.isAbsolute considers relative paths absolute #56766

reverofevil opened this issue Jan 26, 2025 · 4 comments
Labels
path Issues and PRs related to the path subsystem.

Comments

@reverofevil
Copy link

Version

22.11.0

Platform

Linux pc 6.8.0-48-generic #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

require('path').win32.isAbsolute('\\foo') === true

How often does it reproduce? Is there a required condition?

Yes. No.

What is the expected behavior? Why is that the expected behavior?

Here's a behavior of cd on Windows:

C:\Users\user> cd \Windows
C:\Windows>

\Windows is relative to drive name.

Expected output for isAbsolute() is false.

What do you see instead?

isAbsolute() is true.

Additional information

No response

@lpinca lpinca added the path Issues and PRs related to the path subsystem. label Jan 26, 2025
@ChaseKnowlden
Copy link

That is normal to be true.

@ljharb
Copy link
Member

ljharb commented Feb 1, 2025

"relative to drive name" is still an absolute path, imo - it's just a concept that doesn't exist on any other OS.

@reverofevil
Copy link
Author

If it's an absolute path, can you move source code to another drive, and get it work the same way?

I hope we're not here to blame windows for having weird features other OSes don't, but to get Node.js path library right, and applications breaking due to relative paths considered absolute is not right.

@ljharb
Copy link
Member

ljharb commented Feb 1, 2025

That’s a fair point - i meant more that windows has three concepts (relative, absolute, and drive-relative) and every other OS has two (relative and absolute), and node doesn’t seem to have any concept of drive-relative yet, so I’m not sure what a safe fix would be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
path Issues and PRs related to the path subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants