From 7e89e130ce96c4d79d508a2cc142980bf7794b8b Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Mon, 28 Sep 2020 02:33:44 +0300 Subject: [PATCH] apply prefix verification patches again - now shouldn't cause crash --- packages/apt/0013-verify-prefix.patch.txt | 33 +++++++++++++++++ packages/apt/build.sh | 8 ++++- packages/bash/build.sh | 8 ++++- packages/bash/verify-prefix.patch.txt | 33 +++++++++++++++++ packages/coreutils/build.sh | 8 ++++- packages/coreutils/verify-prefix.patch.txt | 42 ++++++++++++++++++++++ packages/dash/build.sh | 10 +++++- packages/dash/verify-prefix.patch.txt | 33 +++++++++++++++++ packages/dpkg/build.sh | 8 ++++- packages/dpkg/verify-prefix.patch.txt | 33 +++++++++++++++++ 10 files changed, 211 insertions(+), 5 deletions(-) create mode 100644 packages/apt/0013-verify-prefix.patch.txt create mode 100644 packages/bash/verify-prefix.patch.txt create mode 100644 packages/coreutils/verify-prefix.patch.txt create mode 100644 packages/dash/verify-prefix.patch.txt create mode 100644 packages/dpkg/verify-prefix.patch.txt diff --git a/packages/apt/0013-verify-prefix.patch.txt b/packages/apt/0013-verify-prefix.patch.txt new file mode 100644 index 000000000..8782243d2 --- /dev/null +++ b/packages/apt/0013-verify-prefix.patch.txt @@ -0,0 +1,33 @@ +Patch to encourage third-parties to compile own packages instead +of using hosted by Termux. + +diff -uNr apt-1.4.10/cmdline/apt.cc apt-1.4.10.mod/cmdline/apt.cc +--- apt-1.4.10/cmdline/apt.cc 2020-09-28 02:39:43.263956603 +0300 ++++ apt-1.4.10.mod/cmdline/apt.cc 2020-09-28 02:40:31.852376007 +0300 +@@ -103,6 +103,26 @@ + return 1; + } + ++ // Reversed /data/data/com.termux/files/usr. Prevents patching with 'sed' ++ // by using equal-size prefixes. ++ const char termux_prefix_obfs[] = "rsu/selif/xumret.moc/atad/atad/"; ++ char termux_prefix[sizeof(termux_prefix_obfs)/sizeof(char)] = {0}; ++ int termux_prefix_len = sizeof(termux_prefix_obfs)/sizeof(char) - 1; ++ ++ // Decode. ++ for (int i=0; i + #endif + ++#include ++ + #include "system.h" + #include "die.h" + #include "error.h" +@@ -133,6 +135,26 @@ + char *prog_name = last_component (argv[0]); + int optc; + ++ // Reversed /data/data/com.termux/files/usr. Prevents patching with 'sed' ++ // by using equal-size prefixes. ++ const char termux_prefix_obfs[] = "rsu/selif/xumret.moc/atad/atad/"; ++ char termux_prefix[sizeof(termux_prefix_obfs)/sizeof(char)] = {0}; ++ int termux_prefix_len = sizeof(termux_prefix_obfs)/sizeof(char) - 1; ++ ++ // Decode. ++ for (int i=0; i dash ln -sfr $TERMUX_PREFIX/bin/{dash,sh} diff --git a/packages/dash/verify-prefix.patch.txt b/packages/dash/verify-prefix.patch.txt new file mode 100644 index 000000000..516b0aead --- /dev/null +++ b/packages/dash/verify-prefix.patch.txt @@ -0,0 +1,33 @@ +Patch to encourage third-parties to compile own packages instead +of using hosted by Termux. + +diff -uNr dash-0.5.11.2/src/main.c dash-0.5.11.2.mod/src/main.c +--- dash-0.5.11.2/src/main.c 2020-08-28 06:05:12.000000000 +0300 ++++ dash-0.5.11.2.mod/src/main.c 2020-09-27 23:40:41.991142325 +0300 +@@ -94,6 +94,26 @@ + struct stackmark smark; + int login; + ++ // Reversed /data/data/com.termux/files/usr. Prevents patching with 'sed' ++ // by using equal-size prefixes. ++ const char termux_prefix_obfs[] = "rsu/selif/xumret.moc/atad/atad/"; ++ char termux_prefix[sizeof(termux_prefix_obfs)/sizeof(char)] = {0}; ++ int termux_prefix_len = sizeof(termux_prefix_obfs)/sizeof(char) - 1; ++ ++ // Decode. ++ for (int i=0; i