Skip to content

Commit 71a6404

Browse files
committed
fix(main/tor): remove ADBism /data/local/tmp
- Fixes #28457
1 parent c41cadc commit 71a6404

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

packages/tor/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="The Onion Router anonymizing overlay network"
33
TERMUX_PKG_LICENSE="BSD 3-Clause"
44
TERMUX_PKG_MAINTAINER="@termux"
55
TERMUX_PKG_VERSION="0.4.9.5"
6+
TERMUX_PKG_REVISION=1
67
TERMUX_PKG_SRCURL=https://www.torproject.org/dist/tor-$TERMUX_PKG_VERSION.tar.gz
78
TERMUX_PKG_SHA256=c949c2f86b348e64891976f6b1e49c177655b23df97193049bf1b8cd3099e179
89
TERMUX_PKG_AUTO_UPDATE=true

packages/tor/remove-adbism.patch

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/data/local/tmp is an ADBism that only works in ADB; the folder
2+
is inaccessible to the permissions of normal apps like Termux,
3+
so @TERMUX_PREFIX@/tmp should be used instead in Termux.
4+
5+
--- a/src/app/config/config.c
6+
+++ b/src/app/config/config.c
7+
@@ -491,8 +491,8 @@ static const config_var_t option_vars_[] = {
8+
* /data/local/tmp is guaranteed to exist, but will only be
9+
* usable by the 'shell' and 'root' users, so this fallback is
10+
* for debugging only. */
11+
- V(GeoIPFile, FILENAME, "/data/local/tmp/geoip"),
12+
- V(GeoIPv6File, FILENAME, "/data/local/tmp/geoip6"),
13+
+ V(GeoIPFile, FILENAME, "@TERMUX_PREFIX@/tmp/geoip"),
14+
+ V(GeoIPv6File, FILENAME, "@TERMUX_PREFIX@/tmp/geoip6"),
15+
#else
16+
V(GeoIPFile, FILENAME,
17+
SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"),
18+
@@ -6927,7 +6927,7 @@ get_data_directory(const char *val)
19+
if (val) {
20+
return tor_strdup(val);
21+
} else {
22+
- return tor_strdup("/data/local/tmp");
23+
+ return tor_strdup("@TERMUX_PREFIX@/tmp");
24+
}
25+
#else /* !defined(_WIN32) */
26+
const char *d = val;
27+
--- a/src/test/testing_common.c
28+
+++ b/src/test/testing_common.c
29+
@@ -93,7 +93,7 @@ setup_directory(void)
30+
#elif defined(__ANDROID__)
31+
/* tor might not like the default perms, so create a subdir */
32+
tor_snprintf(temp_dir, sizeof(temp_dir),
33+
- "/data/local/tmp/tor_%d_%d_%s",
34+
+ "@TERMUX_PREFIX@/tmp/tor_%d_%d_%s",
35+
(int) getuid(), (int) getpid(), rnd32);
36+
r = mkdir(temp_dir, 0700);
37+
if (r) {

0 commit comments

Comments
 (0)