mafintosh/fuse-bindings

Strange `link` behavior

aa6 opened this issue · 0 comments

aa6 commented

In this little example https://github.com/aa6/nodejs_fuse_tests/blob/master/util/fuse-bindings_hardlinking.coffee when I try to call fs.link on a mounted fs, it calls gettattr on linking target, then calls getattr on non-existant-yet hardlink file and never calls the link function to actually create a hard link. What is wrong here? Readfile at the end is used to ensure that fs is working.
Output:

$ coffee fuse-bindings_hardlinking.coffee 
mount { '0': undefined }
getattr { '0': '/.xdg-volume-info', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
getattr { '0': '/autorun.inf', '1': [Function: bound ] }
getattr { '0': '/.Trash', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/.Trash-1000', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/', '1': [Function: bound ] }
readdir { '0': '/', '1': [Function: bound ] }
getattr { '0': '/autorun.inf', '1': [Function: bound ] }
=== link 1 ===
getattr { '0': '/test', '1': [Function: bound ] }
getattr { '0': '/test-lnk', '1': [Function: bound ] }
{ '0': 
   { Error: ENOENT: no such file or directory, link '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test' -> '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test-lnk'
     at Error (native)

     errno: -2,
     code: 'ENOENT',
     syscall: 'link',
     path: '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test',
     dest: '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test-lnk' } }
=== /link 1 ===
=== link 2 ===
getattr { '0': '/test-lnk', '1': [Function: bound ] }
{ '0': 
   { Error: ENOENT: no such file or directory, link '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test-lnk' -> '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test'
     at Error (native)

     errno: -2,
     code: 'ENOENT',
     syscall: 'link',
     path: '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test-lnk',
     dest: '/home/me/tst/nodejs_fuse_tests/util/tmp/fuse-bindings_hardlinking_mountpoint/test' } }
=== /link 2 ===
=== readFile ===
open { '0': '/test', '1': 32768, '2': [Function: bound ] }
read { '0': '/test',
  '1': 1,
  '2': <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... >,
  '3': 4096,
  '4': 0,
  '5': [Function: bound ] }
getattr { '0': '/test', '1': [Function: bound ] }
read { '0': '/test',
  '1': 1,
  '2': <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... >,
  '3': 4096,
  '4': 0,
  '5': [Function: bound ] }
hello world
=== /readFile ===
umount { '0': null, '1': '', '2': '' }