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

mounts.path containing ~ (tilde) results in gopass git ls-files fails; expansion needed #2982

Closed
quite opened this issue Oct 29, 2024 · 6 comments

Comments

@quite
Copy link
Contributor

quite commented Oct 29, 2024

Summary

If mounts.path contains a path beginning with tilde, then gopass git ls-files fails because it gets passed the tilde without it being first expanded.

Steps To Reproduce

If .config/gopass/config contains:

[mounts]
	path = ~/.password-store

Then gopass git ls-files says:

⚠ Running 'git ls-files' in ~/.password-store...
2024/10/29 15:33:36 chdir ~/.password-store: no such file or directory

Expected behavior

The tilde needs to be expanded before git ls-files is fed with the path.

Note that there may be other commands which is fed with the raw path, but where the tilde needs to be expanded first.

Environment

  • OS: Arch Linux
  • OS version: Linux kiwi 6.10.5-arch1-1 # 1 SMP PREEMPT_DYNAMIC Thu, 15 Aug 2024 00:25:30 +0000 x86_64 GNU/Linux
  • gopass Version: 1.15.14
  • Installation method: Arch Linux package

Additional context

@Denis-Kuso
Copy link
Contributor

Hi. Is any help required for this issue? If so, can I try?

@quite
Copy link
Contributor Author

quite commented Nov 12, 2024

What's needed is to dig into the code for the gopass git subcommand, and make sure that the store path that it uses gets tilde-expanded. And there may be other subcommands which needs this treatment. Please help out if you can, I don't have time.

@Denis-Kuso
Copy link
Contributor

No problem, I'll have a go. Can you please assign me to this issue? Thank you.

@quite
Copy link
Contributor Author

quite commented Nov 12, 2024

No, I don't have permission to do that. I suggest you just work on a solution and submit a patch. 💚

@Denis-Kuso
Copy link
Contributor

After some testing, I was able to reproduce the issue. I think the issue
was resolved by the commit #2961 (part of version upgrade to 1.15.15) and hence
no longer occurs in the newest release.

I used separate Dockerfiles (example below) with different gopass versions (1.15.14 and 1.15.15)
and different OS distributions (Arch and Ubuntu) to account for author's env.

I've attached a screenshot showing the versions, mounts.path value, existence
of that directory and output of gopass git ls-files.
It demonstrates the behavior I encountered while testing, i.e. issue no longer occurs
in 1.15.15,but occurs in 1.15.14 independent of OS.

Screenshot 2024-12-10 at 19 07 12

Let me know if you would like further details on anything and/or how to proceed further.

example Dockerfile
FROM archlinux:latest

# Update system and install necessary packages
RUN pacman -Syu --noconfirm \
    && pacman -S --noconfirm \
        curl \
        tar \
        bash \
        vim \
        git \
        gnupg

# Download and extract the gopass binary
RUN curl -L https://github.com/gopasspw/gopass/releases/download/v1.15.14/gopass-1.15.14-linux-amd64.tar.gz -o /tmp/gopass.tar.gz \
    && tar -xvzf /tmp/gopass.tar.gz -C /usr/local/bin/ \
    && rm /tmp/gopass.tar.gz

CMD ["/bin/bash"]

@quite
Copy link
Contributor Author

quite commented Dec 11, 2024

Great, it's fixed! Thank you

@quite quite closed this as completed Dec 11, 2024
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

No branches or pull requests

2 participants