Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: spawn lsof ENOENT on snow init #247

Open
belkarx opened this issue Oct 7, 2021 · 3 comments
Open

Error: spawn lsof ENOENT on snow init #247

belkarx opened this issue Oct 7, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@belkarx
Copy link

belkarx commented Oct 7, 2021

Describe the bug
After compiling snow, if I try to run snow init (while in a newly created directory), node spits out

node:events:342
      throw er; // Unhandled 'error' event
      ^

Error: spawn lsof ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn lsof',
  path: 'lsof',
  spawnargs: [ '-X', '-F', 'pcan', '+D', 'hey' ]
}

The .snow folder is still created, however if I try to run snow add . (and a few other snow commands), I get the error

No HEAD found
fatal: no reference nor HEAD found

In .snow/log/mainlog, there is 1 line: 1633564812686 -0700 $> init: initialized at /home/[filepath]/test_snow, so the repo seems to have initialized successfully, but all other (non-log) folders in .snow are empty.

To Reproduce
Steps to reproduce the behavior:
[be using zsh/linux/ext4]

  1. Compile snow via the instructions on the README
  2. Create a folder, switch to it, and snow init
    ^ this will cause a node error
  3. copy a file into the current folder and execute snow add .
    ^ this will raise a "no HEAD found" error

Expected behavior
snow init shouldn't throw any errors, and snow add . shouldn't fail

Desktop (please complete the following information):

  • OS: Arch Linux (x86 with Node.js installed)

Additional context
I'm a node newbie so maybe I made some sort of obvious mistake ... if I did, I'm sorry for wasting your time

@daniellanner daniellanner added the bug Something isn't working label Oct 7, 2021
@sebastianrath
Copy link
Contributor

sebastianrath commented Oct 7, 2021

Hey belkrax, thanks so much for your report! Interesting, it seems your Linux OS doesn't support lsof. If you change this line:

https://github.com/Snowtrack/snowfs/blob/c1e27daaf92b79c9524c5d8cf8a70e600862b1d8/src/io_context.ts#L700

to

return Promise.resolve();

you should be more successful. Could you try this again and we go to the next step to find a solution for the missing lsof process on your system.

@belkarx
Copy link
Author

belkarx commented Oct 7, 2021

I grabbed the lsof package (in hindsight the issue was obvious but I'm unused to node error messages) and everything works now. Thank you!

@belkarx belkarx closed this as completed Oct 7, 2021
@sebastianrath sebastianrath reopened this Oct 7, 2021
@sebastianrath
Copy link
Contributor

I still think there is room for improvement in this code. We can either improve the error message, find an alternative on Linux, or skip lsof on machines where it doesn't exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants