use proot to support Android 8

runshell: Use proot when running on Android, to work around Android 8's
ill-advised seccomp filtering of system calls, including ones crucial for
reliable thread locking. (This will only work with termux's version of
proot.)

See https://github.com/termux/termux-packages/issues/420#issuecomment-386636938

This commit was sponsored by andrea rota.
This commit is contained in:
Joey Hess 2018-05-05 08:55:50 -04:00
parent d1961e4498
commit 71f450f677
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 35 additions and 6 deletions

View file

@ -3,6 +3,10 @@ git-annex (6.20180428) UNRELEASED; urgency=medium
* Fix regression in last release that crashes when using
--all or running git-annex in a bare repository. May have also
affected git-annex unused and git-annex info.
* runshell: Use proot when running on Android, to work around
Android 8's ill-advised seccomp filtering of system calls,
including ones crucial for reliable thread locking.
(This will only work with termux's version of proot.)
-- Joey Hess <id@joeyh.name> Tue, 08 May 2018 13:51:37 -0400

View file

@ -4,7 +4,7 @@ Linux software in a terminal.
git-annex is not currently part of the Termux distribution, but it's easy
to install it. Paste these commands into Termux:
pkg install git wget tar coreutils
pkg install git wget tar coreutils proot
termux-setup-storage
cd
wget https://downloads.kitenet.net/git-annex/autobuild/armel/git-annex-standalone-armel.tar.gz

View file

@ -0,0 +1,9 @@
[[!comment format=mdwn
username="joey"
subject="""comment 5"""
date="2018-05-05T12:57:00Z"
content="""
We now have a workaround that seems to work, `pkg install proot` and use
proot to run git-annex. Tomorrrow's daily build of the git-annex standalone
bundle will do that automatically.
"""]]

View file

@ -37,6 +37,8 @@ if echo "$base" | grep -q '[:;]'; then
rm -rf "$tbase"
}
trap cleanuptbase EXIT
else
tbase=""
fi
# Set this variable when using this script inside a package of git-annex,
@ -153,6 +155,7 @@ for localeenv in "$LANG" "$LANGUAGE" "$LC_CTYPE" "$LC_NUMERIC" "$LC_TIME" \
fi
done
useproot=""
case "$os" in
# Make this bundle work well on Android.
Android)
@ -169,6 +172,10 @@ case "$os" in
fi
fi
# Work around Android 8's seccomp filtering of some crucial
# system calls, using termux's version of proot.
useproot=1
# Store ssh connection caching sockets outside of sdcard.
GIT_ANNEX_TMP_DIR="$TMPDIR"
export GIT_ANNEX_TMP_DIR
@ -187,12 +194,21 @@ esac
if [ "$1" ]; then
cmd="$1"
shift 1
if [ -z "$tbase" ]; then
exec "$cmd" "$@"
else
cmd=sh
fi
if [ -z "$tbase" ]; then
if [ "$useproot" ]; then
exec proot "$cmd" "$@"
else
# allow EXIT trap to cleanup
"$cmd" "$@"
exec "$cmd" "$@"
fi
else
sh
# allow EXIT trap to cleanup
if [ "$useproot" ]; then
proot "$cmd" "$@"
else
"$cmd" "$@"
fi
fi