1 |
commit: d19efe2a0c309bde3ceda7e7a9fba3fc9864d124 |
2 |
Author: Mike Frysinger <vapier <AT> chromium <DOT> org> |
3 |
AuthorDate: Fri May 29 15:25:56 2020 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 30 00:48:21 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d19efe2a |
7 |
|
8 |
sys-apps/gawk: restore USE=forced-sandbox |
9 |
|
10 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
11 |
|
12 |
sys-apps/gawk/gawk-4.2.1-r1.ebuild | 20 +++++++++++++++++++- |
13 |
sys-apps/gawk/gawk-5.0.1.ebuild | 20 +++++++++++++++++++- |
14 |
sys-apps/gawk/gawk-5.1.0.ebuild | 20 +++++++++++++++++++- |
15 |
sys-apps/gawk/metadata.xml | 1 + |
16 |
4 files changed, 58 insertions(+), 3 deletions(-) |
17 |
|
18 |
diff --git a/sys-apps/gawk/gawk-4.2.1-r1.ebuild b/sys-apps/gawk/gawk-4.2.1-r1.ebuild |
19 |
index 807061875e3..6982b29dc59 100644 |
20 |
--- a/sys-apps/gawk/gawk-4.2.1-r1.ebuild |
21 |
+++ b/sys-apps/gawk/gawk-4.2.1-r1.ebuild |
22 |
@@ -12,7 +12,7 @@ SRC_URI="mirror://gnu/gawk/${P}.tar.xz" |
23 |
LICENSE="GPL-2" |
24 |
SLOT="0" |
25 |
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
26 |
-IUSE="mpfr nls readline" |
27 |
+IUSE="forced-sandbox mpfr nls readline" |
28 |
|
29 |
RDEPEND=" |
30 |
dev-libs/gmp:0= |
31 |
@@ -38,6 +38,16 @@ src_prepare() { |
32 |
-e '/\<_XOPEN_SOURCE_EXTENDED\>/s/1//' \ |
33 |
extension/inplace.c || die |
34 |
fi |
35 |
+ |
36 |
+ if use forced-sandbox ; then |
37 |
+ # Upstream doesn't want to add a configure flag for this. |
38 |
+ # https://lists.gnu.org/archive/html/bug-sed/2018-03/msg00001.html |
39 |
+ sed -i \ |
40 |
+ -e '/^int do_flags = false;/s:false:DO_SANDBOX:' \ |
41 |
+ main.c || die |
42 |
+ # Make sure the sed took. |
43 |
+ grep -q '^int do_flags = DO_SANDBOX;' main.c || die "forcing sandbox failed" |
44 |
+ fi |
45 |
} |
46 |
|
47 |
src_configure() { |
48 |
@@ -61,6 +71,14 @@ src_install() { |
49 |
rm "${ED%/}"/usr/include/awk/config.h || die |
50 |
} |
51 |
|
52 |
+src_test() { |
53 |
+ if use forced-sandbox ; then |
54 |
+ ewarn "Tests disabled as they don't account for this mode." |
55 |
+ return |
56 |
+ fi |
57 |
+ default |
58 |
+} |
59 |
+ |
60 |
pkg_postinst() { |
61 |
# symlink creation here as the links do not belong to gawk, but to any awk |
62 |
if has_version app-admin/eselect \ |
63 |
|
64 |
diff --git a/sys-apps/gawk/gawk-5.0.1.ebuild b/sys-apps/gawk/gawk-5.0.1.ebuild |
65 |
index b44a5513e78..42d0a4c5525 100644 |
66 |
--- a/sys-apps/gawk/gawk-5.0.1.ebuild |
67 |
+++ b/sys-apps/gawk/gawk-5.0.1.ebuild |
68 |
@@ -12,7 +12,7 @@ SRC_URI="mirror://gnu/gawk/${P}.tar.xz" |
69 |
LICENSE="GPL-2" |
70 |
SLOT="0" |
71 |
KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
72 |
-IUSE="mpfr nls readline" |
73 |
+IUSE="forced-sandbox mpfr nls readline" |
74 |
|
75 |
RDEPEND=" |
76 |
dev-libs/gmp:0= |
77 |
@@ -40,6 +40,16 @@ src_prepare() { |
78 |
-e '/\<_XOPEN_SOURCE_EXTENDED\>/s/1//' \ |
79 |
extension/inplace.c || die |
80 |
fi |
81 |
+ |
82 |
+ if use forced-sandbox ; then |
83 |
+ # Upstream doesn't want to add a configure flag for this. |
84 |
+ # https://lists.gnu.org/archive/html/bug-sed/2018-03/msg00001.html |
85 |
+ sed -i \ |
86 |
+ -e '/^int do_flags = false;/s:false:DO_SANDBOX:' \ |
87 |
+ main.c || die |
88 |
+ # Make sure the sed took. |
89 |
+ grep -q '^int do_flags = DO_SANDBOX;' main.c || die "forcing sandbox failed" |
90 |
+ fi |
91 |
} |
92 |
|
93 |
src_configure() { |
94 |
@@ -63,6 +73,14 @@ src_install() { |
95 |
rm "${ED}"/usr/include/awk/config.h || die |
96 |
} |
97 |
|
98 |
+src_test() { |
99 |
+ if use forced-sandbox ; then |
100 |
+ ewarn "Tests disabled as they don't account for this mode." |
101 |
+ return |
102 |
+ fi |
103 |
+ default |
104 |
+} |
105 |
+ |
106 |
pkg_postinst() { |
107 |
# symlink creation here as the links do not belong to gawk, but to any awk |
108 |
if has_version app-admin/eselect && has_version app-eselect/eselect-awk ; then |
109 |
|
110 |
diff --git a/sys-apps/gawk/gawk-5.1.0.ebuild b/sys-apps/gawk/gawk-5.1.0.ebuild |
111 |
index 850ebc1769e..d0cc5570fb2 100644 |
112 |
--- a/sys-apps/gawk/gawk-5.1.0.ebuild |
113 |
+++ b/sys-apps/gawk/gawk-5.1.0.ebuild |
114 |
@@ -12,7 +12,7 @@ SRC_URI="mirror://gnu/gawk/${P}.tar.xz" |
115 |
LICENSE="GPL-2" |
116 |
SLOT="0" |
117 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
118 |
-IUSE="mpfr nls readline" |
119 |
+IUSE="forced-sandbox mpfr nls readline" |
120 |
|
121 |
RDEPEND=" |
122 |
dev-libs/gmp:0= |
123 |
@@ -42,6 +42,16 @@ src_prepare() { |
124 |
-e '/\<_XOPEN_SOURCE_EXTENDED\>/s/1//' \ |
125 |
extension/inplace.c || die |
126 |
fi |
127 |
+ |
128 |
+ if use forced-sandbox ; then |
129 |
+ # Upstream doesn't want to add a configure flag for this. |
130 |
+ # https://lists.gnu.org/archive/html/bug-sed/2018-03/msg00001.html |
131 |
+ sed -i \ |
132 |
+ -e '/^int do_flags = false;/s:false:DO_SANDBOX:' \ |
133 |
+ main.c || die |
134 |
+ # Make sure the sed took. |
135 |
+ grep -q '^int do_flags = DO_SANDBOX;' main.c || die "forcing sandbox failed" |
136 |
+ fi |
137 |
} |
138 |
|
139 |
src_configure() { |
140 |
@@ -65,6 +75,14 @@ src_install() { |
141 |
rm "${ED}"/usr/include/awk/config.h || die |
142 |
} |
143 |
|
144 |
+src_test() { |
145 |
+ if use forced-sandbox ; then |
146 |
+ ewarn "Tests disabled as they don't account for this mode." |
147 |
+ return |
148 |
+ fi |
149 |
+ default |
150 |
+} |
151 |
+ |
152 |
pkg_postinst() { |
153 |
# symlink creation here as the links do not belong to gawk, but to any awk |
154 |
if has_version app-admin/eselect && has_version app-eselect/eselect-awk ; then |
155 |
|
156 |
diff --git a/sys-apps/gawk/metadata.xml b/sys-apps/gawk/metadata.xml |
157 |
index 3fa1f988999..58cec04bdcb 100644 |
158 |
--- a/sys-apps/gawk/metadata.xml |
159 |
+++ b/sys-apps/gawk/metadata.xml |
160 |
@@ -6,6 +6,7 @@ |
161 |
<name>Gentoo Base System</name> |
162 |
</maintainer> |
163 |
<use> |
164 |
+ <flag name="forced-sandbox">Always enable --sandbox mode for simpler/secure runtime (disables e/r/w commands)</flag> |
165 |
<flag name="mpfr">use mpfr for high precision arithmetic (-M / --bignum)</flag> |
166 |
</use> |
167 |
</pkgmetadata> |