Skip to content

path.normalize() differences introduced in 20.18.2 #57243

Open
@kelleyma49

Description

@kelleyma49

Version

20.18.2

Platform

Windows

Subsystem

No response

What steps will reproduce the bug?

It looks like the :\ passed to path.normalize() causes the function to add a .\. I believe it's related to this commit: 8306457. This might be intended behavior, but has the potential for functions that spawn or fork execs would break because of this change.

Here's a repro:

nvm use 20.11.1 ; node -e "const path = require('path'); console.log(path.normalize('powershell.exe echo \':\\hello!\''));" ; nvm use 20.18.2 ; node -e "const path = require('path'); console.log(path.normalize('powershell.exe echo \':\\hello!\''));"           
Now using node v20.11.1 (64-bit)
powershell.exe echo ':\hello!'
Now using node v20.18.2 (64-bit)
.\powershell.exe echo ':\hello!'

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

This behavior is observed if any part of the path passed to path.normalize() contains '.\'

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

It is not expected that '.\' is added.

What do you see instead?

See the repro steps for expected and changed output.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions