aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2025-11-11 10:00:52 +0000
committerRon Yorston <rmy@pobox.com>2025-11-11 10:00:52 +0000
commit0ee678e0d1d465f3d83fb22a4ec4e7ca33686284 (patch)
tree390f1390bcf2db0fe2cd2411e817eaed5832cfa0
parentaf09683cfc5ffe05f3e42bb592fe15a753540d85 (diff)
parent8d7ae80eda7e08ee361f8793683ae58216caf720 (diff)
downloadbusybox-w32-master.tar.gz
busybox-w32-master.tar.bz2
busybox-w32-master.zip
Merge branch 'busybox' into mergeHEADmergemaster
-rw-r--r--Config.in7
-rw-r--r--coreutils/dd.c12
-rw-r--r--coreutils/ls.c3
-rw-r--r--include/libbb.h4
-rw-r--r--libbb/appletlib.c16
-rw-r--r--libbb/lineedit.c2
-rw-r--r--networking/ntpd.c17
-rw-r--r--procps/pgrep.c8
-rw-r--r--util-linux/eject.c2
-rw-r--r--util-linux/last.c2
10 files changed, 46 insertions, 27 deletions
diff --git a/Config.in b/Config.in
index 9c16e1583..d5a69f416 100644
--- a/Config.in
+++ b/Config.in
@@ -218,6 +218,13 @@ config FEATURE_INSTALLER
218 busybox at runtime to create hard links or symlinks for all the 218 busybox at runtime to create hard links or symlinks for all the
219 applets that are compiled into busybox. 219 applets that are compiled into busybox.
220 220
221config FEATURE_VERSION
222 bool "Support --version"
223 default y
224 depends on BUSYBOX
225 help
226 Enable 'busybox --version' support.
227
221config INSTALL_NO_USR 228config INSTALL_NO_USR
222 bool "Don't use /usr" 229 bool "Don't use /usr"
223 default n 230 default n
diff --git a/coreutils/dd.c b/coreutils/dd.c
index e6b88acf5..f439326fd 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -290,12 +290,6 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
290 return 1; 290 return 1;
291} 291}
292 292
293#if ENABLE_LFS
294# define XATOU_SFX xatoull_sfx
295#else
296# define XATOU_SFX xatoul_sfx
297#endif
298
299#if ENABLE_FEATURE_DD_IBS_OBS 293#if ENABLE_FEATURE_DD_IBS_OBS
300static int parse_comma_flags(char *val, const char *words, const char *error_in) 294static int parse_comma_flags(char *val, const char *words, const char *error_in)
301{ 295{
@@ -488,15 +482,15 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
488 /* These can be large: */ 482 /* These can be large: */
489 if (what == OP_count) { 483 if (what == OP_count) {
490 G.flags |= FLAG_COUNT; 484 G.flags |= FLAG_COUNT;
491 count = XATOU_SFX(val, cwbkMG_suffixes); 485 count = XATOOFF_SFX(val, cwbkMG_suffixes);
492 /*continue;*/ 486 /*continue;*/
493 } 487 }
494 if (what == OP_seek) { 488 if (what == OP_seek) {
495 seek = XATOU_SFX(val, cwbkMG_suffixes); 489 seek = XATOOFF_SFX(val, cwbkMG_suffixes);
496 /*continue;*/ 490 /*continue;*/
497 } 491 }
498 if (what == OP_skip) { 492 if (what == OP_skip) {
499 skip = XATOU_SFX(val, cwbkMG_suffixes); 493 skip = XATOOFF_SFX(val, cwbkMG_suffixes);
500 /*continue;*/ 494 /*continue;*/
501 } 495 }
502 if (what == OP_if) { 496 if (what == OP_if) {
diff --git a/coreutils/ls.c b/coreutils/ls.c
index b2a6d4d90..b8d276e53 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -239,8 +239,7 @@ SPLIT_SUBDIR = 2,
239 IF_FEATURE_LS_WIDTH("T:w:") /* 2, 28 */ \ 239 IF_FEATURE_LS_WIDTH("T:w:") /* 2, 28 */ \
240 IF_LONG_OPTS("\xff") /* 1, 29 */ \ 240 IF_LONG_OPTS("\xff") /* 1, 29 */ \
241 IF_LONG_OPTS("\xfe") /* 1, 30 */ \ 241 IF_LONG_OPTS("\xfe") /* 1, 30 */ \
242IF_PLATFORM_MINGW32(IF_LONG_OPTS("\xfd:")) /* 1, 31 */ \ 242 IF_LONG_OPTS("\xfd::") /* 1, 31 */ \
243IF_NOT_PLATFORM_MINGW32(IF_LONG_OPTS("\xfd")) \
244 "qk" /* 2, 33 */ 243 "qk" /* 2, 33 */
245 244
246#if ENABLE_LONG_OPTS 245#if ENABLE_LONG_OPTS
diff --git a/include/libbb.h b/include/libbb.h
index 03ca9f057..09ebad1f6 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -342,6 +342,7 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
342/* "long" is long enough on this system */ 342/* "long" is long enough on this system */
343typedef unsigned long uoff_t; 343typedef unsigned long uoff_t;
344# define XATOOFF(a) xatoul_range((a), 0, LONG_MAX) 344# define XATOOFF(a) xatoul_range((a), 0, LONG_MAX)
345# define XATOOFF_SFX(a, s) xatoul_range_sfx((a), 0, LONG_MAX, s)
345/* usage: sz = BB_STRTOOFF(s, NULL, 10); if (errno || sz < 0) die(); */ 346/* usage: sz = BB_STRTOOFF(s, NULL, 10); if (errno || sz < 0) die(); */
346# define BB_STRTOOFF bb_strtoul 347# define BB_STRTOOFF bb_strtoul
347# define STRTOOFF strtoul 348# define STRTOOFF strtoul
@@ -351,6 +352,7 @@ typedef unsigned long uoff_t;
351/* "long" is too short, need "long long" */ 352/* "long" is too short, need "long long" */
352typedef unsigned long long uoff_t; 353typedef unsigned long long uoff_t;
353# define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX) 354# define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX)
355# define XATOOFF_SFX(a, s) xatoull_range_sfx((a), 0, LLONG_MAX, s)
354# define BB_STRTOOFF bb_strtoull 356# define BB_STRTOOFF bb_strtoull
355# define STRTOOFF strtoull 357# define STRTOOFF strtoull
356# define OFF_FMT LL_FMT 358# define OFF_FMT LL_FMT
@@ -366,12 +368,14 @@ typedef unsigned long long uoff_t;
366# if UINT_MAX == ULONG_MAX 368# if UINT_MAX == ULONG_MAX
367typedef unsigned long uoff_t; 369typedef unsigned long uoff_t;
368# define XATOOFF(a) xatoi_positive(a) 370# define XATOOFF(a) xatoi_positive(a)
371# define XATOOFF_SFX(a, s) xatoul_range_sfx((a), 0, INT_MAX, s)
369# define BB_STRTOOFF bb_strtou 372# define BB_STRTOOFF bb_strtou
370# define STRTOOFF strtol 373# define STRTOOFF strtol
371# define OFF_FMT "l" 374# define OFF_FMT "l"
372# else 375# else
373typedef unsigned long uoff_t; 376typedef unsigned long uoff_t;
374# define XATOOFF(a) xatoul_range((a), 0, LONG_MAX) 377# define XATOOFF(a) xatoul_range((a), 0, LONG_MAX)
378# define XATOOFF_SFX(a, s) xatoul_range_sfx((a), 0, LONG_MAX, s)
375# define BB_STRTOOFF bb_strtoul 379# define BB_STRTOOFF bb_strtoul
376# define STRTOOFF strtol 380# define STRTOOFF strtol
377# define OFF_FMT "l" 381# define OFF_FMT "l"
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index b1064d10a..496d320cd 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -1122,14 +1122,14 @@ int busybox_main(int argc UNUSED_PARAM, char **argv)
1122#endif 1122#endif
1123 1123
1124 if (strcmp(argv[1], "--help") == 0) { 1124 if (strcmp(argv[1], "--help") == 0) {
1125 /* "busybox --help [<applet>]" */ 1125 /* "busybox --help [APPLET]" */
1126 if (!argv[2] 1126 if (!argv[2]
1127# if ENABLE_FEATURE_SH_STANDALONE && ENABLE_FEATURE_TAB_COMPLETION 1127# if ENABLE_FEATURE_SH_STANDALONE && ENABLE_FEATURE_TAB_COMPLETION
1128 || strcmp(argv[2], "busybox") == 0 /* prevent getting "No help available" */ 1128 || strcmp(argv[2], "busybox") == 0 /* prevent getting "No help available" */
1129# endif 1129# endif
1130 ) 1130 )
1131 goto help; 1131 goto help;
1132 /* convert to "<applet> --help" */ 1132 /* convert to "APPLET --help" */
1133 applet_name = argv[0] = argv[2]; 1133 applet_name = argv[0] = argv[2];
1134 argv[2] = NULL; 1134 argv[2] = NULL;
1135 if (find_applet_by_name_internal(applet_name) >= 0) { 1135 if (find_applet_by_name_internal(applet_name) >= 0) {
@@ -1137,8 +1137,16 @@ int busybox_main(int argc UNUSED_PARAM, char **argv)
1137 xfunc_error_retval = 0; 1137 xfunc_error_retval = 0;
1138 bb_show_usage(); 1138 bb_show_usage();
1139 } /* else: unknown applet, fall through (causes "applet not found" later) */ 1139 } /* else: unknown applet, fall through (causes "applet not found" later) */
1140 } else { 1140 }
1141 /* "busybox <applet> arg1 arg2 ..." */ 1141# if ENABLE_FEATURE_VERSION
1142 else if (!argv[2] && strcmp(argv[1], "--version") == 0) {
1143 full_write1_str(bb_banner); /* reuse const string */
1144 full_write1_str("\n");
1145 return 0;
1146 }
1147# endif
1148 else {
1149 /* "busybox APPLET arg1 arg2 ..." */
1142 argv++; 1150 argv++;
1143 /* We support "busybox /a/path/to/applet args..." too. Allows for 1151 /* We support "busybox /a/path/to/applet args..." too. Allows for
1144 * "#!/bin/busybox"-style wrappers 1152 * "#!/bin/busybox"-style wrappers
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index e0c0a17dc..7dc39ca80 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2273,7 +2273,7 @@ static void parse_and_put_prompt(const char *prmt_ptr)
2273 if (c == 'w') 2273 if (c == 'w')
2274 break; 2274 break;
2275 cp = strrchr(pbuf, '/'); 2275 cp = strrchr(pbuf, '/');
2276 if (cp IF_PLATFORM_MINGW32(&& cp[1])) 2276 if (cp && cp[1])
2277 pbuf = (char*)cp + 1; 2277 pbuf = (char*)cp + 1;
2278 break; 2278 break;
2279// bb_process_escape_sequence does this now: 2279// bb_process_escape_sequence does this now:
diff --git a/networking/ntpd.c b/networking/ntpd.c
index dd0a9c91f..efe9f5326 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -1645,7 +1645,7 @@ update_local_clock(peer_t *p)
1645 /* 65536 is one ppm */ 1645 /* 65536 is one ppm */
1646 tmx.freq = G.discipline_freq_drift * 65536e6; 1646 tmx.freq = G.discipline_freq_drift * 65536e6;
1647#endif 1647#endif
1648 tmx.modes = ADJ_OFFSET | ADJ_STATUS | ADJ_TIMECONST;// | ADJ_MAXERROR | ADJ_ESTERROR; 1648 tmx.modes = ADJ_OFFSET | ADJ_STATUS | ADJ_TIMECONST | ADJ_MAXERROR | ADJ_ESTERROR;
1649 1649
1650 tmx.offset = (long)(offset * 1000000); /* usec */ 1650 tmx.offset = (long)(offset * 1000000); /* usec */
1651 if (SLEW_THRESHOLD < STEP_THRESHOLD) { 1651 if (SLEW_THRESHOLD < STEP_THRESHOLD) {
@@ -1738,16 +1738,23 @@ update_local_clock(peer_t *p)
1738 if (tmx.constant < 0) 1738 if (tmx.constant < 0)
1739 tmx.constant = 0; 1739 tmx.constant = 0;
1740 1740
1741 //tmx.esterror = (uint32_t)(clock_jitter * 1e6); 1741 /* For ADJ_MAXERROR and ADJ_ESTERROR: */
1742 //tmx.maxerror = (uint32_t)((sys_rootdelay / 2 + sys_rootdisp) * 1e6); 1742 /* kernel increments this by 500us each second, sets STA_UNSYNC if exceeds 16 seconds: */
1743 tmx.maxerror = (uint32_t)((G.rootdelay / 2 + G.rootdisp) * 1000000.0);
1744 /* (without ADJ_MAXERROR, time adjustment still works, but kernel uses
1745 * conservative maxerror value and quickly sets STA_UNSYNC)
1746 */
1747 /* esterror is not used by kernel, presumably may be used by other programs reading adjtimex result: */
1748 tmx.esterror = (uint32_t)(G.discipline_jitter * 1000000.0);
1749
1743 rc = adjtimex(&tmx); 1750 rc = adjtimex(&tmx);
1744 if (rc < 0) 1751 if (rc < 0)
1745 bb_simple_perror_msg_and_die("adjtimex"); 1752 bb_simple_perror_msg_and_die("adjtimex");
1746 /* NB: here kernel returns constant == G.poll_exp, not == G.poll_exp - 4. 1753 /* NB: here kernel returns constant == G.poll_exp, not == G.poll_exp - 4.
1747 * Not sure why. Perhaps it is normal. 1754 * Not sure why. Perhaps it is normal.
1748 */ 1755 */
1749 VERB4 bb_error_msg("adjtimex:%d freq:%ld offset:%+ld status:0x%x", 1756 VERB4 bb_error_msg("adjtimex:%d freq:%ld offset:%+ld esterror:%ld maxerror:%ld status:0x%x",
1750 rc, (long)tmx.freq, (long)tmx.offset, tmx.status); 1757 rc, (long)tmx.freq, (long)tmx.offset, (long)tmx.esterror, (long)tmx.maxerror, tmx.status);
1751 G.kernel_freq_drift = tmx.freq / 65536; 1758 G.kernel_freq_drift = tmx.freq / 65536;
1752 VERB2 bb_error_msg("update from:%s offset:%+f delay:%f jitter:%f clock drift:%+.3fppm tc:%d", 1759 VERB2 bb_error_msg("update from:%s offset:%+f delay:%f jitter:%f clock drift:%+.3fppm tc:%d",
1753 p->p_dotted, 1760 p->p_dotted,
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 9773a72c4..adbdd08b7 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -270,16 +270,16 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
270 if (!match) { 270 if (!match) {
271 again: 271 again:
272 match = (regexec(&re_buffer, cmd, 1, re_match, 0) == 0); 272 match = (regexec(&re_buffer, cmd, 1, re_match, 0) == 0);
273 if (match && OPT_ANCHOR) {
274 /* -x requires full string match */
275 match = (re_match[0].rm_so == 0 && cmd[re_match[0].rm_eo] == '\0');
276 }
273 if (!match && cmd != proc->comm) { 277 if (!match && cmd != proc->comm) {
274 /* if argv[] did not match, try comm */ 278 /* if argv[] did not match, try comm */
275 cmdlen = -1; 279 cmdlen = -1;
276 cmd = proc->comm; 280 cmd = proc->comm;
277 goto again; 281 goto again;
278 } 282 }
279 if (match && OPT_ANCHOR) {
280 /* -x requires full string match */
281 match = (re_match[0].rm_so == 0 && cmd[re_match[0].rm_eo] == '\0');
282 }
283 } 283 }
284 284
285 /* NB: OPT_INVERT is always 0 or 1 */ 285 /* NB: OPT_INVERT is always 0 or 1 */
diff --git a/util-linux/eject.c b/util-linux/eject.c
index b9813262b..4fa6dbd94 100644
--- a/util-linux/eject.c
+++ b/util-linux/eject.c
@@ -31,7 +31,7 @@
31//kbuild:lib-$(CONFIG_EJECT) += eject.o 31//kbuild:lib-$(CONFIG_EJECT) += eject.o
32 32
33//usage:#define eject_trivial_usage 33//usage:#define eject_trivial_usage
34//usage: "[-t] [-T] [DEVICE]" 34//usage: IF_FEATURE_EJECT_SCSI("[-s] ") "[-t] [-T] [DEVICE]"
35//usage:#define eject_full_usage "\n\n" 35//usage:#define eject_full_usage "\n\n"
36//usage: "Eject DEVICE or default /dev/cdrom\n" 36//usage: "Eject DEVICE or default /dev/cdrom\n"
37//usage: IF_FEATURE_EJECT_SCSI( 37//usage: IF_FEATURE_EJECT_SCSI(
diff --git a/util-linux/last.c b/util-linux/last.c
index 7530d013d..aafd01bb9 100644
--- a/util-linux/last.c
+++ b/util-linux/last.c
@@ -157,7 +157,7 @@ int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
157 ut.ut_user, ut.ut_line, ut.ut_host, ctime(&t_tmp) + 4); 157 ut.ut_user, ut.ut_line, ut.ut_host, ctime(&t_tmp) + 4);
158 next: 158 next:
159 pos -= sizeof(ut); 159 pos -= sizeof(ut);
160 if (pos <= 0) 160 if (pos < 0)
161 break; /* done. */ 161 break; /* done. */
162 xlseek(file, pos, SEEK_SET); 162 xlseek(file, pos, SEEK_SET);
163 } 163 }