Skip to content

Conversation

@bascht
Copy link
Contributor

@bascht bascht commented Dec 10, 2019

The new CLI-switch --pass-executable makes qute-pass compatible with the gopass password store (https://github.com/gopasspw/gopass). While gopass itself is mostly compatible with pass, it offers the possibility to mount multiple shared password stores. qute-pass way of just traversing PASSWORD_STORE_DIR won't help in that case.

--

I've tried to keep backwards-compatibility with the old behaviour as much as possible. The method find_pass_candidates will now just branch out into two different modes depending on which password executable is used. In the pass way, the code stayed the same.

Closes #5142

@The-Compiler
Copy link
Member

@cryzed @wildente @Holzhaus @jtyers @brianclemens @lufte Can you help with reviewing/testing this?

(Also, if you'd rather not be pinged for future qute-pass changes, let me know! I figured I'd ping some people who contributed to qute-pass in the past, as I don't use it myself)

Copy link
Member

@lufte lufte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works correctly, and the code looks good.

Here's how I tested it:
1- Moved my current store somewhere else so I don't break anything.
2- Installed gopass and created a new store.
3- Added a password for somesite.
4- Mounted a new store with gopass mounts add store1.
5- Added another password for somesite under store1 with gopass generate store1/somesite/user.
6- Used the new userscript from somesite and it correctly showed me the two options.

Regarding the documentation of the new parameter (which says Executable to start (pass or gopass)) I wonder if we should limit the options of allowed arguments (with choices) or simply remove the (pass or gopass) part, since the code is not really limiting to those two options.

Besides that, looks great.

@bascht
Copy link
Contributor Author

bascht commented Dec 11, 2019

@lufte Wow, thanks for the extensive test and feedback! Re the new start parameter. I wonder whether it could be something like --gopass-compatibility-mode (or rather something more catchy).

I recon some people could have gopass aliased to pass, since it behaves almost in the same way.

@Holzhaus
Copy link
Contributor

Holzhaus commented Dec 13, 2019

How about --mode gopass? If a third pass implementation pops up, we can just add a third choice for that argument instead of messing around with multiple mutually exclusive flags.

@The-Compiler
Copy link
Member

The current argument/documentation indeed feels a bit confusing to me - it reads like I could do --pass-executable /some/path/to/gopass but that won't work.

I can see two ways forward:

  • Keep --pass-executable, but check if the os.path.basename() of it is gopass, and use the given path to execute the binary.
  • Use --mode gopass / --mode pass like proposed by @Holzhaus (and then use either gopass or pass in $PATH).

I don't really mind either way, so I'll leave it up to you (plural) which one you prefer.

@Holzhaus
Copy link
Contributor

I'd prefer the latter. We could also have --mode auto (selected by default) which guesses the mode from the executable name.

@bascht
Copy link
Contributor Author

bascht commented Jan 2, 2020

Yip, I think the --mode suggestion is the most sensible, I'm gonna rework the PR and go with the --mode auto as a default, like @Holzhaus suggested.

The new CLI-switch --mode makes qute-pass compatible with the gopass
password store (https://github.com/gopasspw/gopass). While gopass itself is
mostly compatible with pass, it offers the possibility to mount multiple shared
password stores. qute-pass way of just traversing PASSWORD_STORE_DIR won't help
in that case.

Closes qutebrowser#5142
@bascht bascht force-pushed the add-gopass-support-to-qute-pass branch from 3b8c5b9 to 5bf7c8e Compare January 6, 2020 21:41
@bascht
Copy link
Contributor Author

bascht commented Jan 6, 2020

Soooo – once I had everything typed down I noticed that --mode auto might be more confusing than helpful, since

  1. pass is in my opinion a sensible default and

    FileNotFoundError … No such file or directory: 'pass': 'pass'

    is a helpful error message for users that only have gopass.

  2. pass and gopass might both be in $PATH but the user wants to use pass

  3. pass and gopass are both used for different password stores (actual use-case from a co-worker :D)

So, 5bf7c8e adds a simple --mode switch with the default set to pass so it doesn't break backwards compatibility.

@Holzhaus @lufte wdyt?

@Holzhaus
Copy link
Contributor

Holzhaus commented Jan 7, 2020

@bascht That is okay for me. However, you could also rename auto to something more descriptive like prefer-gopass or prefer-pass (which falls back to the other tool if it's not in $PATH) and make that the default, but that's just an idea. I'm just using plain pass anyway ;-)

@lufte
Copy link
Member

lufte commented Jan 9, 2020

Ah, a fellow force-pusher like myself. I had to dig a little bit to be able to compare exactly what you changed since the last commit, instead of reviewing the whole diff again 😅

I think this is the best option and also we shouldn't keep bikeshedding this issue.

@bascht
Copy link
Contributor Author

bascht commented Jan 9, 2020

Oh yeah, sorry 'bout the unannounced force push – I was in my regular work projects workflow where I constantly rebase to keep the history tight. 😬

So, if everyone is fine with the current solution: :shipit:
Thank you for your help and feedback!

@The-Compiler
Copy link
Member

Awesome, thanks everyone! I'll get back to this ASAP, currently working on some remaining Qt 5.14 changes.

@bascht @Holzhaus @lufte Is it okay if I ping you when there are future qute-pass changes to be reviewed? If so, please give this comment a 👍.

@mschilli87

This comment has been minimized.

@lufte
Copy link
Member

lufte commented Jan 9, 2020

🙈 you're right @mschilli87

argument_parser.add_argument('url', nargs='?', default=os.getenv('QUTE_URL'))
argument_parser.add_argument('--password-store', '-p',
default=os.getenv('PASSWORD_STORE_DIR', default=os.path.expanduser('~/.password-store')),
help='Path to your pass password-store')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add (only used in pass-mode) to the help text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, added. 👍

@bascht
Copy link
Contributor Author

bascht commented Jan 14, 2020

Build failed but, but this looks unrelated 👼 – should I rebase on master?

@The-Compiler
Copy link
Member

Meh, flaky tests - feel free to just ignore them.

@The-Compiler The-Compiler merged commit 481261a into qutebrowser:master Jan 21, 2020
@The-Compiler
Copy link
Member

Thanks @bascht for the change and @lufte @Holzhaus for the reviews! 👍

There was a small conflict with #5199, but I think I fixed things up correctly.

@bascht bascht deleted the add-gopass-support-to-qute-pass branch January 22, 2020 10:13
@bascht
Copy link
Contributor Author

bascht commented Jan 22, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qute-pass is incompatible with gopass'es multiple password mounts

5 participants