diff options
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux')
8 files changed, 496 insertions, 48 deletions
diff --git a/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch new file mode 100644 index 0000000000..6258710e1e --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | From d44e3ad1f6f8b5c1b3098bb7d537943a4c21d22f Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 3 Dec 2023 19:59:46 -0800 | ||
4 | Subject: [PATCH] login-utils: include libgen.h for basename API | ||
5 | |||
6 | musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler | ||
7 | |||
8 | include libgen.h for using the posix declaration of the funciton. | ||
9 | |||
10 | Fixes | ||
11 | |||
12 | ../util-linux-2.39.2/login-utils/su-common.c:847:20: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] | ||
13 | 847 | shell_basename = basename(shell); | ||
14 | | ^ | ||
15 | |||
16 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 | ||
17 | |||
18 | Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2615] | ||
19 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
20 | |||
21 | --- | ||
22 | login-utils/su-common.c | 10 +++++++--- | ||
23 | 1 file changed, 7 insertions(+), 3 deletions(-) | ||
24 | |||
25 | diff --git a/login-utils/su-common.c b/login-utils/su-common.c | ||
26 | index b674920..3297c78 100644 | ||
27 | --- a/login-utils/su-common.c | ||
28 | +++ b/login-utils/su-common.c | ||
29 | @@ -26,6 +26,7 @@ | ||
30 | #include <sys/types.h> | ||
31 | #include <pwd.h> | ||
32 | #include <grp.h> | ||
33 | +#include <libgen.h> | ||
34 | #include <security/pam_appl.h> | ||
35 | #ifdef HAVE_SECURITY_PAM_MISC_H | ||
36 | # include <security/pam_misc.h> | ||
37 | @@ -840,17 +841,20 @@ static void run_shell( | ||
38 | su->simulate_login ? " login" : "", | ||
39 | su->fast_startup ? " fast-start" : "")); | ||
40 | |||
41 | + char* tmp = xstrdup(shell); | ||
42 | if (su->simulate_login) { | ||
43 | char *arg0; | ||
44 | char *shell_basename; | ||
45 | |||
46 | - shell_basename = basename(shell); | ||
47 | + shell_basename = basename(tmp); | ||
48 | arg0 = xmalloc(strlen(shell_basename) + 2); | ||
49 | arg0[0] = '-'; | ||
50 | strcpy(arg0 + 1, shell_basename); | ||
51 | args[0] = arg0; | ||
52 | - } else | ||
53 | - args[0] = basename(shell); | ||
54 | + } else { | ||
55 | + args[0] = basename(tmp); | ||
56 | + } | ||
57 | + free(tmp); | ||
58 | |||
59 | if (su->fast_startup) | ||
60 | args[argno++] = "-f"; | ||
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch index 748b6ef096..85ad7a5575 100644 --- a/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch +++ b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch | |||
@@ -1,20 +1,29 @@ | |||
1 | From 0b05e4695a0616badef71dfa459a00ef6ff1b521 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tudor Florea <tudor.florea@enea.com> | ||
3 | Date: Mon, 14 Jun 2021 14:00:31 +0200 | ||
4 | Subject: [PATCH] util-linux: Add ptest | ||
5 | |||
1 | Ptest needs buildtest-TESTS and runtest-TESTS targets. | 6 | Ptest needs buildtest-TESTS and runtest-TESTS targets. |
2 | serial-tests is required to generate those targets. | 7 | serial-tests is required to generate those targets. |
3 | Revert run.sh script accordingly to serialize running tests | 8 | Revert run.sh script accordingly to serialize running tests |
4 | 9 | ||
5 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> | 10 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> |
6 | Upstream-Status: Inappropriate | 11 | Upstream-Status: Inappropriate |
12 | |||
13 | --- | ||
14 | configure.ac | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
7 | 16 | ||
8 | Index: util-linux-2.32/configure.ac | 17 | diff --git a/configure.ac b/configure.ac |
9 | =================================================================== | 18 | index 890212f..870e817 100644 |
10 | --- util-linux-2.32.orig/configure.ac | 19 | --- a/configure.ac |
11 | +++ util-linux-2.32/configure.ac | 20 | +++ b/configure.ac |
12 | @@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4]) | 21 | @@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4]) |
13 | dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run | 22 | dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run |
14 | dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors. | 23 | dnl the compiler (like LT_INIT) to avoid autoconf errors. |
15 | AC_USE_SYSTEM_EXTENSIONS | 24 | AC_USE_SYSTEM_EXTENSIONS |
16 | -AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects]) | 25 | -AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects]) |
17 | +AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests]) | 26 | +AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests]) |
18 | 27 | ||
19 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], | 28 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], |
20 | [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) | 29 | [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) |
diff --git a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch index e475289f65..75adeca188 100644 --- a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch +++ b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch | |||
@@ -1,3 +1,8 @@ | |||
1 | From c79222a9a5e3425c55e150edc0b7ac59c573aa2f Mon Sep 17 00:00:00 2001 | ||
2 | From: Phil Blundell <pb@pbcl.net> | ||
3 | Date: Mon, 24 Sep 2012 07:24:51 +0100 | ||
4 | Subject: [PATCH] util-linux: Ensure that ${sbindir} is respected | ||
5 | |||
1 | util-linux: take ${sbindir} from the environment if it is set there | 6 | util-linux: take ${sbindir} from the environment if it is set there |
2 | fix the test, the [ ] syntax was getting eaten by autoconf | 7 | fix the test, the [ ] syntax was getting eaten by autoconf |
3 | 8 | ||
@@ -5,11 +10,15 @@ Signed-off-by: Phil Blundell <pb@pbcl.net> | |||
5 | Signed-off-by: Saul Wold <sgw@linux.intel.com | 10 | Signed-off-by: Saul Wold <sgw@linux.intel.com |
6 | Upstream-Status: Inappropriate [configuration] | 11 | Upstream-Status: Inappropriate [configuration] |
7 | 12 | ||
8 | Index: util-linux-2.31/configure.ac | 13 | --- |
9 | =================================================================== | 14 | configure.ac | 5 ++++- |
10 | --- util-linux-2.31.orig/configure.ac | 15 | 1 file changed, 4 insertions(+), 1 deletion(-) |
11 | +++ util-linux-2.31/configure.ac | 16 | |
12 | @@ -89,7 +89,10 @@ AC_SUBST([runstatedir]) | 17 | diff --git a/configure.ac b/configure.ac |
18 | index 36c24b4..890212f 100644 | ||
19 | --- a/configure.ac | ||
20 | +++ b/configure.ac | ||
21 | @@ -102,7 +102,10 @@ AC_SUBST([runstatedir]) | ||
13 | usrbin_execdir='${exec_prefix}/bin' | 22 | usrbin_execdir='${exec_prefix}/bin' |
14 | AC_SUBST([usrbin_execdir]) | 23 | AC_SUBST([usrbin_execdir]) |
15 | 24 | ||
diff --git a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch index 417ca1d98f..815ae9c915 100644 --- a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch +++ b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch | |||
@@ -1,4 +1,7 @@ | |||
1 | Display testname for subtest | 1 | From fc5de1de898fd1a372a2fd2fa493dc57323a029d Mon Sep 17 00:00:00 2001 |
2 | From: Tudor Florea <tudor.florea@enea.com> | ||
3 | Date: Thu, 3 Dec 2015 04:08:00 +0100 | ||
4 | Subject: [PATCH] Display testname for subtest | ||
2 | 5 | ||
3 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> | 6 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> |
4 | Upstream-Status: Pending | 7 | Upstream-Status: Pending |
@@ -8,10 +11,10 @@ Upstream-Status: Pending | |||
8 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
9 | 12 | ||
10 | diff --git a/tests/functions.sh b/tests/functions.sh | 13 | diff --git a/tests/functions.sh b/tests/functions.sh |
11 | index 5246605..b24dc15 100644 | 14 | index 5a562a3..098145e 100644 |
12 | --- a/tests/functions.sh | 15 | --- a/tests/functions.sh |
13 | +++ b/tests/functions.sh | 16 | +++ b/tests/functions.sh |
14 | @@ -320,7 +320,7 @@ function ts_init_subtest { | 17 | @@ -437,7 +437,7 @@ function ts_init_subtest { |
15 | 18 | ||
16 | if [ "$TS_PARSABLE" != "yes" ]; then | 19 | if [ "$TS_PARSABLE" != "yes" ]; then |
17 | [ $TS_NSUBTESTS -eq 1 ] && echo | 20 | [ $TS_NSUBTESTS -eq 1 ] && echo |
@@ -20,6 +23,3 @@ index 5246605..b24dc15 100644 | |||
20 | fi | 23 | fi |
21 | } | 24 | } |
22 | 25 | ||
23 | -- | ||
24 | 2.8.3 | ||
25 | |||
diff --git a/meta/recipes-core/util-linux/util-linux/fcntl-lock.c b/meta/recipes-core/util-linux/util-linux/fcntl-lock.c new file mode 100644 index 0000000000..966d8c5ecb --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux/fcntl-lock.c | |||
@@ -0,0 +1,332 @@ | |||
1 | // From https://github.com/magnumripper/fcntl-lock | ||
2 | // SPDX-License-Identifier: MIT | ||
3 | /* ----------------------------------------------------------------------- * | ||
4 | * | ||
5 | * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved | ||
6 | * Copyright 2015 magnum (fcntl version) | ||
7 | * | ||
8 | * Permission is hereby granted, free of charge, to any person | ||
9 | * obtaining a copy of this software and associated documentation | ||
10 | * files (the "Software"), to deal in the Software without | ||
11 | * restriction, including without limitation the rights to use, | ||
12 | * copy, modify, merge, publish, distribute, sublicense, and/or | ||
13 | * sell copies of the Software, and to permit persons to whom | ||
14 | * the Software is furnished to do so, subject to the following | ||
15 | * conditions: | ||
16 | * | ||
17 | * The above copyright notice and this permission notice shall | ||
18 | * be included in all copies or substantial portions of the Software. | ||
19 | * | ||
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
27 | * OTHER DEALINGS IN THE SOFTWARE. | ||
28 | * | ||
29 | * ----------------------------------------------------------------------- */ | ||
30 | |||
31 | #include <errno.h> | ||
32 | #include <stdio.h> | ||
33 | #include <stdlib.h> | ||
34 | #include <fcntl.h> | ||
35 | #include <unistd.h> | ||
36 | #include <getopt.h> | ||
37 | #include <signal.h> | ||
38 | #include <ctype.h> | ||
39 | #include <string.h> | ||
40 | #include <paths.h> | ||
41 | #include <sysexits.h> | ||
42 | #include <sys/types.h> | ||
43 | #include <sys/file.h> | ||
44 | #include <sys/time.h> | ||
45 | #include <sys/wait.h> | ||
46 | |||
47 | #define PACKAGE_STRING "magnum" | ||
48 | #define _(x) (x) | ||
49 | |||
50 | static const struct option long_options[] = { | ||
51 | { "shared", 0, NULL, 's' }, | ||
52 | { "exclusive", 0, NULL, 'x' }, | ||
53 | { "unlock", 0, NULL, 'u' }, | ||
54 | { "nonblocking", 0, NULL, 'n' }, | ||
55 | { "nb", 0, NULL, 'n' }, | ||
56 | { "timeout", 1, NULL, 'w' }, | ||
57 | { "wait", 1, NULL, 'w' }, | ||
58 | { "close", 0, NULL, 'o' }, | ||
59 | { "help", 0, NULL, 'h' }, | ||
60 | { "version", 0, NULL, 'V' }, | ||
61 | { 0, 0, 0, 0 } | ||
62 | }; | ||
63 | |||
64 | const char *program; | ||
65 | |||
66 | static void usage(int ex) | ||
67 | { | ||
68 | fputs("fcntl-lock (" PACKAGE_STRING ")\n", stderr); | ||
69 | fprintf(stderr, | ||
70 | _("Usage: %1$s [-sxun][-w #] fd#\n" | ||
71 | " %1$s [-sxon][-w #] file [-c] command...\n" | ||
72 | " %1$s [-sxon][-w #] directory [-c] command...\n" | ||
73 | " -s --shared Get a shared lock\n" | ||
74 | " -x --exclusive Get an exclusive lock\n" | ||
75 | " -u --unlock Remove a lock\n" | ||
76 | " -n --nonblock Fail rather than wait\n" | ||
77 | " -w --timeout Wait for a limited amount of time\n" | ||
78 | " -o --close Close file descriptor before running command\n" | ||
79 | " -c --command Run a single command string through the shell\n" | ||
80 | " -h --help Display this text\n" | ||
81 | " -V --version Display version\n"), | ||
82 | program); | ||
83 | exit(ex); | ||
84 | } | ||
85 | |||
86 | |||
87 | static sig_atomic_t timeout_expired = 0; | ||
88 | |||
89 | static void timeout_handler(int sig) | ||
90 | { | ||
91 | (void)sig; | ||
92 | |||
93 | timeout_expired = 1; | ||
94 | } | ||
95 | |||
96 | |||
97 | static char * strtotimeval(const char *str, struct timeval *tv) | ||
98 | { | ||
99 | char *s; | ||
100 | long fs; /* Fractional seconds */ | ||
101 | int i; | ||
102 | |||
103 | tv->tv_sec = strtol(str, &s, 10); | ||
104 | fs = 0; | ||
105 | |||
106 | if ( *s == '.' ) { | ||
107 | s++; | ||
108 | |||
109 | for ( i = 0 ; i < 6 ; i++ ) { | ||
110 | if ( !isdigit(*s) ) | ||
111 | break; | ||
112 | |||
113 | fs *= 10; | ||
114 | fs += *s++ - '0'; | ||
115 | } | ||
116 | |||
117 | for ( ; i < 6; i++ ) | ||
118 | fs *= 10; | ||
119 | |||
120 | while ( isdigit(*s) ) | ||
121 | s++; | ||
122 | } | ||
123 | |||
124 | tv->tv_usec = fs; | ||
125 | return s; | ||
126 | } | ||
127 | |||
128 | int main(int argc, char *argv[]) | ||
129 | { | ||
130 | struct itimerval timeout, old_timer; | ||
131 | int have_timeout = 0; | ||
132 | int type = F_WRLCK; | ||
133 | int block = F_SETLKW; | ||
134 | int fd = -1; | ||
135 | int opt, ix; | ||
136 | int do_close = 0; | ||
137 | int err; | ||
138 | int status; | ||
139 | char *eon; | ||
140 | char **cmd_argv = NULL, *sh_c_argv[4]; | ||
141 | struct flock lock; | ||
142 | const char *filename = NULL; | ||
143 | struct sigaction sa, old_sa; | ||
144 | |||
145 | program = argv[0]; | ||
146 | |||
147 | if ( argc < 2 ) | ||
148 | usage(EX_USAGE); | ||
149 | |||
150 | memset(&timeout, 0, sizeof timeout); | ||
151 | |||
152 | optopt = 0; | ||
153 | while ( (opt = getopt_long(argc, argv, "+sexnouw:hV?", long_options, &ix)) != EOF ) { | ||
154 | switch(opt) { | ||
155 | case 's': | ||
156 | type = F_RDLCK; | ||
157 | break; | ||
158 | case 'e': | ||
159 | case 'x': | ||
160 | type = F_WRLCK; | ||
161 | break; | ||
162 | case 'u': | ||
163 | type = F_UNLCK; | ||
164 | break; | ||
165 | case 'o': | ||
166 | do_close = 1; | ||
167 | break; | ||
168 | case 'n': | ||
169 | block = F_SETLK; | ||
170 | break; | ||
171 | case 'w': | ||
172 | have_timeout = 1; | ||
173 | eon = strtotimeval(optarg, &timeout.it_value); | ||
174 | if ( *eon ) | ||
175 | usage(EX_USAGE); | ||
176 | break; | ||
177 | case 'V': | ||
178 | printf("fcntl-lock (%s)\n", PACKAGE_STRING); | ||
179 | exit(0); | ||
180 | default: | ||
181 | /* optopt will be set if this was an unrecognized option, i.e. *not* 'h' or '?' */ | ||
182 | usage(optopt ? EX_USAGE : 0); | ||
183 | break; | ||
184 | } | ||
185 | } | ||
186 | |||
187 | if ( argc > optind+1 ) { | ||
188 | /* Run command */ | ||
189 | |||
190 | if ( !strcmp(argv[optind+1], "-c") || | ||
191 | !strcmp(argv[optind+1], "--command") ) { | ||
192 | |||
193 | if ( argc != optind+3 ) { | ||
194 | fprintf(stderr, _("%s: %s requires exactly one command argument\n"), | ||
195 | program, argv[optind+1]); | ||
196 | exit(EX_USAGE); | ||
197 | } | ||
198 | |||
199 | cmd_argv = sh_c_argv; | ||
200 | |||
201 | cmd_argv[0] = getenv("SHELL"); | ||
202 | if ( !cmd_argv[0] || !*cmd_argv[0] ) | ||
203 | cmd_argv[0] = _PATH_BSHELL; | ||
204 | |||
205 | cmd_argv[1] = "-c"; | ||
206 | cmd_argv[2] = argv[optind+2]; | ||
207 | cmd_argv[3] = 0; | ||
208 | } else { | ||
209 | cmd_argv = &argv[optind+1]; | ||
210 | } | ||
211 | |||
212 | filename = argv[optind]; | ||
213 | fd = open(filename, O_RDWR|O_NOCTTY|O_CREAT, 0666); | ||
214 | /* Linux doesn't like O_CREAT on a directory, even though it should be a | ||
215 | no-op */ | ||
216 | if (fd < 0 && errno == EISDIR) | ||
217 | fd = open(filename, O_RDONLY|O_NOCTTY); | ||
218 | |||
219 | if ( fd < 0 ) { | ||
220 | err = errno; | ||
221 | fprintf(stderr, _("%s: cannot open lock file %s: %s\n"), | ||
222 | program, argv[optind], strerror(err)); | ||
223 | exit((err == ENOMEM||err == EMFILE||err == ENFILE) ? EX_OSERR : | ||
224 | (err == EROFS||err == ENOSPC) ? EX_CANTCREAT : | ||
225 | EX_NOINPUT); | ||
226 | } | ||
227 | |||
228 | } else if (optind < argc) { | ||
229 | /* Use provided file descriptor */ | ||
230 | |||
231 | fd = (int)strtol(argv[optind], &eon, 10); | ||
232 | if ( *eon || !argv[optind] ) { | ||
233 | fprintf(stderr, _("%s: bad number: %s\n"), program, argv[optind]); | ||
234 | exit(EX_USAGE); | ||
235 | } | ||
236 | |||
237 | } else { | ||
238 | /* Bad options */ | ||
239 | |||
240 | fprintf(stderr, _("%s: requires file descriptor, file or directory\n"), | ||
241 | program); | ||
242 | exit(EX_USAGE); | ||
243 | } | ||
244 | |||
245 | |||
246 | if ( have_timeout ) { | ||
247 | if ( timeout.it_value.tv_sec == 0 && | ||
248 | timeout.it_value.tv_usec == 0 ) { | ||
249 | /* -w 0 is equivalent to -n; this has to be special-cased | ||
250 | because setting an itimer to zero means disabled! */ | ||
251 | |||
252 | have_timeout = 0; | ||
253 | block = F_SETLK; | ||
254 | } else { | ||
255 | memset(&sa, 0, sizeof sa); | ||
256 | |||
257 | sa.sa_handler = timeout_handler; | ||
258 | sa.sa_flags = SA_RESETHAND; | ||
259 | sigaction(SIGALRM, &sa, &old_sa); | ||
260 | |||
261 | setitimer(ITIMER_REAL, &timeout, &old_timer); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | memset(&lock, 0, sizeof(lock)); | ||
266 | lock.l_type = type; | ||
267 | while ( fcntl(fd, block, &lock) ) { | ||
268 | switch( (err = errno) ) { | ||
269 | case EAGAIN: /* -n option set and failed to lock */ | ||
270 | case EACCES: /* -n option set and failed to lock */ | ||
271 | exit(1); | ||
272 | case EINTR: /* Signal received */ | ||
273 | if ( timeout_expired ) | ||
274 | exit(1); /* -w option set and failed to lock */ | ||
275 | continue; /* otherwise try again */ | ||
276 | default: /* Other errors */ | ||
277 | if ( filename ) | ||
278 | fprintf(stderr, "%s: %s: %s\n", program, filename, strerror(err)); | ||
279 | else | ||
280 | fprintf(stderr, "%s: %d: %s\n", program, fd, strerror(err)); | ||
281 | exit((err == ENOLCK||err == ENOMEM) ? EX_OSERR : EX_DATAERR); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | if ( have_timeout ) { | ||
286 | setitimer(ITIMER_REAL, &old_timer, NULL); /* Cancel itimer */ | ||
287 | sigaction(SIGALRM, &old_sa, NULL); /* Cancel signal handler */ | ||
288 | } | ||
289 | |||
290 | status = 0; | ||
291 | |||
292 | if ( cmd_argv ) { | ||
293 | pid_t w, f; | ||
294 | |||
295 | /* Clear any inherited settings */ | ||
296 | signal(SIGCHLD, SIG_DFL); | ||
297 | f = fork(); | ||
298 | |||
299 | if ( f < 0 ) { | ||
300 | err = errno; | ||
301 | fprintf(stderr, _("%s: fork failed: %s\n"), program, strerror(err)); | ||
302 | exit(EX_OSERR); | ||
303 | } else if ( f == 0 ) { | ||
304 | if ( do_close ) | ||
305 | close(fd); | ||
306 | err = errno; | ||
307 | execvp(cmd_argv[0], cmd_argv); | ||
308 | /* execvp() failed */ | ||
309 | fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err)); | ||
310 | _exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE); | ||
311 | } else { | ||
312 | do { | ||
313 | w = waitpid(f, &status, 0); | ||
314 | if (w == -1 && errno != EINTR) | ||
315 | break; | ||
316 | } while ( w != f ); | ||
317 | |||
318 | if (w == -1) { | ||
319 | err = errno; | ||
320 | status = EXIT_FAILURE; | ||
321 | fprintf(stderr, "%s: waitpid failed: %s\n", program, strerror(err)); | ||
322 | } else if ( WIFEXITED(status) ) | ||
323 | status = WEXITSTATUS(status); | ||
324 | else if ( WIFSIGNALED(status) ) | ||
325 | status = WTERMSIG(status) + 128; | ||
326 | else | ||
327 | status = EX_OSERR; /* WTF? */ | ||
328 | } | ||
329 | } | ||
330 | |||
331 | return status; | ||
332 | } | ||
diff --git a/meta/recipes-core/util-linux/util-linux/mit-license.patch b/meta/recipes-core/util-linux/util-linux/mit-license.patch new file mode 100644 index 0000000000..afbec98f18 --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux/mit-license.patch | |||
@@ -0,0 +1,45 @@ | |||
1 | From 5b8fab1584017d9d9be008c23b90128bba41a7b5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Thu, 28 Mar 2024 12:16:57 +0000 | ||
4 | Subject: [PATCH] README.licensing/flock: Add MIT license mention | ||
5 | |||
6 | Looking at the license text, flock.c is under the MIT license (see | ||
7 | https://spdx.org/licenses/MIT). | ||
8 | |||
9 | Add an SPDX license identifier header and add to the list of licenses the | ||
10 | source so everything is correctly listed/identified. | ||
11 | |||
12 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
13 | |||
14 | Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2870] | ||
15 | |||
16 | --- | ||
17 | README.licensing | 2 ++ | ||
18 | sys-utils/flock.c | 4 +++- | ||
19 | 2 files changed, 5 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/README.licensing b/README.licensing | ||
22 | index 4454f8392a..535ad34813 100644 | ||
23 | --- a/README.licensing | ||
24 | +++ b/README.licensing | ||
25 | @@ -12,6 +12,8 @@ There is code under: | ||
26 | |||
27 | * LGPL-2.1-or-later - GNU Lesser General Public License 2.1 or any later version | ||
28 | |||
29 | + * MIT - MIT License | ||
30 | + | ||
31 | * BSD-2-Clause - Simplified BSD License | ||
32 | |||
33 | * BSD-3-Clause - BSD 3-Clause "New" or "Revised" License | ||
34 | diff --git a/sys-utils/flock.c b/sys-utils/flock.c | ||
35 | index fed29d7270..7d878ff810 100644 | ||
36 | --- a/sys-utils/flock.c | ||
37 | +++ b/sys-utils/flock.c | ||
38 | @@ -1,4 +1,6 @@ | ||
39 | -/* Copyright 2003-2005 H. Peter Anvin - All Rights Reserved | ||
40 | +/* SPDX-License-Identifier: MIT | ||
41 | + * | ||
42 | + * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved | ||
43 | * | ||
44 | * Permission is hereby granted, free of charge, to any person | ||
45 | * obtaining a copy of this software and associated documentation | ||
diff --git a/meta/recipes-core/util-linux/util-linux/ptest.patch b/meta/recipes-core/util-linux/util-linux/ptest.patch index 0537f7d856..6221de7182 100644 --- a/meta/recipes-core/util-linux/util-linux/ptest.patch +++ b/meta/recipes-core/util-linux/util-linux/ptest.patch | |||
@@ -1,23 +1,24 @@ | |||
1 | Define TESTS variable | 1 | From d0a69ce80c579cbb7627a2f20e8b92e006a8d8ad Mon Sep 17 00:00:00 2001 |
2 | From: Tudor Florea <tudor.florea@enea.com> | ||
3 | Date: Thu, 3 Dec 2015 04:08:00 +0100 | ||
4 | Subject: [PATCH] Define TESTS variable | ||
2 | 5 | ||
3 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> | 6 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> |
4 | Upstream-Status: Pending | 7 | Upstream-Status: Pending |
8 | |||
5 | --- | 9 | --- |
6 | Makefile.am | 1 + | 10 | Makefile.am | 1 + |
7 | 1 file changed, 1 insertion(+) | 11 | 1 file changed, 1 insertion(+) |
8 | 12 | ||
9 | diff --git a/Makefile.am b/Makefile.am | 13 | diff --git a/Makefile.am b/Makefile.am |
10 | index bbaccb1..7d5a6bb 100644 | 14 | index effbb02..7d2bd1e 100644 |
11 | --- a/Makefile.am | 15 | --- a/Makefile.am |
12 | +++ b/Makefile.am | 16 | +++ b/Makefile.am |
13 | @@ -48,6 +48,7 @@ systemdsystemunit_DATA = | 17 | @@ -57,6 +57,7 @@ systemdsystemunit_DATA = |
14 | dist_bashcompletion_DATA = | 18 | dist_bashcompletion_DATA = |
15 | check_PROGRAMS = | 19 | check_PROGRAMS = |
16 | dist_check_SCRIPTS = | 20 | dist_check_SCRIPTS = |
17 | +TESTS = $(check_PROGRAMS) | 21 | +TESTS = $(check_PROGRAMS) |
18 | 22 | ||
19 | PATHFILES = | 23 | PATHFILES = |
20 | 24 | ADOCFILES_COMMON = | |
21 | -- | ||
22 | 2.8.3 | ||
23 | |||
diff --git a/meta/recipes-core/util-linux/util-linux/run-ptest b/meta/recipes-core/util-linux/util-linux/run-ptest index e135ee583b..7b6b1d1dc2 100644 --- a/meta/recipes-core/util-linux/util-linux/run-ptest +++ b/meta/recipes-core/util-linux/util-linux/run-ptest | |||
@@ -13,31 +13,23 @@ current_path=$(readlink -f $0) | |||
13 | export bindir=$(dirname $current_path) | 13 | export bindir=$(dirname $current_path) |
14 | export PATH=$bindir/bin:$PATH | 14 | export PATH=$bindir/bin:$PATH |
15 | 15 | ||
16 | cd tests || exit 1 | 16 | # losetup tests will be skipped and/or fail otherwise |
17 | 17 | modprobe loop | |
18 | comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" | sort) | 18 | |
19 | 19 | # required for mount/fallback test to pass | |
20 | 20 | # systemd does this by default, but ptest images do not use it | |
21 | echo | 21 | # see https://man7.org/linux/man-pages/man7/mount_namespaces.7.html |
22 | echo "-------------------- util-linux regression tests --------------------" | 22 | # for a long description of mount namespaces in Linux |
23 | echo | 23 | mount --make-shared / |
24 | echo " For development purpose only. " | 24 | |
25 | echo " Don't execute on production system! " | 25 | # lsfd/option-inet has races in the test script: |
26 | echo | 26 | # https://github.com/util-linux/util-linux/issues/2399 |
27 | 27 | ./tests/run.sh --use-system-commands --parsable --show-diff --exclude=lsfd/option-inet | sed -u '{ | |
28 | res=0 | ||
29 | count=0 | ||
30 | for ts in $comps; | ||
31 | do | ||
32 | $ts | sed -u '{ | ||
33 | s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/ | 28 | s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/ |
34 | s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/ | 29 | s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/ |
35 | s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/ | 30 | s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/ |
36 | }' | 31 | }' |
37 | done | ||
38 | |||
39 | 32 | ||
40 | if [ "x$UDEV_PID" != "x" ]; then | 33 | if [ "x$UDEV_PID" != "x" ]; then |
41 | /etc/init.d/udev start | 34 | /etc/init.d/udev start |
42 | fi | 35 | fi |
43 | |||