In case anyone fancies diving into a tricky error while using SAFE for decentralising git repositories (that would be cool wouldn’t it), I’ve created an issue with details of how to reproduce it.
It might help just to have someone else run through this and discuss it with me, so don’t feel you need to be an expert (I’m not clearly ) to help with this. I’ll be happy to help anyone get set up, so it would be a useful learning for anyone who wants that.
opened 04:16PM - 29 Jan 19 UTC
closed 01:45PM - 31 Jan 19 UTC
bug
help wanted
The bug here is probably in SafenetworkJS, but SAFE Drive is needed to investiga… te and fix it, so filing here.
To reproduce you need to be set up for development on SAFE Network using SAFE Browser.
OS Ubuntu 18.10
SAFE Browser 11.1
git 2.19.1
safenetwork-fuse master branch
safenetworkjs master branch
## To reproduce the error:
1) Make a copy of the safenetworkjs git repository in `sjs.git` just for testing:
```
cp -r safenetworkjs sjs.git
```
2) Start SAFE Browser (v11.1 or later) **dev build** and create / sign into an account:
```
safe-browser --debug
```
3) Start SAFE Drive with `NODE_ENV=test` to select mock SAFE Network, `SAFENETWORKJS_TESTS=testing` to create a test container, and `DEBUG=` to generate console debug output, and 'Accept' any auth requests in the browser. For example:
```
NODE_ENV=test SAFENETWORKJS_TESTS=testing DEBUG=safe-fuse:ops*,safe-fuse:stub*,safenetworkjs:file* node --inspect-brk bin.js
```
Note: `--inspect-brk` (or `--inspect`) enables you to connect with the Chromium/Chrome debugger by visiting `chrome://inspect/#devices` and clicking 'Open dedicated DevTools for Node'.
For details of how to setup your debug environment, see [Development](https://github.com/theWebalyst/safenetwork-fuse#development) in the README.
4) Check your SAFE Drive is ready:
```
$ ls ~/SAFE
_public _publicNames
```
5) Initialise a bare headless git repo in the test container, exactly as follows:
```
cd ~/SAFE/_public/tests/data1
git init --bare blah
```
6) Inside `sjs.git` execute the following commands in order:
```
cd <your path to sjs.git>
git remote remove origin
git remote add origin ~/SAFE/_public/tests/data1/blah
git push origin master
```
The `git push` output should be similar to this:
```
Enumerating objects: 373, done.
Counting objects: 100% (373/373), done.
Delta compression using up to 8 threads
Compressing objects: 100% (371/371), done.
Writing objects: 100% (373/373), 192.45 KiB | 26.00 KiB/s, done.
Total 373 (delta 255), reused 0 (delta 0)
remote:
warning: die() called many times. Recursion error or racy threaded death!
remote: fatal: premature end of pack file, 65 bytes missing
remote: warning: die() called many times. Recursion error or racy threaded death!
error: remote unpack failed: index-pack abnormal exit
To /home/mrh/SAFE/_public/tests/data1/blah
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '/home/mrh/SAFE/_public/tests/data1/blah'
```
The message `remote: fatal: premature end of pack file, 65 bytes missing` occurs because inside git (built from source code), while git is parsing the 'pack' file `xpread()` in `git/index-pack.c / unpack_data()`, prematurely returns zero bytes. Examining the SAFE Drive console output appears to show no errors, and that the last readFile() returned data as expected. So it isn't clear if the cause of problem is in SafenetworkJs, fuse-bindings or git.
Note: the above error can be avoided by setting a breakpoint in `safenetworkjs/src/nfs-files.js` `openFile()` in the `else` block ("// Handle failure to open file", about [here](https://github.com/theWebalyst/safenetworkjs/blob/master/src/nfs-files.js#L513)). Just hitting the breakpoint and restarting execution avoids this error, although a different error occurs soon afterwards. The second failure is a different error, so the effect of pausing at the breakpoint for a few seconds may be a clue to the first error above.
Here's what the output looks like if you set the breakpoint, and restart immediately:
```
$ git push origin master
Enumerating objects: 373, done.
Counting objects: 100% (373/373), done.
Delta compression using up to 8 threads
Compressing objects: 100% (371/371), done.
Writing objects: 100% (373/373), 188.27 KiB | 56.00 KiB/s, done.
Total 373 (delta 255), reused 0 (delta 0)
remote: Resolving deltas: 100% (255/255), done.
remote: error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
remote: error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
remote: error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
remote: error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
remote: fatal: bad object 7190c86957ae10cb437fc1ad05a34932326e4dff
error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
error: packfile /home/mrh/SAFE/_public/tests/data1/blah/./objects/incoming-2SiG0E/pack/pack-993ba7c0c3854f7cdbbc976ad9f6db3e9ce9b138.pack does not match index
fatal: bad object 7190c86957ae10cb437fc1ad05a34932326e4dff
To /home/mrh/SAFE/_public/tests/data1/blah
! [remote rejected] master -> master (missing necessary objects)
error: failed to push some refs to '/home/mrh/SAFE/_public/tests/data1/blah'
```
The above actually shows how to reproduce two bugs. The second I haven’t looked into much yet, but by all means have a go at either. The second might be unrelated, although one bug often solves another.
2 Likes
I got no error…
$ git push origin master
Counting objects: 571, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (161/161), done.
Writing objects: 100% (571/571), 296.07 KiB | 0 bytes/s, done.
Total 571 (delta 408), reused 571 (delta 408)
To /home/safe/SAFE/_public/tests/data1/blah
* [new branch] master -> master
that’s on the back of a fairly clean install; so, guessing something more complex about your setup is causing a hiccup.
2 Likes
Just seen you replied on github, so moving the discussing to there.
Thanks for having a go - this is very helpful David, I really appreciate it
1 Like
Linux Mint 18.1 Serena
git version 2.7.4
Did you follow the instructions exactly - commands, environment variables etc?
I think so… though I’m down with flu atm so all is a bit foggy.
The only difference seemed trivial that nothing of ~/SAFE existed so I created the two folders and then _public/tests/data1/
Edit: you were prompting for git 2.19.1 … which I missed. That’s the only difference I can spot from the abc you laid down.
1 Like
Ahhh, sounds like you didn’t use SAFE Drive, but created a folder on your local hard drive at ~/SAFE
and pushed to that rather than SAFE.
Edit: you were prompting for git 2.19.1 … which I missed. That’s the only difference I can spot from the abc you laid down
You didn’t miss that, I just added it for reference
1 Like
That was as much as I read into point 4
Check your SAFE Drive is ready:
$ ls ~/SAFE
_public _publicNames
1 Like
I’m not clear if step 4 was OK?
The only difference seemed trivial that nothing of ~/SAFE existed so I created the two folders and then _public/tests/data1/
Can you explain this in more detail? Cheers.
1 Like
Simply, where those didn’t exist, I created them as empty folders - given that’s a common problem that location doesn’t exist.
You’re right, likely I wasn’t using a mounted SAFE Drive… just trying that now for the first time; though while the browser requests authorizing, there isn’t an obvious request from SAFE FUSE…
2 Likes
OK, step 4 will be as described if you have SAFE Drive ready, if not, anything after that isn’t testing it.
1 Like
Following the abc at GitHub - happybeing/safenetwork-fuse: SAFE Drive: access SAFE storage using the file system of Windows, Mac OS and Linux
I can’t seem to get FUSE to do the expected request to authorise.
b) SAFE Browser should come to the front asking you to authorise SAFE FUSE to access your files, so click ‘Authorise’.
which is kind of odd as the focus switches to the browser expecting that, as if it’s been prompted for.
Unclear to me what fix is for that.
1 Like
Sorry David, I could have sworn I’d updated those instructions but I must not have pushed the update. I’ve now done so, but the gist is that:
you should ignore everything about using ‘build’ and ‘mount-safe’ as the build stuff is not working atm.
set up for development as described in the github instructions
you need to mount SAFE Drive using node
in the way I described in the github issue (use the exact command copied and pasted from there)
use SAFE Browser v11.1 (released a few days ago) - Dev build
Thanks again for helping out!
1 Like
draw
February 1, 2019, 10:54am
12
FYI: Git specialists gathering in Brussels today (also at FOSDEM): Git Merge 2024 | September 19—20 — Berlin .
2 Likes