Moderator's note (@Fishrock123): Off-topic comments have and will be deleted.
- Version: v7.2.1
- Platform: Windows 10 Pro 64bit, Windows 7 Enterprise 64bit (Both using NTFS)
- Subsystem: File System
Node sometimes reports different files/folders to have identical ino values.
I can't reproduce this consistently and copying/reproducing a folder structure that contains dupes elsewhere doesn't replicate the issue.
I did encounter lots of duplicates under C:\Users\%USER%\AppData but it may be different for other people
Example
Specific example I encountered
# Structure
│ ServerStore.jsx
│
├───constants
│ Api.jsx
│
└───stores
UserStore.jsx
> fs.lstatSync("stores").ino
5910974511014218
> fs.lstatSync("stores/UserStore.jsx").ino
24206847997202570
> fs.lstatSync("constants").ino //Duplicate
9851624184963316
> fs.lstatSync("constants/Api.jsx").ino //Duplicate
9851624184963316
> fs.lstatSync("ServerStore.jsx").ino
3659174697792238
Test Script
Here's a hacky node script to loop through a directory and look for duplicate inodes.
Running it on most of my other folders didn't yield a result, until I ran it on C:\Users\%USER%\AppData where I encounted loads of duplicates
Usage: node dupe.js [dir]
varfs=require('fs');varpath=require('path');varprocess=require('process');// Recursively walks a directory and looks for duplicate inodes// loop from http://stackoverflow.com/questions/5827612/node-js-fs-readdir-recursive-directory-searchvardir=process.argv[2];if(dir==undefined){dir='.';}varwalk=function(dir,done){varresults=[];fs.readdir(dir,function(err,list){if(err)returndone(err);varpending=list.length;if(!pending)returndone(null,results);list.forEach(function(file){file=path.resolve(dir,file);fs.stat(file,function(err,stat){if(stat&&stat.ino){results.push({file: file,ino: stat.ino});}if(stat&&stat.isDirectory()){walk(file,function(err,res){if(res){results=results.concat(res);}if(!--pending)done(null,results);});}else{if(!--pending)done(null,results);}});});});};walk(dir,function(err,results){varmerge={};results.forEach(function(it){if(!merge[it.ino]){merge[it.ino]=[];}merge[it.ino].push(it.file);});vardupes=Object.keys(merge).filter(key=>merge[key].length>1);dupes.forEach(it=>console.log(it,merge[it]));})
Moderator's note (@Fishrock123): Off-topic comments have and will be deleted.
Node sometimes reports different files/folders to have identical ino values.
I can't reproduce this consistently and copying/reproducing a folder structure that contains dupes elsewhere doesn't replicate the issue.
I did encounter lots of duplicates under
C:\Users\%USER%\AppDatabut it may be different for other peopleExample
Specific example I encountered
Test Script
Here's a hacky node script to loop through a directory and look for duplicate inodes.
Running it on most of my other folders didn't yield a result, until I ran it on
C:\Users\%USER%\AppDatawhere I encounted loads of duplicatesUsage:
node dupe.js [dir]