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

Folders with .. #34524

Closed
Meaxis opened this issue Jul 26, 2020 · 10 comments
Closed

Folders with .. #34524

Meaxis opened this issue Jul 26, 2020 · 10 comments

Comments

@Meaxis
Copy link

Meaxis commented Jul 26, 2020

I am running Node v10.15.3, on Windows 10 2004 (19041.338).
Node is able to create directories with two dots in them, directories that should not exist according to Windows as they are non-deletable and that gets mixed up with a directory of the same name.

To reproduce it, try creating a directory. I'm not sure if it's from the module I'm using or Node itself, but Node itself should prevent that.

@DerekNonGeneric
Copy link
Contributor

@Meaxis, just out of curiosity, why did you decide not to use the issue template?

@Trott
Copy link
Member

Trott commented Jul 27, 2020

I would think Node.js should not prevent this as the operating system will prevent it. But you seem to be saying that the operating system allows it, which seems extraordinary to me. Can you provide actual code that does this? Is it remotely possible that the file names being created are not .. but instead using some Unicode character that resembles .?

Windows (to my knowledge) does not allow the creation of files or directories whose names consist only of . characters.

@nodejs/platform-windows

@DerekNonGeneric
Copy link
Contributor

/to @Meaxis

I'm sorry to have asked about the issue template, but we have been trying to figure out how to best structure it for Windows users.

I am running Node v10.15.3, on Windows 10 2004 (19041.338).

Thanks for providing this.

Node is able to create directories with two dots in them […]

That's fine, so does explorer.exe.

[…] directories that should not exist according to Windows […]

I don't see why these should not exist since we are able to create them using explorer.exe (the Windows GUI).

[…] as they are non-deletable […]

Non-deletable how? Did you use the fs module?

For more information, please see Recursive Directory Removal in Node.js.

To reproduce it, try creating a directory.

How did you create this directory? From the Windows GUI (explorer.exe), PowerShell, or something else?

I'm not sure if it's from the module I'm using or Node itself, but Node itself should prevent that.

Can you please explain this a little bit more? Are you insinuating that they (directories with two dots in them) should be prevented from being created since they cannot be deleted?


I think we need more information in order to properly address this issue. Some sample code would have been great.

@DerekNonGeneric
Copy link
Contributor

/to @Trott

Windows (to my knowledge) does not allow the creation of files or directories whose names consist only of . characters.

I was able to create a directory with one and two leading dots, but you're right, you can't have a folder name that consists of only dots. I don't think that is what this question is about though, but it may be worth researching a little further.

@Meaxis
Copy link
Author

Meaxis commented Jul 28, 2020

Apparently, you can create those folders. Two dots at the end will automatically get removed, and if you have a folder named "LoremIpsum" and you try to create another one called "LoremIpsum..", it'll conflict. However, I was able to create LoremIpsum.. (with an existing LoremIpsum) through Node.

@Meaxis
Copy link
Author

Meaxis commented Jul 28, 2020

I would think Node.js should not prevent this as the operating system will prevent it. But you seem to be saying that the operating system allows it, which seems extraordinary to me. Can you provide actual code that does this? Is it remotely possible that the file names being created are not .. but instead using some Unicode character that resembles .?

Windows (to my knowledge) does not allow the creation of files or directories whose names consist only of . characters.

var fs = require('fs');
var dir = 'myfolder..';

fs.mkdirSync(dir);

@Meaxis
Copy link
Author

Meaxis commented Jul 28, 2020

/to @DerekNonGeneric

@Meaxis, just out of curiosity, why did you decide not to use the issue template?

Apologies, I don't write issue reports very much, and I thought I only had to provide my operating system, how to reproduce the bug and what is the bug. Should I correct it?

@DerekNonGeneric
Copy link
Contributor

/to @Meaxis

Should I correct it?

I certainly would. If you do, please use the appropriate issue template (omit the YAML frontmatter) and be sure to include sample code that would allow us to reproduce the problem (the way you attempted to delete the directory is missing). Thanks in advance if you do end up following through.

@seishun
Copy link
Contributor

seishun commented Jul 28, 2020

See explanation here: #33829 (comment).

You can still remove the directory using fs.rmdirSync(dir).

Closing as non-actionable.

@seishun seishun closed this as completed Jul 28, 2020
@Trott
Copy link
Member

Trott commented Aug 1, 2020

See explanation here: #33829 (comment).

Is this information in the documentation? If not, should it be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants