michaelb/sniprun

`../sniprun` is not executable

PorcoRosso85 opened this issue · 17 comments

Describe the bug
../sniprun is not executable

To Reproduce
Steps to reproduce the behavior:

  1. install rustup to nixos
  2. install cargo and rustc with rustup
  3. install sniprun as below

Expected behavior
execute sniprun

Screenshots
スクリーンショット 2023-03-03 9 47 27
スクリーンショット 2023-03-03 9 42 48

Environment:

  • Neovim version 0.8.1
  • OS/distribution nixos

Additional context

:checkhealth sniprun might provide welcome additional information

Linking old nixos issues here so I don't forget #137

I'm so sorry to forget use checkhealth.
スクリーンショット 2023-03-03 20 22 36

I'll check #137 and #107

@michaelb

Is there the case that binary cannot be found despite installation is done?
If there is the way to check any log, I want to know how to fix bug.

Then I suspect the installation hasn't been done

It can happen when a plugin manager installs the plugin (but this fails because no internet / no rust toolchain), then you restore connectivity / install rust. Most plugins manager won't update or reinstall the plugin even if you tell them to because they think everything is up to date.

A common fix would be to remove the plugin, ensuring the path to the repo sniprun ( you see that in your first error ) doesn't exist anymore, and then installing again.

There may be nix shenanigans and I'm not familiar with that, so the 'manual' way would be to to cargo build --release (equivalent to the bash./install.sh 1 you should have in your plugin manager's config) from sniprun's repo

スクリーンショット 2023-03-04 18 11 07

I've done these:

  1. rm -r $HOME/.local/share/nvim/plugged/sniprun/
  2. re-install plugin ( with vimplug )
  3. cargo build --release in cloned your repo -> unsuccess
  4. sh $HOME/.local/share/nvim/plugged/sniprun/install.sh 1 -> unsuccess

Is there suspected item to check else?

Well that's kind of a first time sniprun doesn't work this much. And I've had NixOS users who succeeded, so this has no reason to not be doable.

Since the binary is reported to 'crash at start' (checkhealth) but also appear to be compiled successfully, I'm very curious about what happens if you just ... run it.

$HOME/.local/share/nvim/plugged/sniprun/target/release/sniprun

The normal behavior would be to display nothing, and block the terminal until ctrl-c (waiting for rpc communication that won't happen). Maybe we'll have a useful message there.
If there's nothing, maybe we could try to get the backtrace (export RUST_BACKTRACE=1) or run it through debugging tools.

Seeing similar issues in the latest MacOS. Looks like sniprun is failing to build but install.sh ignores the failure. If I try to cargo build --release manually I see:

$ cargo build --release
error: failed to determine package fingerprint for build script for sniprun v1.2.12 (/Users/matt.anger/.local/share/nvim/lazy/sniprun)

Caused by:
  failed to determine the most recently modified file in /Users/matt.anger/.local/share/nvim/lazy/sniprun

Caused by:
  failed to determine list of files in /Users/matt.anger/.local/share/nvim/lazy/sniprun

Caused by:
  failed to open git index at /Users/matt.anger/.local/share/nvim/lazy/sniprun/.git/

Caused by:
  invalid data in index - calculated checksum does not match expected; class=Index (10)

I tried deleting and recreating the git repo, doing a git reset --hard origin/master, all still exhibit the issue. I've tried both latest stable and beta rust toolchains:

cargo --version
cargo 1.69.0-beta.1 (9880b408a 2023-02-28)

It doesn't look like the same issue exactly. @PorcoRosso85 is able to compile the binary, at least. (@PorcoRosso85 , what happens if you directly run the binary from the command line ???)

I don't know what kind of ninja mutant computer can produce your error @AngerM and google is not very talkative about this one. I'm (of course-wouldn't be fun otherwise) not able to reproduce this, be it on stable (1.68), beta (1.69) or nigthly (1.70), from the repo auto-cloned by my package manager (packer).
You could always try to clone this repo independently and compile there (and if it still fails, delete the .git/ folder ?)

Super weird. Had it happen on multiple different machines all with the same error. Doing

$ mv .git .gitbackup
$ cargo build -r
$ mv .gitbackup .git

seems to allow it to build?

Hi.
It worked, thank :)
Maybe, @michaelb ’s documentation is enough also for nixos user.

If anything should be added, it's maybe better for us that there is representation in more detail for manually installation.

It worked

What worked, and what did you do ? Is your original issue solved ?

I'm a little in the dark here, and while I'll gladly document more comprehensively the install procedure on NixOS, I could use some help

Sure (always better than nothing)

using cargo in nixos, there are some choices to install it

  1. not use nixpkgs
  2. use nixpkgs for rustup, and then install cargo using rustup
  3. use nixpkgs for cargo itself

if choose 1
maybe nothing is different to other users

if choose 2 or 3
cargo won't create $HOME/.cargo
so, anyone has to configure the path of cargo themselves
I choosed 2

nixos user maybe have to choose this way:
https://michaelb.github.io/sniprun/sources/README.html#or-install-sniprun-manually

but, as @michaelb told me as below in this issue, some tasks are required

if we add more info to your documentations for stupid user like me,
for example

or install sniprun manually
I trust you know how to add a plugin to the runtimepath, just don’t forget to run ./install.sh, or alternatively, cargo build --release to fetch/build the binary.
or install sniprun manually
I trust you know how to add a plugin to the runtimepath, 

- just don’t forget to run ./install.sh, 
- or alternatively, cargo build --release to fetch/build the binary
  - copy binary to neovim data path, such as ' $HOME/.local/share/nvim/plugged/sniprun/target/release/sniprun'

@michaelb
I can request a PR if you accept this doc's change

And certainly if there was a little more output in install.sh, I might not have asked the question here either.
When I have more time and further thought to organize, I will suggest a little output as well, if @michaelb is open to it.

Hey, I updated the documentation to better explain how to install sniprun on NixOS

You're welcome to suggest improvements to the install script verbosity if you want to