SAFE Drive - help with testing

Thank you for the help! Once I’m done I’ll do a pass on smoothing this path out for anyone who comes after.

Hopefully I’ll have time to work in this on Sunday.

3 Likes

You are already doing that, but yes, keep notes and let’s iron out those kinks. Really good work, and enjoy your other time too of course. No pressure here, just appreciation :slight_smile:

3 Likes

I have the .dll files in the specified directory.

I found and copied weakref.node, binding.node, ffi_bindings.node and node-57.node to the same directory as the .exe file.

However I still have the same error message. I think the problem is that the node-57.node file is not built for Windows.

I tried building it manually with prebuild --target 57 --path node_modules\fuse-bindings\ and putting the file in the resulting .tar.gz in the .exe directory, but it didn’t work. Tried renaming it to node-57.node, but it didn’t work.

I don’t know if I’m on the right track here, any ideas? :slight_smile:

EDIT BY: @happybeing: I wonder if @bzee has any ideas?

1 Like

I think the issue is not the .node files. That solution was helpful when distributing the executable to other machines to make it work — don’t think it applies here.

This exact issue is what I encountered a month back when helping @happybeing and I did not get it to work. However, for testing purposes you could use node bin instead of trying to package it and running the package… node bin runs fine, so the issue must be related to packaging it.

2 Likes

It’s fairly easy using fs-extra:

const child_process = require('child_process');
const fs = require('fs-extra');

const path_prod = './dist/prod/node_modules/@maidsafe/safe-node-app/src/native/prod/';

// mkdir -p
fs.ensureDirSync(path_prod);

// cp -r
fs.copySync('./node_modules/@maidsafe/safe-node-app/src/native/prod/', path_prod);

// Run pkg and direct output to current script
child_process.execSync('pkg . -t host -o ./dist/prod/mount-safe', { stdio: [ 0, 1, 2 ] });

Just put in a file like build.js and node build.js will do the rest. Could also be put in package.json so npm run build will run the above script.

2 Likes

Status update

A small update for superfans of SAFE Drive. Note, as of 11th October these features have been merged into master. One notable missing feature is mkdir/rmdir, which I am working on next.

I have file create, update, delete and rename working so after mounting your SAFE Drive, from the shell you can do stuff like:

$ cd ~/SAFE
$ ls
_public _publicNames
$ ls _public
rsapps
$ ls _public/rsapps
www-root
$ cd _public/rsapps/www-root
$ ls
index.html 
$ echo 'Hello world' > test.txt
$ cat test.txt 
Hello world
$ cp test.txt test2.txt
$ ls 
index.html test.txt test2.txt
$ cat test2.txt
Hello world
$ rm test.txt
$ ls
index.html test2.txt

I recommend not opening your SAFE drive in a file manager. This will almost certainly hang, or at least behave as if it has as soon as you open a folder or two. Really it is just making an endless series of calls to get status on everything in sight which will slow everything down even on a powerful computer.

Also, it will probably fail if you try saving from an application like an editor. (See update on this at the end of this post).

Files should load into applications OK, but saving will both be slow and then fail if the app tries to save safely (using file rename, because that is not implemented yet). And of course the application’s file open dialog is a file explorer, so best to open using the command line (eg gedit ~/SAFE/_public/rsapps/www-root/index.html).

You can create and access files on your SAFE public storage, but many things will just not work.

So this is only for the very curious, or the person who wants to help find bugs. And certainly not for trusting with any valuable data!

Please let me know if you have a play. There isn’t a release build of this so you will have to grab the master dev-savefile branch in both safenetworkjs and safenetwork-fuse repos, and in the latter run with node run bin.js - see the repo for instructions, or ask if you need help.

Windows

@bzee has some success on Windows today, so watch this space. I think all he did was change the drive setting in bin.js from I:\ to M:\ so anyone in Windows could try this after installing the dependencies (just Dokany I think - again, see the repo for instructions).

Mac OSX

SAFE Drive is asking the browser for authorisation but not receiving the acceptance. We have though called @joshuef back from Japan to look into this :wink:, so hopeful Mac testing will also be possible soon.

Update: today I implemented rename, so you can also use ‘mv’ to rename files or move them to an existing directory. Unfortunately gedit file editor still doesn’t work, but vi at least is happy to edit files. Note that it does not support renaming of directories because it would be difficult to implement for little benefit, because the way SAFE NFS works, renaming directories could create problems by quickly filling up a container with deleted entries, and prevent you from adding new files.

4 Likes

I get an error when I run node bin:

PS E:\Project\program\javascript\safenetwork-fuse> node bin
module.js:682
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: The specified module could not be found.
\\?\E:\Project\program\javascript\safenetwork-fuse\node_modules\fuse-bindings\build\Release\fuse_bindings.node
    at Object.Module._extensions..node (module.js:682:18)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at load (E:\Project\program\javascript\safenetwork-fuse\node_modules\node-gyp-build\index.js:13:10)
    at Object.<anonymous> (E:\Project\program\javascript\safenetwork-fuse\node_modules\fuse-bindings\index.js:1:99)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
PS E:\Project\program\javascript\safenetwork-fuse>

Did I miss some step? I went through all steps from the beginning again but can’t get it to work.

1 Like

Did you perhaps cut the .node files instead of copy when you put them in the same directory as the .exe?

That file must have been generated after npm install. Try removing ./node_modules/fuse-bindings/ and run npm install again.

2 Likes

Update:

Today I implemented file rename, so you can now use ‘mv’ to rename files or move them to an existing directory. Unfortunately gedit file editor still doesn’t work, but vi at least is happy to edit files.

Note that it does not support renaming of directories because it would be difficult to implement for little benefit. This is because the way SAFE NFS works means that renaming directories could create problems by quickly filling up a container with deleted entries, and prevent you from adding any new files.

These changes have now been merge to master.

2 Likes

I successfully ran it with node bin. I think the issue was that I had forgotten to do npm link safenetworkjs after doing npm install :sweat_smile:. Thank you for the help!

I’m not able to make it work though it seems.

Admin PowerShell

If I run it in an admin PowerShell I get this message when running it:

PS E:\Project\program\javascript\safenetwork-fuse> $env:NODE_ENV = "dev"
PS E:\Project\program\javascript\safenetwork-fuse> node bin
Server path not specified, so defaulting to ipc.config.socketRoot + ipc.config.appspace + ipc.config.id /tmp/app.6032
starting server on  /tmp/app.6032
starting TLS server false
starting server as Unix || Windows Socket

This instance should quit. Ciao!

Then when I accept the authentication in Peruse, a node.exe console window pops up that prints out the following message forever:

######
error:  { Error: connect EPERM \\.\pipe\tmp-app.9160
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
  errno: 'EPERM',
  code: 'EPERM',
  syscall: 'connect',
  address: '\\\\.\\pipe\\tmp-app.9160' }
connection closed 9160 /tmp/app.9160 Infinity tries remaining of Infinity
requested connection to  9160 /tmp/app.9160
Connecting client on Unix Socket : /tmp/app.9160

Non admin PowerShell

If I run it in a non-admin PowerShell I get the following output in my PowerShell:

PS E:\Project\program\javascript\safenetwork-fuse> $env:NODE_ENV = "dev"
PS E:\Project\program\javascript\safenetwork-fuse> node bin
Server path not specified, so defaulting to ipc.config.socketRoot + ipc.config.appspace + ipc.config.id /tmp/app.2948
starting server on  /tmp/app.2948
starting TLS server false
starting server as Unix || Windows Socket

This instance should quit. Ciao!

Then when I accept the authentication in Peruse, it flashes what looks like the node.exe console window and prints out this in the PowerShell:

## socket connection to server detected ##
received event of :  auth-uri { id: '2948-cli',
  message: 'safe-c2fmzw5ldhdvcmstznvzzq:AQAAAMQlnhEAAAAAAAAAACAAAAAAAAAAhC7wEqSTZyC05pDPGHyY-i6-5hZOiAxeRHcOiQPAEXkgAAAAAAAAAKsm-zHuZlZXSS5aKe3wCZqL64dNyAFMhByXm6ZrWdn3IAAAAAAAAACAKkrtcXzv6JF7FAujWoiXpTj9ncmsC4Dvn8K2VZYL4kAAAAAAAAAANoZ-fcwbTAPOpn5BgiFZOTEfuq65r_DTFVj3-uRPGdCAKkrtcXzv6JF7FAujWoiXpTj9ncmsC4Dvn8K2VZYL4iAAAAAAAAAAr7f2K2jms5Pq-88-PAIWfvp9P1SChKkn0kGX4_rZMnUgAAAAAAAAAIopW2v7ctf_IcOOxmzacoEcXQSKFVfWWBinbsXAyo-9AAAAAAAAAAAAAAAAAAAAAAuRF5vh3DD-SEIl36YY8EQdRkgQgwrecIJ-XI7QF23_mDoAAAAAAAAYAAAAAAAAAPkqIEUwHWLDw3MrqS5f9XmUaegqSCGnrgIAAAAAAAAADAAAAAAAAABfcHVibGljTmFtZXNLqcoJ3JfrFgmRlhiuvTyl12z08o9asVMsGAVp_k62sZg6AAAAAAAAASAAAAAAAAAA6OXDor9jkx0OPFT7QJ4IAXSC38Q24GhniqRddA_2S2cYAAAAAAAAAFgBuukcPrsHWQe_e5wbsYQtVZMZf0ixcgAEAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAHAAAAAAAAAF9wdWJsaWP3Mg2wMuUZ_dJwkjPcUwsggqMwM9d2-U-5EAWHlz0CF5g6AAAAAAAAAAAEAAAAAAAAAAAAAAABAAAAAgAAAAMAAAA' }
socket disconnected 2948-cli

And a Node.js process lies taking up a bunch of CPU and memory in the Task Manager until I close the PowerShell window. Ctrl+C doesn’t do anything in the PowerShell to stop the process:
image


I’ve tried changing the drive letter in the bin.js file, as I saw somewhere that that made it work for someone, but no difference.

I’m on really deep water now in terms of knowing what I’m doing, so I hope I’m not being too much of an annoyance with my need of help with getting this to work!

1 Like

God work @lukas. I don’t know about Windows specific stuff, but a couple of observations:

  • I have not been using the mock network, only live, because it didn’t work at all with mock (a while back) so suggests you stop using NODE_ENV at all, and make sure you are using a browser that is connecting to the live network (eg not a ‘-dev’ zip, or with the --live flags when using a Dev build of the browser)
  • if you use the DEBUG=safe-fuse*,safenetworkjs* settings (see safenetwork-fuse README) you will get useful debug to the terminal where you run node bin
  • you can also use the Chrome debugger at the same time, again see the README

How that helps, and @bzee may be able to see what is wrong for Windows.

Well done for figuring out the npm link issue. You have to redo it after any npm install inside safenetwork-fuse. That’s caught me out a few times. :slight_smile:

I only got the drive letter to work with another fuse-bindings example (mafintosh/fuse-bindings#usage).

However, what got me a little further was when not using a drive letter but an absolute path, which is what is used in bin.js when not on Windows (path.join(Os.homedir(), 'SAFE')).

1 Like

I’m getting the same errors when running the process without the dev environment variable and on the live network.

I changed the mountPath variable to be (path.join(Os.homedir(), 'SAFE')), and when I do that while the command line is running I get a SAFE shortcut in my home directory.

image

I can’t enter it in explorer (which I wasn’t supposed to do anyway, but I had to try :stuck_out_tongue: ), I get an error message like this when I do:

[Window Title]
Location is not available

[Content]
C:\Users\Lukas\SAFE is not accessible.

Incorrect function.


[OK]

I can enter it on the command line, and when I write ls in the directory I get the following error:

PS C:\Users\Lukas> cd SAFE
PS C:\Users\Lukas\SAFE> ls
ls : Incorrect function.
At line:1 char:1
+ ls
+ ~~
    + CategoryInfo          : ReadError: (C:\Users\Lukas\SAFE:String) [Get-ChildItem], IOException
    + FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChildItemCommand

I ran it with DEBUG=safe-fuse*,safenetworkjs* to get some more output:

PS E:\Project\program\javascript\safenetwork-fuse> $env:DEBUG = "safe-fuse*,safenetworkjs*"
PS E:\Project\program\javascript\safenetwork-fuse> node bin
  safenetworkjs:web SafenetworkApi() +0ms
  safenetworkjs:web SafenetworkApi.initialise() +0ms
  safe-fuse:bin try bootstrap()... +0ms
  safenetworkjs:cli __dirname: E:\Project\program\javascript\safenetworkjs\src +46ms
  safenetworkjs:cli
  safenetworkjs:cli Safe.bootstrap()
  safenetworkjs:cli   with appInfo: {"id":"safenetwork-fuse","name":"SAFE Network FUSE","vendor":"theWebalyst"}  argv: {"_":[],"version":false,"help":false,"$0":"bin"} +0ms
  safenetworkjs:cli getLibPath() returning:  E:\Project\program\javascript\safenetwork-fuse\node_modules\@maidsafe\safe-node-app\src\native +0ms
  safenetworkjs:cli call Safe.initializeApp()... +0ms
  safenetworkjs:cli call app.auth.genAuthUri()... +16ms
  safenetworkjs:cli bootstrap.authorise() with appInfo: {"id":"safenetwork-fuse","name":"SAFE Network FUSE","vendor":"theWebalyst","customExecPath":["D:\\Program\\nodejs\\node.exe","E:\\Project\\program\\javascript\\safenetwork-fuse\\bin","--pid","4760","--uri"]}appContainers: {"_public":["Read","Insert","Update","Delete"],"_publicNames":["Read","Insert","Update","Delete"]} +0ms
  safenetworkjs:cli wait a mo +62ms
  safenetworkjs:cli ipcReceive(4760) +0ms
  safenetworkjs:cli ipcReceive(4760) +0ms
Server path not specified, so defaulting to ipc.config.socketRoot + ipc.config.appspace + ipc.config.id /tmp/app.4760
starting server on  /tmp/app.4760
starting TLS server false
starting server as Unix || Windows Socket

This instance should quit. Ciao!
## socket connection to server detected ##
received event of :  auth-uri { id: '4760-cli',
  message: 'safe-c2fmzw5ldhdvcmstznvzzq:AQAAAG1lR60AAAAAAAAAACAAAAAAAAAAKPmSmuywj7Mm6MAvdSTGNDszE1Eimrzef63D7nMPz0QgAAAAAAAAAPO8m4zti7Th1Q7_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Q4viYOgAAAAAAAAEgAAAAAAAAAMlfKi4zl3BHs80vunzGPYr_mS0mHcjiTNer_sI6RNo2GAAAAAAAAABf4Vw8PVFa1au5cLJogfNJljQq-U-_NTkABAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABwAAAAAAAABfcHVibGlj8LofFjSaeuW78i8agBTOGWoLLt90Z2AaBw9bmX_9hDGYOgAAAAAAAAAABAAAAAAAAAAAAAAAAQAAAAIAAAADAAAA +3s
socket disconnected 4760-cli
  safenetworkjs:web SafenetworkApi.initialise() +3s
  safe-fuse:vfs:index Fuse.mount() at C:\Users\Lukas\SAFE +0ms
Dokan: debug mode on
Dokan: use stderr
AllocationUnitSize:   safe-fuse:bin Mounted SAFE filesystem on C:\Users\Lukas\SAFE +6s
512 SectorSize: 512
device opened
CreateMountPoint C:\Users\Lukas\SAFE -> \??\Volume{d6cc17c5-173c-4085-bce7-964f1e9f5de9}\ success
mounted: C:\Users\Lukas\SAFE -> \Volume{d6cc17c5-173c-4085-bce7-964f1e9f5de9}
Mounted
###Create 0000
CreateFile: \
        DesiredAccess: SYNCHRONIZE|FILE_READ_ATTRIBUTES
        ShareAccess: FILE_SHARE_WRITE|FILE_SHARE_READ
        Disposition: FILE_OPEN (1)
        Attributes: 0 (0x0)
        Options: 17 (0x11)
  safe-fuse:ops getattr('/') +0ms
  safe-fuse:vfs:index getHandler(/) +1s
  safe-fuse:vfs:root getHandlerFor(/) - safePath: /, mountPath: \/ +0ms
  safe-fuse:vfs:root RootHandler for / mounted at \/ getattr('/') +0ms
  safe-fuse:ops getContainer() - no container object ready for / +0ms
CreateFile status = c0000002
###QueryVolumeInfo -001
GetVolumeInformation
###Create 0001
CreateFile: \
        DesiredAccess: SYNCHRONIZE
        ShareAccess: 0x0
        Disposition: FILE_OPEN (1)
        Attributes: 0 (0x0)
        Options: 8388641 (0x800021)
  safe-fuse:ops getattr('/') +15ms
  safe-fuse:vfs:index getHandler(/) +15ms
  safe-fuse:vfs:root getHandlerFor(/) - safePath: /, mountPath: \/ +15ms
  safe-fuse:vfs:root RootHandler for / mounted at \/ getattr('/') +0ms
  safe-fuse:ops getContainer() - no container object ready for / +0ms
CreateFile status = c0000002
###Create 0002
CreateFile: \desktop.ini
        DesiredAccess: FILE_GENERIC_READ
        ShareAccess: FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ
        Disposition: FILE_OPEN (1)
        Attributes: 0 (0x0)
        Options: 100 (0x64)
  safe-fuse:ops getattr('/desktop.ini') +16ms
  safe-fuse:vfs:index getHandler(/desktop.ini) +16ms
  safe-fuse:vfs:index getHandler(/) +0ms
  safe-fuse:vfs:root getHandlerFor(/) - safePath: /, mountPath: \/ +22ms
  safe-fuse:vfs:root getHandlerFor(/desktop.ini) - safePath: /, mountPath: \/ +0ms
  safe-fuse:vfs:root RootHandler for / mounted at \/ getattr('/desktop.ini') +0ms
  safe-fuse:ops getContainer() - no container object ready for /desktop.ini +7ms
CreateFile status = c0000034
###Create 0003
CreateFile: \
        DesiredAccess: SYNCHRONIZE|FILE_READ_ATTRIBUTES
        ShareAccess: FILE_SHARE_WRITE|FILE_SHARE_READ
        Disposition: FILE_OPEN (1)
        Attributes: 0 (0x0)
        Options: 17 (0x11)
  safe-fuse:ops getattr('/') +7ms
  safe-fuse:vfs:index getHandler(/) +15ms
  safe-fuse:vfs:root getHandlerFor(/) - safePath: /, mountPath: \/ +10ms
  safe-fuse:vfs:root RootHandler for / mounted at \/ getattr('/') +0ms
  safe-fuse:ops getContainer() - no container object ready for / +3ms
CreateFile status = c0000002
###Create 0004
CreateFile: \.sync\ID
        DesiredAccess: FILE_READ_ATTRIBUTES
        ShareAccess: FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ
        Disposition: FILE_OPEN (1)
        Attributes: 0 (0x0)
        Options: 2097152 (0x200000)
  safe-fuse:ops getattr('/.sync/ID') +38ms
  safe-fuse:vfs:index getHandler(/.sync/ID) +41ms
  safe-fuse:vfs:index getHandler(/.sync) +0ms
  safe-fuse:vfs:index getHandler(/) +1ms
  safe-fuse:vfs:root getHandlerFor(/) - safePath: /, mountPath: \/ +41ms
  safe-fuse:vfs:root getHandlerFor(/.sync) - safePath: /, mountPath: \/ +1ms
  safe-fuse:vfs:root getHandlerFor(/.sync/ID) - safePath: /, mountPath: \/ +0ms
  safe-fuse:vfs:root RootHandler for / mounted at \/ getattr('/.sync/ID') +0ms
  safe-fuse:ops getContainer() - no container object ready for /.sync/ID +4ms
CreateFile status = c0000034
###Create 0005
CreateFile: \.sync\ID
        DesiredAccess: FILE_READ_ATTRIBUTES
        ShareAccess: FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ
        Disposition: FILE_OPEN (1)
        Attributes: 0 (0x0)
        Options: 2097152 (0x200000)
  safe-fuse:ops getattr('/.sync/ID') +52ms
  safe-fuse:vfs:index getHandler(/.sync/ID) +55ms
  safe-fuse:vfs:index getHandler(/.sync) +0ms
  safe-fuse:vfs:index getHandler(/) +1ms
  safe-fuse:vfs:root getHandlerFor(/) - safePath: /, mountPath: \/ +55ms
  safe-fuse:vfs:root getHandlerFor(/.sync) - safePath: /, mountPath: \/ +1ms
  safe-fuse:vfs:root getHandlerFor(/.sync/ID) - safePath: /, mountPath: \/ +0ms
  safe-fuse:vfs:root RootHandler for / mounted at \/ getattr('/.sync/ID') +0ms
  safe-fuse:ops getContainer() - no container object ready for /.sync/ID +4ms
CreateFile status = c0000034
###Create 0006
CreateFile: \
        DesiredAccess: SYNCHRONIZE|FILE_READ_DATA
        ShareAccess: FILE_SHARE_DELETE|FILE_SHARE_WRITE|FILE_SHARE_READ
        Disposition: FILE_OPEN (1)
        Attributes: 0 (0x0)
        Options: 33 (0x21)
  safe-fuse:ops getattr('/') +6s
  safe-fuse:vfs:index getHandler(/) +6s
  safe-fuse:vfs:root getHandlerFor(/) - safePath: /, mountPath: \/ +6s
  safe-fuse:vfs:root RootHandler for / mounted at \/ getattr('/') +0ms
  safe-fuse:ops getContainer() - no container object ready for / +0ms
CreateFile status = c0000002

###Create 0006 and below came up when I wrote ls in the directory, which generates the error message shown earlier in that terminal.

It looks to me like it might be working at some level, maybe it just needs some folders to list? How can I make sure I have some data on the network that would be able to show up when I do an ls in the SAFE mount point?

It certainly is working at some level. This is looking good. If you look in bin.js you’ll see that from the following message it appears to have successfully mounted:

 safe-fuse:bin Mounted SAFE filesystem on C:\Users\Lukas\SAFE +6s

The subsequent messages starting with safe-fuse: are from the safenetwork-fuse code. Apart from the messages about authorisation near the start, I don’t see any from safentworkjs yet, but that’s to be expected as you would need to try accessing a path that required access to SAFE API for that.

The rest of the messages are from fuse-bindings itself so I don’t have details of what they all mean but one can usually make some sense of them.

What you should see if you ls [or rather dir on Windows as @drehb just reminded me!] your SAFE folder are two sub-folders: _public and _publicNames. Since you don’t that’s the first thing to look into.

If you can get the debugger working (see README) you could start things up, and let those messages settle down.

Then set a breakpoint in say safenetwork-fuse/fuse-operations/gettattr.js and see why, after the message safe-fuse:ops getattr('/') it doesn’t find a suitable ’ container object ready for /

It is almost certainly because I haven’t got the right path separator so it is failing to find a mount handler or suitable container. The path ‘/’ (or perhaps ‘\’) should be handled by the RootHandler and RootContainer (which are in safenetwork-fuse) and are what cause _public and _publicNames to appear at that path.

Good stuff. Have a poke around and you may well be able to fix this!

You don’t need to do this yet, but once you have dir showing _public and _publicNames use the Maidsafe Web Hosting Manager to create a public name and upload some files (or use the create website from template feature). Details on the main forum somewhere. You should see the results of that when you list the contents of _public and _publicNames

1 Like

@lukas I think you just need to use ‘dir’ instead of ‘ls’ since you’re using Windows.

2 Likes

P. S.

Rather than:

C:\Users\Lukas\SAFE> dir

I recommend not changing directory to you SAFE Drive. Instead try:

C:\Users\Lukas> dir C:\Users\Lukas\SAFE

I’ve written some code now that should get over that issue (fingers crossed). But it is complex, and I’ve not tried running any of it yet - so don’t hold your breath :wink:

1 Like

@happybeing I’ll read your responses more closely and try it out tomorrow Friday! :slight_smile:

@drehb PowerShell has ls, probably just an alias for dir, but I’m used to ls.

1 Like

Ah, didn’t realize that. Microsoft is much more Linux friendly these days indeed :slight_smile:

I got breakpoints working.

Running latest master.

I can’t get it to work though.

And I can’t figure out what’s wrong in the code.

Think I’ve run out of steam on this.

I found that this is where the error message comes from, line 150 in root.js:

    // This handler's container is not mounted yet so attempt to mount it
    if (this._mountPath !== '/') {
      // This RootHandler is for a SAFE root container
      if (this._lazyInitialise) {
        // Make it on demand (lazy)
        return this.initContainer(rootContainerName)
      } else {
        // Either itemPath should not be handled here (so a bug elsewhere)
        // or perhaps the constructor has not finished creating containers
        throw new Error('getContainer() - no container object ready for ' + itemPath)

this._mountPath is "\/"
and this._lazyInitialise is false, making it throw that error.

Excellent, well done. The error you found looks like the kind of thing I was expecting to have messed up, so very useful.

Can you see why the mountPath is “\/” and not “/”?

The code you show is in the RootHandler, which appears not to have this._container set, which should happen here:

That mirrors what you are seeing late in getContainer() so the issue might be that for some reason the RootHandler is being created with mountPath “\/” instead of “/”. This sounds very like a Windows v Linux thing so I reckon you are onto something if you can see where the RootHandler’s this._mountPath and change the code responsible to set it to “/” instead of “\/”. Probably here:

If you fancy having another go, try setting a breakpoint there and watch the creation of the RootHandler’s container, a RootContainer object. Keep an eye on why this._mountPath doesn’t end up as “/”.

Hopefully I’m pointing in the right direction! A bit tricky debugging like this :slight_smile: but I’m sure you are on the right track.

Update:

@lukas I’ve been looking around in safenetwork-fuse/src/safe-vfs/root.js and I have a hunch that you should try replacing every occurrence of path.sep with '/'. I don’t think it should be using path.sep at all.