When standalone git-annex runs external special remote, it does so in the standalone environment. I wonder if it makes more sense to run them in the original environment (by restoring PATH from ORIG_PATH)? If the external special remote has been packaged with a package manager like conda, it expects its dependencies to come from the environment set up by that package manager, not the git-annex standalone environment.
Also, maybe rename exported vars like ORIG_PATH to GIT_ANNEX_ORIG_PATH.
Is this causing something not to work for you?
It clearly ought to be fixed, but it extends rather beyond external remote programs. Eg, gpg is not bundled but is run with the bundled locales. ssh is bundled but is only used if the system does not have ssh, and if the system does, that also is run with the bundled locales. git is bundled, but may run other programs that are not bundled (git-remote-gcrypt comes to mind), which would run with the bundled locales etc. Only the webapp currently sanitizes the environment when starting a web browser.
Probably the cleanest way to solve it would be to make git-annex unset the problem parts of the bundled environment when running all commands. (I think that would be
GCONV_PATH
andLOCPATH
; others likePATH
andMANPATH
need to be seen by non-bundled programs.) And have the wrapper scripts in bin/ restore the bundled environment back again for their programs to use. Eg, have runshell also setANNEX_GCONV_PATH
, and the wrapper scripts haveGCONV_PATH="$ANNEX_GCONV_PATH"
.It might be possible to have git-annex just unset those env vars on startup, instead of needing to do it every time in the System.Process wrapper. That would avoid slowing down non-standalone git-annex with checking, on every command invocation, if it needs to sanitize its environment. I'm not sure if a program that unsets
GCONV_PATH
andLOCPATH
on startup will prevent glibc from using them or not, would have to test or code dive glibc to find out.(That would not make the bundled git run non-bundled git-remote-gcrypt w/o the bundled environment. If that kind of thing were really a problem, the only solution would seem to be to modify git.)