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

--preview does not work #57

Closed
heyarne opened this issue Nov 16, 2022 · 8 comments
Closed

--preview does not work #57

heyarne opened this issue Nov 16, 2022 · 8 comments
Labels
bug Something isn't working good first issue Good for newcomers wontfix This will not be worked on

Comments

@heyarne
Copy link

heyarne commented Nov 16, 2022

Love this utility, it's really neat! Unfortunately --preview doesn't seem to work? I just built 0.17.4 using a custom fork of nixpkgs, and running httm --preview -s looks like this:

image

Then after selecting a file that changed, this is the next screen:

image

As you can see, there's no diff shown. Could this be because of custom FZF settings? Other settings don't seem to influence the appearance of httm (I have a custom cursor for example), but maybe that's a potential source of bugs. I tried just --preview as well as custom commands (--preview='delta {snap_file} {live_file}' and --preview='diff {snap_file} {live_file}'), none seemed to work. Any idea why not?

PS: Maybe if no arguments are specified in --preview, assume that the command just takes arguments in diff order?

@kimono-koans
Copy link
Owner

kimono-koans commented Nov 16, 2022

Could this be because of custom FZF settings?

No, httm is not reliant upon fzf. All facilities are native

  1. First re: the bare --preview, could you check that you have bowie in your PATH?
  2. Second, could you try double quotes around your custom commands?
  3. Third, re: "I just built 0.17.4 using a custom fork of nixpkgs", how is it custom? I'd advise trying to build from the original sources. If, for instance, your nix package chooses not to install bowie and ounce, you won't be able to use the bare --preview.
  4. Fourth, re: debugging, check your sudo execsnoop-bpfcc -x -q output. I'd like to know what commands are executing when you take the steps above.
  5. You have to be able to execute basic shell commands and built-ins (like test and exec and cut). This could also be a bash-ism I've introduced? Could you try running in a bash env?

I'm sorry nothing is immediately obvious as to what exactly your problem is.

@heyarne
Copy link
Author

heyarne commented Nov 16, 2022

I'm using fish 3.5.1, which I didn't mention in the original post.

  1. Neither ounce nor bowie are in nixpkgs and I did not install them in any other way, so that probably explains the bare --preview. There is no error message however, is there any kind of verification done?
  2. Just did that, same result
  3. The fork just bumps the version, other than that it's the same as this package: https://github.com/NixOS/nixpkgs/blob/7d9bc072578398c148b667e7594300736bc09741/pkgs/tools/filesystems/httm/default.nix There's no reference to bowie or ounce as you can see.
  4. Where do I get execsnoop-bpfcc from?
  5. Same result.

Can you provide a link to the missing packages? A quick search for their names didn't turn up anything immediately helpful. Edit: Nevermind, found the links in the README.

@kimono-koans
Copy link
Owner

kimono-koans commented Nov 16, 2022

My guess is that this is something nix specific in the way that it encapsulates the httm env. And probably that, in combination with the non-portability of my base script, and a non-standard shell make this not work.

Re: bare --preview, the nix package is not installing httm the same as the deb or rpm packaged versions. You absolutely need bowie in your PATH. Again, I'd build from source in a clean base environment, with all the tools found in the deb and rpm packages in your PATH.

Given that you have a heterodox environment (take your pick -- you're on an OS with a wonky layout, you're not using a package provided by me, and/or not using my steps to build from source), without more, this would be a WONTFIX as it stands right now. That is -- you (and/or your package maintainer) are going to have to do the extra leg work to run the exact issue to ground (or I'm not going to install nix just to figure it out) and I hope you do! execsnoop could be really helpful here. I know it is for me. It prints the programs/scripts executed with arguments as they are executed on your system. You can find it for nix here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/bpftrace/default.nix

However, I will be changing the base shell script to make it more portable/more error resistant, and to try to make all the possible failure conditions fail with an error (I am executing a script through a library and stderr doesn't show up? Just ugh...), and I will open a branch and provide you a link, so you can build from source, and see if this new script makes any difference for you.

Appreciate you filing this bug, pleased to work with you to resolve, but, as indicated above, you're going to need to most of the hard stuff to root cause before I fix. I hope you understand. Thanks for filing the bug! It will remain open.

@kimono-koans kimono-koans added bug Something isn't working wontfix This will not be worked on help wanted Extra attention is needed good first issue Good for newcomers labels Nov 16, 2022
@kimono-koans
Copy link
Owner

kimono-koans commented Nov 16, 2022

I think fish could also be the source of your issue. httm --preview requires a POSIX shell because it must execute a few basic shell commands, before executing any preview command. Because fish is POSIX non-compliant, it may not be able to do this. Again, try running with bash or zsh to confirm. You may be able to simply add a fish alias wrapping httm in a POSIX compliant shell (dash, bash, zsh...)!

Try with the linked release: https://github.com/kimono-koans/httm/releases/tag/0.17.5

@heyarne
Copy link
Author

heyarne commented Nov 18, 2022

Thank you very much for your information. I will see to look into this ASAP.

@kimono-koans kimono-koans removed the help wanted Extra attention is needed label Nov 18, 2022
@kimono-koans
Copy link
Owner

I am going to close this. bowie is required to be installed, and I've tested personally with fish and it works. Feel free to refile if/when your package includes bowie and you've installed a later versions with perhaps better errors about what is happened. Thanks!

@kimono-koans
Copy link
Owner

I'm closing again with this release: https://github.com/kimono-koans/httm/releases/tag/0.31.3

@magnetophon
Copy link

@heyarne In case you are still interested: version 0.31.5 works perfectly in NixOS using fish.
PR here: NixOS/nixpkgs#267886

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants