8000 Segfault when setting plugin · Issue #766 · jarun/nnn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Segfault when setting plugin #766

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

Closed
3 of 8 tasks
siraben opened this issue Oct 21, 2020 · 27 comments
Closed
3 of 8 tasks

Segfault when setting plugin #766

siraben opened this issue Oct 21, 2020 · 27 comments
Labels

Comments

@siraben
Copy link
siraben commented Oct 21, 2020

I was trying to set a plugin to page the current file using less, however it segfaults when I trigger it with ;p

Environment details (Put x in the checkbox along with the information)

  • Operating System: macOS
  • Desktop Environment:
  • Terminal Emulator: kitty
  • Shell: zsh
  • Custom desktop opener (if applicable):
  • Program options used:
  • Configuration options set:
  • Issue exists on nnn master

Exact steps to reproduce the issue

NNN_PLUG='p:-_less -iR $nnn*;l:-_git log' nnn
@siraben siraben added the bug label Oct 21, 2020
@0xACE
Copy link
Collaborator
0xACE commented Oct 21, 2020

Checked out master just for you:

Cannot replicate the error.

Nor can I replicate the error with my personal branch.

run make debug && gdb nnn and give us a bt full when you hit the segfault

@jarun
Copy link
Owner
jarun commented Oct 21, 2020

I can't reproduce this on master either.

Please provide the following details as well:

  • which other NNN_ config have you set?
  • from the help screen copy and share everything from PLUGIN_KEYS line to the end.

@siraben
Copy link
Author
siraben commented Oct 22, 2020

Looks like my home-manager config expanded the bash variable, so inspecting the value of NNN_PLUG I get the following;

$ echo $NNN_PLUG                              
'p:-_less -iR *;l:-_git log'

Is a segfault still expected?

@KlzXS
Copy link
Collaborator
KlzXS commented Oct 22, 2020

No, I still can't get it to segfault. less just fails to with Missing filename ("less --help" for help), which I would expect.
But I don't have macOS, maybe it's related to being mac?

But do give as a stack trace as @0xACE suggested.

@jarun
Copy link
Owner
jarun commented Oct 22, 2020

@siraben

In my system:

// with single quotes
$ export NNN_PLUG='p:-_less -iR $nnn*;l:-_git log'                                            
$ echo $NNN_PLUG                                  
p:-_less -iR $nnn*;l:-_git log

// with double quotes
$ export NNN_PLUG="p:-_less -iR $nnn*;l:-_git log"
$ echo $NNN_PLUG                                  
p:-_less -iR *;l:-_git log // $nnn is gone!

I think you are using double quotes around the alias and that's the problem.

Do you really want the the $nnn to be gone? Otherwise please fix that. I think that is causing the problem. Please ensure the removal doesn't happen.

I am closing this as a local environment problem. Please get back if fixing the above doesn't fix your problem. We will reopen the issue.

@jarun jarun closed this as completed Oct 22, 2020
@jarun
Copy link
Owner
jarun commented Oct 22, 2020

Please ensure the $nnn is not removed whatever may be the reason. Because that's an invalid input.

@siraben
Copy link
Author
siraben commented Oct 27, 2020

I tried NNN_PLUG='p:-_less -iR $nnn*;l:-_git log' nnn, and it segfaults when invoking the p plugin key.

@jarun
Copy link
Owner
jarun commented Oct 27, 2020

In that case, please provide all the details requested earlier.

@jarun
Copy link
Owner
jarun commented Oct 27, 2020

Also, what is your version of nnn? Is this happening on master?

@siraben
Copy link
Author
siraben commented Oct 27, 2020

Side note; after segfault it seems to mess up how my terminal receives control characters as well.

Also, what is your version of nnn? Is this happening on master?

My version of nnn is 3.4. I just tried it on master and got the same result (segfault).

which other NNN_ config have you set?

No other config set.

@jarun
Copy link
Owner
jarun commented Oct 27, 2020

Mess-up is expected after ncurses faulty exit. Please provide the details @0xACE and I requested in the first 2 responses.

@siraben
Copy link
Author
siraben commented Oct 27, 2020

My gdb isn't properly configured on darwin, so I'll see what happens on Linux and provide a backtrace.

@jarun
Copy link
Owner
jarun commented Oct 27, 2020

I just tried it on a macOS shell using fastmac and the files open as expected in less when I press Alt-P or ;P.

It's Darwin and brew installed nnn v3.4:

$ uname -a
Darwin Mac-1603815181651.local 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-
6153.141.2~1/RELEASE_X86_64 x86_64
$ nnn -V
3.4

Please confirm if your less is aliased to something? Try which less. For me it's /usr/bin/less.

@siraben
Copy link
Author
siraben commented Oct 27, 2020

which less gives /usr/bin/less for me

@jarun
Copy link
Owner
jarun commented Oct 27, 2020

Can you share the details under PLUGIN KEYS in help screen?

@0xACE
Copy link
Collaborator
0xACE commented Oct 27, 2020

My gdb isn't properly configured on darwin, so I'll see what happens on Linux and provide a backtrace.

Seems like they have lldb, could you generate a backtrace from:

  1. make debug && lldb ./nnn
  2. start it by typing run in lldb
  3. reproduce the segfault
  4. bt (or if they have a equivalent to bt full

This could be helpful
https://lldb.llvm.org/use/map.html

@siraben
Copy link
Author
siraben commented Oct 28, 2020

Can you share the details under PLUGIN KEYS in help screen?

How do I do this?

@siraben
Copy link
Author
siraben commented Oct 28, 2020

Looks like the segfault also occurs when running the other plugin (git log) with ;l.

@siraben
Copy link
Author
siraben commented Oct 28, 2020

I can't select the text so here is a screenshot of lldb's backtrace.
Screen Shot 2020-10-28 at 11 07 08

@jarun
Copy link
Owner
jarun commented Oct 28, 2020

Please provide the full backtrace however you can.

@siraben
Copy link
Author
siraben commented Oct 28, 2020

That seems to be the full backtrace.

@0xACE
Copy link
Collaborator
0xACE commented Oct 28, 2020

@siraben, we would need the variables in frame #3. I'm not familiar with lldb but you need to print out the local variables in that frame. and potentially frame #2 could be interesting. maybe frame 3 and fr v should yield some results. im going to bed, seems like jarun is around at least. good night

@jarun
Copy link
Owner
jarun commented Oct 28, 2020

@siraben I think you may not have compiled nnn in debug mode: https://github.com/jarun/nnn/wiki/Developer-guides#debugging-nnn

@jarun
Copy link
Owner
jarun commented Oct 28, 2020

Also, run bt full

@jarun
Copy link
Owner
jarun commented Nov 19, 2020

@siraben this is fixed at #786.

@siraben
Copy link
Author
siraben commented Nov 19, 2020

Ah, looks like the way to get the backtrace was bt all.

I just rebuilt it with Nix, and confirm that the issue is resolved.

@jarun
Copy link
Owner
jarun commented Nov 19, 2020

Thanks for the confirmation!

@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
0