Andrey Portnoy <aport...@fastmail.com> writes:

> Hi Michael,

Hi Andrey,

> The current behavior of tramp-get-remote-path is to remove duplicate and
> non-existing directories from remote-path. The attached patch adds
> variable tramp-optimize-remote-path, setting which to nil will disable
> those optimizations. The default value is t for backward compatibility.
>
> Sometimes it's important to preserve the exact value of PATH, even if it
> contains duplicate or "invalid" entries. In my scenario I was using a
> Docker image prepopulated with a build cache for a large project based
> on a build system called Bazel. When I ran the container using Docker
> over Tramp, tramp-get-remote-path removed a nonexisting directory from
> remote-path, and so Bazel insisted on doing an expensive rebuild because
> PATH had changed.
>
> I've tested the change in that scenario. For this "PATH-conservative"
> usecase I essentially needed this combination:
>
> (setq tramp-optimize-remote-path nil
>       tramp-remote-path '(tramp-own-remote-path))

Isn't the idea to use the remote $PATH as-it-is, w/o any change from
Tramp side? In this case, we could make it easy, and allow
tramp-remote-path to be just t, instead of a list of strings. Tramp
wouldn't try to read or set the remote path then.

> If you think this can go in, I will follow up with an addition to the
> manual and etc/NEWS. Let me know if you'd like me to adapt the patch in
> any way or make any other changes.

Perhaps you try a patch along this idea?

> Thank you,
> Andrey.

Best regards, Michael.

Reply via email to