Bug 267689 - security/gopass: gopass edit foo fails
Summary: security/gopass: gopass edit foo fails
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Nuno Teixeira
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-10 09:45 UTC by Emanuel Haupt
Modified: 2022-12-09 11:25 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (eduardo)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuel Haupt freebsd_committer freebsd_triage 2022-11-10 09:45:17 UTC
gopass edit <something> fails with:

$ gopass edit foo
vi: illegal option -- i
usage: ex [-eFRrSsv] [-c command] [-t tag] [-w size] [file ...]
usage: vi [-eFlRrSv] [-c command] [-t tag] [-w size] [file ...]

Error: failed to invoke editor: failed to run vi with /tmp/gopass-edit3702329236/secret file: exit status 1

This happens because nvi (default EDITOR) does not have an option -i.

Suboptimal workaround:

- install VIM
- EDITOR=vim gopass edit foo

A better way would be to patch internal/editor/editor.go so that -i is only used when EDITOR is vim.

This is probably best handled upstream.
Comment 1 Emanuel Haupt freebsd_committer freebsd_triage 2022-11-10 10:05:37 UTC
Upstream issue: https://github.com/gopasspw/gopass/issues/2412
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2022-11-10 15:20:07 UTC
(In reply to Emanuel Haupt from comment #0)

I'm following issue, thanks for report.
Comment 3 Nuno Teixeira freebsd_committer freebsd_triage 2022-11-19 00:41:52 UTC
(In reply to Emanuel Haupt from comment #1)

I've tested https://github.com/gopasspw/gopass/commit/ce3c52182a198e35cb504835e8e7800a04a95a96 but it only works if EDITOR=nvi and it continue to fail with default EDITOR=vi.

Any clues on how to explain it better to upstream?

Thanks
Comment 4 Emanuel Haupt freebsd_committer freebsd_triage 2022-11-19 11:51:17 UTC
(In reply to Nuno Teixeira from comment #3)

Thank you for testing. I've just sent a follow up to the issue, I saw you did the same.
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-11-22 13:59:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=aa64f966def246264659e2d36507ab8e6f9f1813

commit aa64f966def246264659e2d36507ab8e6f9f1813
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2022-11-22 13:56:58 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-11-22 13:59:17 +0000

    security/gopass: Fix handle vi variants

    https://github.com/gopasspw/gopass/issues/2412

    PR:             267689

 security/gopass/Makefile | 6 ++++++
 security/gopass/distinfo | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
Comment 6 Nuno Teixeira freebsd_committer freebsd_triage 2022-11-22 14:05:16 UTC
(In reply to Emanuel Haupt from comment #4)

Hello Emanuel,

It works ok with latest upstream fix:
---
`gopass edit foo`
Found exact match in "websites/foo.com/foo"
Secret does not exist "foo". Found possible match in "websites/foo.com/foo". Edit existing entry? [Y/n/q]:
-c option, 1: The - command is unknown
Press Enter to continue:
---
and changes can be made.

The only warning I receive is "-c option, 1: The - command is unknown" and I don't know from where it comes, maybe gpg?

Please update you ports tree and reinstall portrevision 1 and let me know your results.

Thanks
Comment 7 Emanuel Haupt freebsd_committer freebsd_triage 2022-11-22 15:07:24 UTC
It works as you've described including the missing -c option error. I'll create an upstream issue for this and follow up with the new issue.
Comment 8 Emanuel Haupt freebsd_committer freebsd_triage 2022-11-22 15:14:17 UTC
https://github.com/gopasspw/gopass/issues/2424
Comment 9 commit-hook freebsd_committer freebsd_triage 2022-12-08 08:26:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c8de01ffe80facefe938f773e8addcc9cb98e9c8

commit c8de01ffe80facefe938f773e8addcc9cb98e9c8
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2022-12-08 08:22:22 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-12-08 08:24:59 +0000

    security/gopass: Update to 1.15.0

    Apply upstream patch to finally fix handle vi/nvi editors.

    PR:             267689

 security/gopass/Makefile  |  8 +++-----
 security/gopass/distinfo  | 20 +++++++++-----------
 security/gopass/pkg-plist |  2 +-
 3 files changed, 13 insertions(+), 17 deletions(-)
Comment 10 Nuno Teixeira freebsd_committer freebsd_triage 2022-12-08 08:33:28 UTC
Tested ok with vi/nvi with upstream latest patch.
Comment 11 Emanuel Haupt freebsd_committer freebsd_triage 2022-12-08 17:07:28 UTC
> Tested ok with vi/nvi with upstream latest patch.

Confirmed. Thanks for your patience and the quick handling. I think we can finally close this issue.
Comment 12 Nuno Teixeira freebsd_committer freebsd_triage 2022-12-09 11:25:22 UTC
Closing as fixed.

Cheers.