Make git-annex enable-tor work when using the linux standalone build

Clean the standalone environment before running the su command
to run "sh". Otherwise, PATH leaked through, causing it to run
git-annex.linux/bin/sh, but GIT_ANNEX_DIR was not set,
which caused that script to not work:

[2022-10-26 15:07:02.145466106] (Utility.Process) process [938146] call: pkexec ["sh","-c","cd '/home/joey/tmp/git-annex.linux/r' && '/home/joey/tmp/git-annex.linux/git-annex' 'enable-tor' '1000'"]
/home/joey/tmp/git-annex.linux/bin/sh: 4: exec: /exe/sh: not found

Changed programPath to not use GIT_ANNEX_PROGRAMPATH,
but instead run the scripts at the top of GIT_ANNEX_DIR.
That works both when the standalone environment is set up, and when it's
not.

Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
Joey Hess 2022-10-26 15:44:06 -04:00
parent a8ce8ac75d
commit 14f7a386f0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 48 additions and 35 deletions

View file

@ -22,6 +22,7 @@ import Utility.WebApp
import Utility.Daemon (checkDaemon)
import Utility.UserInfo
import Annex.Init
import Annex.Path
import qualified Git
import Git.Types (fromConfigValue)
import qualified Git.Config
@ -222,7 +223,7 @@ openBrowser' mcmd htmlshim realurl outh errh =
#endif
hPutStrLn (fromMaybe stdout outh) $ "Launching web browser on " ++ url
hFlush stdout
environ <- cleanEnvironment
environ <- cleanStandaloneEnvironment
let p' = p
{ env = environ
, std_out = maybe Inherit UseHandle outh