summaryrefslogtreecommitdiff
path: root/package/busybox/patches
diff options
context:
space:
mode:
Diffstat (limited to 'package/busybox/patches')
-rw-r--r--package/busybox/patches/002-find-empty.patch90
-rw-r--r--package/busybox/patches/002-hwclock-musl.patch31
-rw-r--r--package/busybox/patches/006-od-bloat.patch214
-rw-r--r--package/busybox/patches/009-Replace-obsolete-stime-API-with-clock_settime.patch65
-rw-r--r--package/busybox/patches/009-disable-Oz.patch20
5 files changed, 51 insertions, 369 deletions
diff --git a/package/busybox/patches/002-find-empty.patch b/package/busybox/patches/002-find-empty.patch
deleted file mode 100644
index f8c1f98cf..000000000
--- a/package/busybox/patches/002-find-empty.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-diff -Nur busybox-1.17.0.orig/findutils/find.c busybox-1.17.0/findutils/find.c
---- busybox-1.17.0.orig/findutils/find.c 2010-06-24 04:40:43.000000000 +0200
-+++ busybox-1.17.0/findutils/find.c 2010-07-08 12:33:55.759015289 +0200
-@@ -133,6 +133,14 @@
- //config: help
- //config: Support the 'find -inum' option for searching by inode number.
- //config:
-+//config:config FEATURE_FIND_EMPTY
-+//config: bool "Enable -empty option matching empty files and directories"
-+//config: default y
-+//config: depends on FIND
-+//config: help
-+//config: Support the 'find -empty' option for searching empty files
-+//config: and directories.
-+//config:
- //config:config FEATURE_FIND_EXEC
- //config: bool "Enable -exec: execute commands"
- //config: default y
-@@ -270,6 +278,7 @@
- IF_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;))
- IF_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;))
- IF_FEATURE_FIND_PRUNE( ACTS(prune))
-+IF_FEATURE_FIND_EMPTY( ACTS(empty))
- IF_FEATURE_FIND_DELETE( ACTS(delete))
- IF_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;))
- IF_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;))
-@@ -519,6 +528,34 @@
- return exec_actions(ap->subexpr, fileName, statbuf);
- }
- #endif
-+#if ENABLE_FEATURE_FIND_EMPTY
-+ACTF(empty)
-+{
-+ DIR *d;
-+ struct dirent *dp;
-+ bool empty = TRUE;
-+
-+ if (S_ISDIR(statbuf->st_mode)) {
-+ d = opendir(fileName);
-+ if (d == NULL)
-+ bb_simple_perror_msg(fileName);
-+ for (dp = readdir(d); dp; dp = readdir(d)) {
-+ if (dp->d_name[0] != '.' ||
-+ (dp->d_name[1] != '\0' &&
-+ (dp->d_name[1] != '.' ||
-+ dp->d_name[2] != '\0'))) {
-+ empty = FALSE;
-+ break;
-+ }
-+ }
-+ closedir(d);
-+ return(empty);
-+ } else if (S_ISREG(statbuf->st_mode))
-+ return (statbuf->st_size == 0);
-+ else
-+ return FALSE;
-+}
-+#endif
- #if ENABLE_FEATURE_FIND_SIZE
- ACTF(size)
- {
-@@ -686,6 +723,7 @@
- IF_FEATURE_FIND_PRINT0( PARM_print0 ,)
- IF_FEATURE_FIND_DEPTH( PARM_depth ,)
- IF_FEATURE_FIND_PRUNE( PARM_prune ,)
-+ IF_FEATURE_FIND_EMPTY( PARM_empty ,)
- IF_FEATURE_FIND_DELETE( PARM_delete ,)
- IF_FEATURE_FIND_EXEC( PARM_exec ,)
- IF_FEATURE_FIND_PAREN( PARM_char_brace,)
-@@ -720,6 +758,7 @@
- IF_FEATURE_FIND_PRINT0( "-print0\0" )
- IF_FEATURE_FIND_DEPTH( "-depth\0" )
- IF_FEATURE_FIND_PRUNE( "-prune\0" )
-+ IF_FEATURE_FIND_EMPTY( "-empty\0" )
- IF_FEATURE_FIND_DELETE( "-delete\0" )
- IF_FEATURE_FIND_EXEC( "-exec\0" )
- IF_FEATURE_FIND_PAREN( "(\0" )
-@@ -839,6 +878,12 @@
- (void) ALLOC_ACTION(prune);
- }
- #endif
-+#if ENABLE_FEATURE_FIND_EMPTY
-+ else if (parm == PARM_empty) {
-+ IF_FEATURE_FIND_NOT( invert_flag = 0; )
-+ (void) ALLOC_ACTION(empty);
-+ }
-+#endif
- #if ENABLE_FEATURE_FIND_DELETE
- else if (parm == PARM_delete) {
- G.need_print = 0;
diff --git a/package/busybox/patches/002-hwclock-musl.patch b/package/busybox/patches/002-hwclock-musl.patch
new file mode 100644
index 000000000..a5b9ff50d
--- /dev/null
+++ b/package/busybox/patches/002-hwclock-musl.patch
@@ -0,0 +1,31 @@
+diff -Nur busybox-1.36.1.orig/util-linux/hwclock.c busybox-1.36.1/util-linux/hwclock.c
+--- busybox-1.36.1.orig/util-linux/hwclock.c 2021-01-01 11:52:27.000000000 +0100
++++ busybox-1.36.1/util-linux/hwclock.c 2024-04-10 11:18:06.569673535 +0200
+@@ -136,10 +136,24 @@
+ * because "it's deprecated by POSIX, therefore it's fine
+ * if we gratuitously break stuff" :(
+ */
+-#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
+-# define SYS_settimeofday SYS_settimeofday_time32
+-#endif
++# if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
++# define SYS_settimeofday SYS_settimeofday_time32
++# endif
++# if defined(SYS_settimeofday)
+ int ret = syscall(SYS_settimeofday, NULL, tz);
++# else
++ /* Some new architectures have neither settimeofday nor
++ * settimeofday_time32, and the whole kernel timezone handling appears
++ * to have been dropped due to some oddities in the API. See:
++ *
++ * - glibc's commit c3f9aef063 ("Use clock_settime to implement settimeofday.")
++ * - https://github.com/systemd/systemd/issues/13305
++ * - https://inbox.sourceware.org/libc-alpha/cb015d0d1d29e4b948c7118c5b12ff2bed83a6ec.1561421042.git.alistair.francis@wdc.com/
++ *
++ * So instead just silently drop these calls.
++ */
++ int ret = -ENOSYS;
++# endif
+ #else
+ int ret = settimeofday(NULL, tz);
+ #endif
diff --git a/package/busybox/patches/006-od-bloat.patch b/package/busybox/patches/006-od-bloat.patch
deleted file mode 100644
index ff501acdb..000000000
--- a/package/busybox/patches/006-od-bloat.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-diff -Nur busybox-1.18.1.orig/coreutils/od.c busybox-1.18.1/coreutils/od.c
---- busybox-1.18.1.orig/coreutils/od.c 2010-12-20 01:41:26.000000000 +0100
-+++ busybox-1.18.1/coreutils/od.c 2010-12-25 23:18:48.000000000 +0100
-@@ -13,210 +13,4 @@
-
-
- #include "libbb.h"
--#if ENABLE_DESKTOP
--/* This one provides -t (busybox's own build script needs it) */
- #include "od_bloaty.c"
--#else
--
--#include "dump.h"
--
--static void
--odoffset(dumper_t *dumper, int argc, char ***argvp)
--{
-- char *num, *p;
-- int base;
-- char *end;
--
-- /*
-- * The offset syntax of od(1) was genuinely bizarre. First, if
-- * it started with a plus it had to be an offset. Otherwise, if
-- * there were at least two arguments, a number or lower-case 'x'
-- * followed by a number makes it an offset. By default it was
-- * octal; if it started with 'x' or '0x' it was hex. If it ended
-- * in a '.', it was decimal. If a 'b' or 'B' was appended, it
-- * multiplied the number by 512 or 1024 byte units. There was
-- * no way to assign a block count to a hex offset.
-- *
-- * We assumes it's a file if the offset is bad.
-- */
-- p = **argvp;
--
-- if (!p) {
-- /* hey someone is probably piping to us ... */
-- return;
-- }
--
-- if ((*p != '+')
-- && (argc < 2
-- || (!isdigit(p[0])
-- && ((p[0] != 'x') || !isxdigit(p[1])))))
-- return;
--
-- base = 0;
-- /*
-- * skip over leading '+', 'x[0-9a-fA-f]' or '0x', and
-- * set base.
-- */
-- if (p[0] == '+')
-- ++p;
-- if (p[0] == 'x' && isxdigit(p[1])) {
-- ++p;
-- base = 16;
-- } else if (p[0] == '0' && p[1] == 'x') {
-- p += 2;
-- base = 16;
-- }
--
-- /* skip over the number */
-- if (base == 16)
-- for (num = p; isxdigit(*p); ++p)
-- continue;
-- else
-- for (num = p; isdigit(*p); ++p)
-- continue;
--
-- /* check for no number */
-- if (num == p)
-- return;
--
-- /* if terminates with a '.', base is decimal */
-- if (*p == '.') {
-- if (base)
-- return;
-- base = 10;
-- }
--
-- dumper->dump_skip = strtol(num, &end, base ? base : 8);
--
-- /* if end isn't the same as p, we got a non-octal digit */
-- if (end != p)
-- dumper->dump_skip = 0;
-- else {
-- if (*p) {
-- if (*p == 'b') {
-- dumper->dump_skip *= 512;
-- ++p;
-- } else if (*p == 'B') {
-- dumper->dump_skip *= 1024;
-- ++p;
-- }
-- }
-- if (*p)
-- dumper->dump_skip = 0;
-- else {
-- ++*argvp;
-- /*
-- * If the offset uses a non-octal base, the base of
-- * the offset is changed as well. This isn't pretty,
-- * but it's easy.
-- */
--#define TYPE_OFFSET 7
-- {
-- char x_or_d;
-- if (base == 16) {
-- x_or_d = 'x';
-- goto DO_X_OR_D;
-- }
-- if (base == 10) {
-- x_or_d = 'd';
-- DO_X_OR_D:
-- dumper->fshead->nextfu->fmt[TYPE_OFFSET]
-- = dumper->fshead->nextfs->nextfu->fmt[TYPE_OFFSET]
-- = x_or_d;
-- }
-- }
-- }
-- }
--}
--
--static const char *const add_strings[] = {
-- "16/1 \"%3_u \" \"\\n\"", /* a */
-- "8/2 \" %06o \" \"\\n\"", /* B, o */
-- "16/1 \"%03o \" \"\\n\"", /* b */
-- "16/1 \"%3_c \" \"\\n\"", /* c */
-- "8/2 \" %05u \" \"\\n\"", /* d */
-- "4/4 \" %010u \" \"\\n\"", /* D */
-- "2/8 \" %21.14e \" \"\\n\"", /* e (undocumented in od), F */
-- "4/4 \" %14.7e \" \"\\n\"", /* f */
-- "4/4 \" %08x \" \"\\n\"", /* H, X */
-- "8/2 \" %04x \" \"\\n\"", /* h, x */
-- "4/4 \" %11d \" \"\\n\"", /* I, L, l */
-- "8/2 \" %6d \" \"\\n\"", /* i */
-- "4/4 \" %011o \" \"\\n\"", /* O */
--};
--
--static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxv";
--
--static const char od_o2si[] ALIGN1 = {
-- 0, 1, 2, 3, 5,
-- 4, 6, 6, 7, 8,
-- 9, 0xa, 0xb, 0xa, 0xa,
-- 0xb, 1, 8, 9,
--};
--
--int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
--int od_main(int argc, char **argv)
--{
-- int ch;
-- int first = 1;
-- char *p;
-- dumper_t *dumper = alloc_dumper();
--
-- while ((ch = getopt(argc, argv, od_opts)) > 0) {
-- if (ch == 'v') {
-- dumper->dump_vflag = ALL;
-- } else if (((p = strchr(od_opts, ch)) != NULL) && (*p != '\0')) {
-- if (first) {
-- first = 0;
-- bb_dump_add(dumper, "\"%07.7_Ao\n\"");
-- bb_dump_add(dumper, "\"%07.7_ao \"");
-- } else {
-- bb_dump_add(dumper, "\" \"");
-- }
-- bb_dump_add(dumper, add_strings[(int)od_o2si[(p - od_opts)]]);
-- } else { /* P, p, s, w, or other unhandled */
-- bb_show_usage();
-- }
-- }
-- if (!dumper->fshead) {
-- bb_dump_add(dumper, "\"%07.7_Ao\n\"");
-- bb_dump_add(dumper, "\"%07.7_ao \" 8/2 \"%06o \" \"\\n\"");
-- }
--
-- argc -= optind;
-- argv += optind;
--
-- odoffset(dumper, argc, &argv);
--
-- return bb_dump_dump(dumper, argv);
--}
--#endif /* ENABLE_DESKTOP */
--
--/*-
-- * Copyright (c) 1990 The Regents of the University of California.
-- * All rights reserved.
-- *
-- * Redistribution and use in source and binary forms, with or without
-- * modification, are permitted provided that the following conditions
-- * are met:
-- * 1. Redistributions of source code must retain the above copyright
-- * notice, this list of conditions and the following disclaimer.
-- * 2. Redistributions in binary form must reproduce the above copyright
-- * notice, this list of conditions and the following disclaimer in the
-- * documentation and/or other materials provided with the distribution.
-- * 3. Neither the name of the University nor the names of its contributors
-- * may be used to endorse or promote products derived from this software
-- * without specific prior written permission.
-- *
-- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-- * SUCH DAMAGE.
-- */
diff --git a/package/busybox/patches/009-Replace-obsolete-stime-API-with-clock_settime.patch b/package/busybox/patches/009-Replace-obsolete-stime-API-with-clock_settime.patch
deleted file mode 100644
index 14795da41..000000000
--- a/package/busybox/patches/009-Replace-obsolete-stime-API-with-clock_settime.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-diff -Nur busybox-1.26.2.orig/coreutils/date.c busybox-1.26.2/coreutils/date.c
---- busybox-1.26.2.orig/coreutils/date.c 2016-12-10 18:46:36.000000000 +0100
-+++ busybox-1.26.2/coreutils/date.c 2020-02-04 09:55:25.126083910 +0100
-@@ -267,6 +267,9 @@
- time(&ts.tv_sec);
- #endif
- }
-+#if !ENABLE_FEATURE_DATE_NANO
-+ ts.tv_nsec = 0;
-+#endif
- localtime_r(&ts.tv_sec, &tm_time);
-
- /* If date string is given, update tm_time, and maybe set date */
-@@ -289,11 +292,12 @@
- if (date_str[0] != '@')
- tm_time.tm_isdst = -1;
- ts.tv_sec = validate_tm_time(date_str, &tm_time);
-+ ts.tv_nsec = 0;
-
- maybe_set_utc(opt);
-
- /* if setting time, set it */
-- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
-+ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
- bb_perror_msg("can't set date");
- }
- }
-diff -Nur busybox-1.26.2.orig/libbb/missing_syscalls.c busybox-1.26.2/libbb/missing_syscalls.c
---- busybox-1.26.2.orig/libbb/missing_syscalls.c 2016-09-27 18:53:50.000000000 +0200
-+++ busybox-1.26.2/libbb/missing_syscalls.c 2020-02-04 09:55:58.848244715 +0100
-@@ -16,14 +16,6 @@
- return syscall(__NR_getsid, pid);
- }
-
--int stime(const time_t *t)
--{
-- struct timeval tv;
-- tv.tv_sec = *t;
-- tv.tv_usec = 0;
-- return settimeofday(&tv, NULL);
--}
--
- int sethostname(const char *name, size_t len)
- {
- return syscall(__NR_sethostname, name, len);
-diff -Nur busybox-1.26.2.orig/util-linux/rdate.c busybox-1.26.2/util-linux/rdate.c
---- busybox-1.26.2.orig/util-linux/rdate.c 2016-12-10 18:46:36.000000000 +0100
-+++ busybox-1.26.2/util-linux/rdate.c 2020-02-04 09:56:53.927774023 +0100
-@@ -79,9 +79,13 @@
- time(&current_time);
- if (current_time == remote_time)
- bb_error_msg("current time matches remote time");
-- else
-- if (stime(&remote_time) < 0)
-- bb_perror_msg_and_die("can't set time of day");
-+ else {
-+ struct timespec ts;
-+ ts.tv_sec = remote_time;
-+ ts.tv_nsec = 0;
-+ if (clock_settime(CLOCK_REALTIME, &ts) < 0)
-+ bb_perror_msg_and_die("can't set time of day");
-+ }
- }
-
- if (flags != 1) /* not lone -s */
diff --git a/package/busybox/patches/009-disable-Oz.patch b/package/busybox/patches/009-disable-Oz.patch
new file mode 100644
index 000000000..11830586f
--- /dev/null
+++ b/package/busybox/patches/009-disable-Oz.patch
@@ -0,0 +1,20 @@
+diff -Nur busybox-1.36.1.orig/Makefile.flags busybox-1.36.1/Makefile.flags
+--- busybox-1.36.1.orig/Makefile.flags 2023-01-03 15:14:43.000000000 +0100
++++ busybox-1.36.1/Makefile.flags 2023-07-30 15:24:31.983113101 +0200
+@@ -87,14 +87,14 @@
+ #CFLAGS += $(call cc-option,-Wconversion,)
+
+ ifneq ($(CONFIG_DEBUG),y)
+-CFLAGS += $(call cc-option,-Oz,$(call cc-option,-Os,$(call cc-option,-O2,)))
++CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
+ else
+ CFLAGS += $(call cc-option,-g,)
+ #CFLAGS += "-D_FORTIFY_SOURCE=2"
+ ifeq ($(CONFIG_DEBUG_PESSIMIZE),y)
+ CFLAGS += $(call cc-option,-O0,)
+ else
+-CFLAGS += $(call cc-option,-Oz,$(call cc-option,-Os,$(call cc-option,-O2,)))
++CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
+ endif
+ endif
+ ifeq ($(CONFIG_DEBUG_SANITIZE),y)