1 |
commit: 1b78510351384bb660ce226aba000e8962d75304 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 28 02:00:20 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 28 02:00:48 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b785103 |
7 |
|
8 |
sys-apps/coreutils: add upstream patch for chmod exit regression |
9 |
|
10 |
See: https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00031.html |
11 |
See: https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00035.html |
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
sys-apps/coreutils/coreutils-9.0-r1.ebuild | 222 +++++++++++++++++++++ |
15 |
.../coreutils-9.0-fix-chmod-symlink-exit.patch | 35 ++++ |
16 |
2 files changed, 257 insertions(+) |
17 |
|
18 |
diff --git a/sys-apps/coreutils/coreutils-9.0-r1.ebuild b/sys-apps/coreutils/coreutils-9.0-r1.ebuild |
19 |
new file mode 100644 |
20 |
index 00000000000..a9a8508086a |
21 |
--- /dev/null |
22 |
+++ b/sys-apps/coreutils/coreutils-9.0-r1.ebuild |
23 |
@@ -0,0 +1,222 @@ |
24 |
+# Copyright 1999-2021 Gentoo Authors |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+ |
27 |
+EAPI=7 |
28 |
+ |
29 |
+PYTHON_COMPAT=( python3_{8..10} ) |
30 |
+ |
31 |
+inherit flag-o-matic python-any-r1 toolchain-funcs |
32 |
+ |
33 |
+PATCH="${PN}-8.30-patches-01" |
34 |
+DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)" |
35 |
+HOMEPAGE="https://www.gnu.org/software/coreutils/" |
36 |
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz |
37 |
+ !vanilla? ( |
38 |
+ mirror://gentoo/${PATCH}.tar.xz |
39 |
+ https://dev.gentoo.org/~polynomial-c/dist/${PATCH}.tar.xz |
40 |
+ )" |
41 |
+ |
42 |
+LICENSE="GPL-3" |
43 |
+SLOT="0" |
44 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux" |
45 |
+IUSE="acl caps gmp hostname kill multicall nls selinux +split-usr static test vanilla xattr" |
46 |
+RESTRICT="!test? ( test )" |
47 |
+ |
48 |
+LIB_DEPEND="acl? ( sys-apps/acl[static-libs] ) |
49 |
+ caps? ( sys-libs/libcap ) |
50 |
+ gmp? ( dev-libs/gmp:=[static-libs] ) |
51 |
+ xattr? ( sys-apps/attr[static-libs] )" |
52 |
+RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} ) |
53 |
+ selinux? ( sys-libs/libselinux ) |
54 |
+ nls? ( virtual/libintl )" |
55 |
+DEPEND=" |
56 |
+ ${RDEPEND} |
57 |
+ static? ( ${LIB_DEPEND} ) |
58 |
+" |
59 |
+BDEPEND=" |
60 |
+ app-arch/xz-utils |
61 |
+ test? ( |
62 |
+ dev-lang/perl |
63 |
+ dev-perl/Expect |
64 |
+ dev-util/strace |
65 |
+ ${PYTHON_DEPS} |
66 |
+ ) |
67 |
+" |
68 |
+RDEPEND+=" |
69 |
+ hostname? ( !sys-apps/net-tools[hostname] ) |
70 |
+ kill? ( |
71 |
+ !sys-apps/util-linux[kill] |
72 |
+ !sys-process/procps[kill] |
73 |
+ ) |
74 |
+ !app-misc/realpath |
75 |
+ !<sys-apps/util-linux-2.13 |
76 |
+ !<sys-apps/sandbox-2.10-r4 |
77 |
+ !sys-apps/stat |
78 |
+ !net-mail/base64 |
79 |
+ !sys-apps/mktemp |
80 |
+ !<app-forensics/tct-1.18-r1 |
81 |
+ !<net-fs/netatalk-2.0.3-r4" |
82 |
+ |
83 |
+pkg_setup() { |
84 |
+ if use test ; then |
85 |
+ python-any-r1_pkg_setup |
86 |
+ fi |
87 |
+} |
88 |
+ |
89 |
+src_prepare() { |
90 |
+ local PATCHES=( |
91 |
+ # Upstream patches |
92 |
+ "${FILESDIR}"/${P}-fix-chmod-symlink-exit.patch |
93 |
+ ) |
94 |
+ |
95 |
+ if ! use vanilla ; then |
96 |
+ PATCHES+=( "${WORKDIR}"/patch ) |
97 |
+ PATCHES+=( "${FILESDIR}"/${PN}-8.32-sandbox-env-test.patch ) |
98 |
+ fi |
99 |
+ |
100 |
+ default |
101 |
+ |
102 |
+ # Since we've patched many .c files, the make process will try to |
103 |
+ # re-build the manpages by running `./bin --help`. When doing a |
104 |
+ # cross-compile, we can't do that since 'bin' isn't a native bin. |
105 |
+ # |
106 |
+ # Also, it's not like we changed the usage on any of these things, |
107 |
+ # so let's just update the timestamps and skip the help2man step. |
108 |
+ set -- man/*.x |
109 |
+ touch ${@/%x/1} || die |
110 |
+ |
111 |
+ # Avoid perl dep for compiled in dircolors default (bug #348642) |
112 |
+ if ! has_version dev-lang/perl ; then |
113 |
+ touch src/dircolors.h || die |
114 |
+ touch ${@/%x/1} || die |
115 |
+ fi |
116 |
+} |
117 |
+ |
118 |
+src_configure() { |
119 |
+ local myconf=( |
120 |
+ --with-packager="Gentoo" |
121 |
+ --with-packager-version="${PVR} (p${PATCH_VER:-0})" |
122 |
+ --with-packager-bug-reports="https://bugs.gentoo.org/" |
123 |
+ # kill/uptime - procps |
124 |
+ # groups/su - shadow |
125 |
+ # hostname - net-tools |
126 |
+ --enable-install-program="arch,$(usev hostname),$(usev kill)" |
127 |
+ --enable-no-install-program="groups,$(usev !hostname),$(usev !kill),su,uptime" |
128 |
+ --enable-largefile |
129 |
+ $(usex caps '' --disable-libcap) |
130 |
+ $(use_enable nls) |
131 |
+ $(use_enable acl) |
132 |
+ $(use_enable multicall single-binary) |
133 |
+ $(use_enable xattr) |
134 |
+ $(use_with gmp libgmp) |
135 |
+ ) |
136 |
+ |
137 |
+ if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then |
138 |
+ # bug #311569 |
139 |
+ export fu_cv_sys_stat_statfs2_bsize=yes |
140 |
+ # bug #416629 |
141 |
+ export gl_cv_func_realpath_works=yes |
142 |
+ fi |
143 |
+ |
144 |
+ # bug #409919 |
145 |
+ export gl_cv_func_mknod_works=yes |
146 |
+ |
147 |
+ if use static ; then |
148 |
+ append-ldflags -static |
149 |
+ # bug #321821 |
150 |
+ sed -i '/elf_sys=yes/s:yes:no:' configure || die |
151 |
+ fi |
152 |
+ |
153 |
+ if ! use selinux ; then |
154 |
+ # bug #301782 |
155 |
+ export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no |
156 |
+ fi |
157 |
+ |
158 |
+ econf "${myconf[@]}" |
159 |
+} |
160 |
+ |
161 |
+src_test() { |
162 |
+ # Known to fail with FEATURES=usersandbox (bug #439574): |
163 |
+ # - tests/du/long-from-unreadable.sh} (bug #413621) |
164 |
+ # - tests/rm/deep-2.sh (bug #413621) |
165 |
+ # - tests/dd/no-allocate.sh (bug #629660) |
166 |
+ if has usersandbox ${FEATURES} ; then |
167 |
+ ewarn "You are emerging ${P} with 'usersandbox' enabled." \ |
168 |
+ "Expect some test failures or emerge with 'FEATURES=-usersandbox'!" |
169 |
+ fi |
170 |
+ |
171 |
+ # Non-root tests will fail if the full path isn't |
172 |
+ # accessible to non-root users |
173 |
+ chmod -R go-w "${WORKDIR}" || die |
174 |
+ chmod a+rx "${WORKDIR}" || die |
175 |
+ |
176 |
+ # coreutils tests like to do `mount` and such with temp dirs, |
177 |
+ # so make sure: |
178 |
+ # - /etc/mtab is writable (bug #265725) |
179 |
+ # - /dev/loop* can be mounted (bug #269758) |
180 |
+ mkdir -p "${T}"/mount-wrappers || die |
181 |
+ mkwrap() { |
182 |
+ local w ww |
183 |
+ for w in "${@}" ; do |
184 |
+ ww="${T}/mount-wrappers/${w}" |
185 |
+ cat <<-EOF > "${ww}" |
186 |
+ #!${EPREFIX}/bin/sh |
187 |
+ exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P ${w}) "\$@" |
188 |
+ EOF |
189 |
+ chmod a+rx "${ww}" || die |
190 |
+ done |
191 |
+ } |
192 |
+ mkwrap mount umount |
193 |
+ |
194 |
+ addwrite /dev/full |
195 |
+ #export RUN_EXPENSIVE_TESTS="yes" |
196 |
+ #export FETISH_GROUPS="portage wheel" |
197 |
+ env PATH="${T}/mount-wrappers:${PATH}" \ |
198 |
+ emake -j1 -k check |
199 |
+} |
200 |
+ |
201 |
+src_install() { |
202 |
+ default |
203 |
+ |
204 |
+ insinto /etc |
205 |
+ newins src/dircolors.hin DIR_COLORS |
206 |
+ |
207 |
+ if use split-usr ; then |
208 |
+ cd "${ED}"/usr/bin || die |
209 |
+ dodir /bin |
210 |
+ |
211 |
+ # Move critical binaries into /bin (required by FHS) |
212 |
+ local fhs="cat chgrp chmod chown cp date dd df echo false ln ls |
213 |
+ mkdir mknod mv pwd rm rmdir stty sync true uname" |
214 |
+ mv ${fhs} ../../bin/ || die "Could not move FHS bins!" |
215 |
+ |
216 |
+ if use hostname ; then |
217 |
+ mv hostname ../../bin/ || die |
218 |
+ fi |
219 |
+ |
220 |
+ if use kill ; then |
221 |
+ mv kill ../../bin/ || die |
222 |
+ fi |
223 |
+ |
224 |
+ # Move critical binaries into /bin (common scripts) |
225 |
+ # (Why are these required for booting?) |
226 |
+ local com="basename chroot cut dir dirname du env expr head mkfifo |
227 |
+ mktemp readlink seq sleep sort tail touch tr tty vdir wc yes" |
228 |
+ mv ${com} ../../bin/ || die "Could not move common bins!" |
229 |
+ |
230 |
+ # Create a symlink for uname in /usr/bin/ since autotools require it. |
231 |
+ # (Other than uname, we need to figure out why we are |
232 |
+ # creating symlinks for these in /usr/bin instead of leaving |
233 |
+ # the files there in the first place...) |
234 |
+ local x |
235 |
+ for x in ${com} uname ; do |
236 |
+ dosym ../../bin/${x} /usr/bin/${x} |
237 |
+ done |
238 |
+ fi |
239 |
+} |
240 |
+ |
241 |
+pkg_postinst() { |
242 |
+ ewarn "Make sure you run 'hash -r' in your active shells." |
243 |
+ ewarn "You should also re-source your shell settings for LS_COLORS" |
244 |
+ ewarn " changes, such as: source /etc/profile" |
245 |
+} |
246 |
|
247 |
diff --git a/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch b/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch |
248 |
new file mode 100644 |
249 |
index 00000000000..25b2b72bcb8 |
250 |
--- /dev/null |
251 |
+++ b/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch |
252 |
@@ -0,0 +1,35 @@ |
253 |
+https://git.savannah.gnu.org/cgit/coreutils.git/patch/?id=e8b56ebd536e82b15542a00c888109471936bfda |
254 |
+https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00031.html |
255 |
+(and https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00035.html) |
256 |
+ |
257 |
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@××××××××××.com> |
258 |
+Date: Fri, 24 Sep 2021 20:57:41 +0100 |
259 |
+Subject: chmod: fix exit status when ignoring symlinks |
260 |
+ |
261 |
+* src/chmod.c: Reorder enum so CH_NOT_APPLIED |
262 |
+can be treated as a non error. |
263 |
+* tests/chmod/ignore-symlink.sh: A new test. |
264 |
+* tests/local.mk: Reference the new test. |
265 |
+* NEWS: Mention the bug fix. |
266 |
+Fixes https://bugs.gnu.org/50784 |
267 |
+--- a/src/chmod.c |
268 |
++++ b/src/chmod.c |
269 |
+@@ -44,8 +44,8 @@ struct change_status |
270 |
+ enum |
271 |
+ { |
272 |
+ CH_NO_STAT, |
273 |
+- CH_NOT_APPLIED, |
274 |
+ CH_FAILED, |
275 |
++ CH_NOT_APPLIED, |
276 |
+ CH_NO_CHANGE_REQUESTED, |
277 |
+ CH_SUCCEEDED |
278 |
+ } |
279 |
+@@ -322,7 +322,7 @@ process_file (FTS *fts, FTSENT *ent) |
280 |
+ if ( ! recurse) |
281 |
+ fts_set (fts, ent, FTS_SKIP); |
282 |
+ |
283 |
+- return CH_NO_CHANGE_REQUESTED <= ch.status; |
284 |
++ return CH_NOT_APPLIED <= ch.status; |
285 |
+ } |
286 |
+ |
287 |
+ /* Recursively change the modes of the specified FILES (the last entry |