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 on copy-password #683

Closed
hsanjuan opened this issue Apr 20, 2020 · 22 comments
Closed

Error on copy-password #683

hsanjuan opened this issue Apr 20, 2020 · 22 comments
Labels
2-series Related to releases whose major version is 2.

Comments

@hsanjuan
Copy link
Contributor

Describe the bug

Copy password does not work sometimes.

Precise recipe to reproduce the issue

Call copy-password.

Output when started from a shell

<ERROR> [14:07:44] next utility.lisp (funcall-safely fun3) -
  Error in #<FUNCTION NEXT:RETURN-INPUT>: Subprocess #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {10083E07B3}>
 with command ("/usr/bin/xclip" "-out" "-selection" "clipboard")
 exited with error code 1

So something went bad with xclip but not sure what. Is there a way I can debug this more? Calling pass manually works. Also, is this not calling pass -c directly to let pass put the things in the clipboard?

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 20, 2020 via email

@hsanjuan
Copy link
Contributor Author

Perhaps it is not passing anything in?

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 20, 2020 via email

@Ambrevar Ambrevar added the 2-series Related to releases whose major version is 2. label Apr 20, 2020
@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 20, 2020 via email

@hsanjuan
Copy link
Contributor Author

To clarify, did you choose a password entry and press RET to trigger the error?

Yes

Since March 9th, commands are called with funcall-safely when run from the binary. Are you running Next from the REPL?

No.

I think what I need is to trace what gets called for pass and what returns, but the problem is this doesn't happen consistently, but once it happens on a buffer I think it keeps happening at least for that same password. I can also add that it does not seem to be funny characters in the password, or in the usernames.

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 21, 2020 via email

@hsanjuan
Copy link
Contributor Author

Things keep going as usual

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 21, 2020 via email

@hsanjuan
Copy link
Contributor Author

I am very stupid but I am guessing that (setq *keep-alive* t) is NOT the way to set this in my config?

@jmercouris
Copy link
Member

You are not stupid! We are all learning all the time :-)

actually you are quite close! (setf *keep-alive* t)

it already has a default value of t though. You'll basically just want to open up a terminal and start Next so you can see the error messages in stdout rather than starting it from whatever GUI tool

@jmercouris
Copy link
Member

I see now that it is set to nil by the startup procedure, so actually yes, setting it to t in your init file would help

@hsanjuan
Copy link
Contributor Author


; file: /home/hector/.config/next/init.lisp                                                                                               
; in: SETF *KEEP-ALIVE*                                                                                                                   
;     (SETF NEXT-USER::*KEEP-ALIVE* T)                                                                                                    
; ==>                                                                                                                       
;   (SETQ NEXT-USER::*KEEP-ALIVE* T)                                                                                                      
;                                                                                                               
; caught WARNING:                                                                                                                         
;   undefined variable: NEXT-USER::*KEEP-ALIVE*                                                                                           
;                                                                                                               
; compilation unit finished                                                                                                               
;   Undefined variable:                                                                                                                   
;     *KEEP-ALIVE*   

doesn't really let me setf either. also errors when (in-package :next).

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 22, 2020 via email

@jmercouris
Copy link
Member

Pierre is correct about setq, unlike in elisp it should however be avoided

I also think that keep-alive is confusing, I read the doc string and still got it backwards... Maybe we can have a config that will set logging , stacktrace etc? This config could be set by a command line argument, I’m thinking something like how ENVY looks but using command line flags instead of environment variables?

@hsanjuan
Copy link
Contributor Author

Ok, with keep-alive set to nil:

<ERROR> [12:19:42] next utility.lisp (funcall-safely fun3) -
  In #<FUNCTION (LAMBDA (NEXT::PASSWORD-NAME)
                  :IN
                  NEXT:COPY-PASSWORD) {527B9F5B}>: Subprocess #<UIOP/LAUNCH-PROGRAM:FE0883}>
 with command ("/usr/bin/xclip" "-out" "-selection" "clipboard")
 exited with error code 1

It does not give much more information. One thing I realized is taht we are not trying to copy something into the clipboard, but rather to read it out (-out). It's that what we want?

The library you linked (if I'm reading that lisp well), apparently uses the xclip -out command when the data passed is NIL.

This would somehow mean that we failed to read the password from pass. Can we capture stderr from pass? Are we catching if pass throws an error? I wonder if we should just call pass -c0 and forget about clipboard management and line splitting.

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 22, 2020 via email

@hsanjuan
Copy link
Contributor Author

I did not have time to try but I think you changed something?

Anyways, I caught an xclip error by running the xclip command directly right after the error in next:

[10:43:12] ~ $ xclip -out -selection clipboard
Error: target STRING not available⏎ 

This returned with an error status. Per astrand/xclip#38 (comment) this happens when the clipboard contains something non-text. I am not sure how the clipboard ends up containing something non-text though. In fact, if I add urandom things to the clipboard it still works.

Could it be next somehow mangling things when it restores the "original" clipboard so that xclip becomes unusable on the next occasion?

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 23, 2020 via email

@Ambrevar
Copy link
Contributor

Fixed in 3020c4d.

@hsanjuan
Copy link
Contributor Author

@Ambrevar on a side note, should it just clear the clipboard (rather than try to restore?).

Normally, if I put something in the clipboard, I would expect to be overwriting the previous thing. Restoring it strikes me as a bit unnatural. If fact sometimes leads me to paste wrong things because I am expecting to paste the password in a password field, but it expired and now I am pasting something else that was in the clipboard before (maybe another password), and now I am sending the wrong thing to some server, which is quite scary...

@jmercouris
Copy link
Member

I believe that we should not use the clipboard for this and should directly output into the text area, I’ll provide an alternate command for this

@Ambrevar
Copy link
Contributor

Ambrevar commented Apr 23, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-series Related to releases whose major version is 2.
Development

No branches or pull requests

3 participants