Subject: bug#71200: TRAMP: Trying to do a project-find-file or (find-directory) using the podman method causes a (wrong-type-argument stringp nil) error

From: Dmitry Gutov <[email-masked]>
Date: Mon, 27 May 2024 01:44:13 +0300

On 27/05/2024 00:43, alexis purslane wrote:
> Follow up:
> 
> I have these containers installed:
> 
> 1. devcontainers/rust:latest
> 2. devcontainers/typescript-node:latest
> 3. devcontainers/cpp:latest
> 4. texlive/texlive:latest
> 5. tensorflow/tensorflow:latest-gpu
> 
> Only one of them wor--
> 
> ....
> 
> Oh.
> 
> Git keeps "detecting dubious ownership" over each project's
> .git/
> for some reason, which prevents `git ls-files` from running,

That's possible.

> hence the
> problem. So this isn't really a bug per-se, it's more like a lack
> of
> clear enough errors.

Yep. Poor error reporting came up not too long ago, and it's improved on 
master: 
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=8d3e4e823f21d5a

I have now bumped the version headers for xref.el and project.el.

Try installing project 0.11.0 (it will be out on ELPA sometime in the 
next 24 hours), the errors should be easier to understand now.

> I could also really use some help with getting the ownership and
> gpg & ssh
> keychain stuff (commits always fail because Magit over TRAMP can't
> access my GPG or SSH private keys) figured out over TRAMP but I can get that help
> elsewhere.

Looking around the internet, it seems the error "detecting dubious 
ownership" comes down to file ownership - here's one of the possible 
solutions (https://askubuntu.com/a/1445820), but there are several 
different approaches being recommended in different SO and SE answers.

To make a commit, you just need to have git config for user.name and 
user.email on the working machine - ssh keys are usually not required 
unless you're trying to sign commits as well.

It's pushing commits to a remote (or pulling, or cloning) that usually 
becomes a problem. Over ssh, one usually solves that by enabling 
"authentication agent forwarding" - logging in with "ssh -A'.

I'm not sure what is the preferred solution when using podman, but 
here's an article that describes sharing your .ssh directory with the 
container: 
https://devcodef1.com/news/1088795/ssh-agent-forwarding-in-podman-container 
(step number 3).

Of course that's only safe if you're the only one with access to it.

> Anyway, when git ls-files fails, maybe the stderr output it
> produced should be
> printed instead of just trying to parse its empty stdin and
> crashing.

Let me know how how it works for you.