You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How often does it reproduce? Is there a required condition?
Always given the provided path "AUX.txt", independently of extension given (tested: "txt" / "js" / null), using another name does not fail.
What is the expected behavior?
A file normally accessible via the OS
What do you see instead?
Opening the file with a generic text application fails (notepad++ and notepad)
notepad++: "\\.\AUX" cannot be opened "\\." doesn't exist
notepad: Cannot find the \\.\AUX.txt file
OS fails to delete or rename file
Additional information
creating the file using an absolute path results in same behaviour
fs.writeFile async method fails in the same way
node does access file contents in the basic test provided
Could you provide full paths of files you are trying to access?
Are you opening the file via default file manager under the same user that run the file-creation script?
Could you be writing file in a different location than you expect (this fs.writeFileSync( "AUX.txt", will write the file in the directory where the script is invoked)?
Also, fs.writeFileSync( "AUX.txt", "test", function(err){return console.log(err)} ) this function doesn't have a callback (the 3rd argument is an options object).
To be clear writeFile creates OS inaccessible file - is an impossible situation because the OS is who actually creates the file and makes any modifications to it, the Node.js (via libuv to be specific) just makes calls (syscall) to the OS to perform those actions.
Given your last hint I attempted to create a file with the same name "AUX.txt" via the OS itself and it fails with the reserved filename explanation. Somehow node must access a deeper api bypassing the restriction, both for writing and reading.
I was caught off guard here. I was generating filenames dynamically for some output and only the AUX.txt file was giving me trouble. I figured the issue had to be deeper than my code, I just did not expect it to be as deep as the OS. Thanks again.
Node uses file namespace paths for file access. We do that so we do not get hit by the 260 path limit, but as a side effect, you can create files with reserved names.
Those files are accessible, the app you are using just must support it. You can try opening the file with \\.\[absolute path to the file].
Anyway, there is nothing for Node to fix here.
Reacted by Nikolai Vavilov, Pedro Soares and Anna Henningsen
Activity
lundibundi commentedon Jun 10, 2020
Could you provide full paths of files you are trying to access?
Are you opening the file via default file manager under the same user that run the file-creation script?
Could you be writing file in a different location than you expect (this
fs.writeFileSync( "AUX.txt",will write the file in the directory where the script is invoked)?Also,
fs.writeFileSync( "AUX.txt", "test", function(err){return console.log(err)} )this function doesn't have a callback (the 3rd argument is an options object).To be clear
writeFile creates OS inaccessible file- is an impossible situation because the OS is who actually creates the file and makes any modifications to it, the Node.js (via libuv to be specific) just makes calls (syscall) to the OS to perform those actions.gnonio commentedon Jun 10, 2020
Much appreciated for your help. You are correct, this has nothing to do with node itself, my apologies.
As it turns out "AUX" is one of many reserved filenames* on this OS.
Given your last hint I attempted to create a file with the same name "AUX.txt" via the OS itself and it fails with the reserved filename explanation. Somehow node must access a deeper api bypassing the restriction, both for writing and reading.
I was caught off guard here. I was generating filenames dynamically for some output and only the AUX.txt file was giving me trouble. I figured the issue had to be deeper than my code, I just did not expect it to be as deep as the OS. Thanks again.
This should probably be closed.
lundibundi commentedon Jun 10, 2020
I was not aware of such a requirement on Windows, glad you solved your issue.
Perhaps we can handle this better on Windows so ping @nodejs/platform-windows @nodejs/libuv to give your opinion if this is actionable somehow.
bzoz commentedon Jun 10, 2020
Node uses file namespace paths for file access. We do that so we do not get hit by the 260 path limit, but as a side effect, you can create files with reserved names.
Those files are accessible, the app you are using just must support it. You can try opening the file with
\\.\[absolute path to the file].Anyway, there is nothing for Node to fix here.