Took me an annoyingly long time to find a mask that the ndk was happy
with. The original mask gives identical permissions as this one (and
several other variants I tried). printf("%d\n", ~(S_IRUSR | S_IWUSR));
returns a negative number, and I guess that is the reason the ndk is
unhappy.
Original error message:
restart.c:233:48: error: 'umask' called with invalid mode
mode_t oldmask = umask(~(S_IRUSR | S_IWUSR));
^
/home/builder/.termux-build/_cache/android-r21d-api-24-v3/bin/../sysroot/usr/include/bits/fortify/stat.h:47:5: note: from 'diagnose_if' attribute on 'umask':
__clang_error_if(mode & ~0777, "'umask' called with invalid mode") {
^ ~~~~~~~~~~~~
/home/builder/.termux-build/_cache/android-r21d-api-24-v3/bin/../sysroot/usr/include/sys/cdefs.h:134:52: note: expanded from macro '__clang_error_if'
^
1 error generated.
make[2]: *** [Makefile:1060: memcached-restart.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1699: all-recursive] Error 1
Needs patching due to error:
/home/builder/.termux-build/e2fsprogs/src/e2fsck/rehash.c:1051:3: warning: implicit declaration of function 'qsort_r' is invalid in C99 [-Wimplicit-function-declaration]
qsort_r(fd.harray+2, fd.num_array-2, sizeof(struct hash_entry),
^
CC /home/builder/.termux-build/e2fsprogs/src/e2fsck/encrypted_files.c
SUBST e2fsck.8
SUBST e2fsck.conf.5
5 warnings generated.
LD e2fsck
rehash.o:rehash.c:function e2fsck_rehash_dir: error: undefined reference to 'qsort_r'
***
This reverts commit 8b2f08e281.
Needs patching due to error:
aarch64-linux-android-clang -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -I.. -I/data/data/com.termux/files/usr/include -c -o custtbl.o custtbl.c
clang: error: the clang compiler does not support '-march=native'
***
This reverts commit 087382e27b.
***
This commit contains further changes to user agent string in addition
to introduced in fd66e2fe29.
Now it will send installation prefix obtained by /proc/self/exe. It
should resist patching `apt` with sed or in other way. Reminding that
installation prefix provided in user agent http header is intended for
distinguishing Termux from derivatives.
Here are sample lines from my mirror logs showing usage of Termux repo
by third-party projects:
```
162.158.103.43 - - [21/Jan/2021:09:46:43 +0200] "GET /dists/stable/Release HTTP/1.1" 304 0 "-" "Termux-PKG/1.0 mirror-checker (termux-tools 0.104) Termux (pl.sviete.dom; install-prefix:/data/data/pl.sviete.dom/files/usr)"
162.158.210.8 - - [20/Jan/2021:06:24:54 +0200] "GET /dists/stable/InRelease HTTP/1.1" 404 146 "-" "Debian APT-HTTP/1.3 (2.1.15) Termux (vn.vhn.vsc; install-prefix:/data/data/vn.vhn.vsc/files/usr)"
162.158.210.142 - - [20/Jan/2021:06:24:54 +0200] "GET /dists/stable/Release.gpg HTTP/1.1" 304 0 "-" "Debian APT-HTTP/1.3 (2.1.15) Termux (vn.vhn.vsc; install-prefix:/data/data/vn.vhn.vsc/files/usr)"
```
***
CloudFlare firewall for termux.org and termux-mirror.ml hosts would be
adjusted to block all requests which do not have install-prefix set or
if the latter doesn't match one of the Termux.