Closed djberg96 closed 2 years ago
Hi. Thanks for reporting this issue. Sadly I'm on an extremely tight schedule and can't spend to much time maintaining the project. I'm open to reviewing a PR if you'd like to have a stab at it though 😊
Well, there's a couple ways to approach it. One would be to just default to 1. Another would be to store an initial value of 1 on all MemFs::Fake::File objects, and increment it by one every time the link
method is called on it, and reference that. Depends how much realism you want.
I think it should behave as close as possible to the original. That said, this means that we'd need some kind of reference that all hard links share. One idea to explore, but I guess it's a lot of work just to add nlink
would be, like on a standard file system, to have a node id for each entry (inode). Hard links would share the same node id. So nlink
would then just be a matter of finding the named entry and then searching for any entry with the same node id and counting them.
memfs 1.0.0
While converting from fakefs to memfs I ran into this:
undefined method 'nlink' for MemFs::File::Stat
.The library in question is a file finder that has the option to to restrict searches based on the number of links, similar to the
-links
option for thefind
command.