diff options
author | Ron Yorston <rmy@pobox.com> | 2022-10-12 10:43:26 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-10-12 10:43:26 +0100 |
commit | 49c6f079acb4edae84b4496bd941cdbb5048ba01 (patch) | |
tree | ac54ecaad45050f7bfe274a11db29882aa32a9a8 /coreutils | |
parent | a55cf07365ec2ff51749a77e09ae9edac79a99fe (diff) | |
parent | c8c1fcdba163f264a503380bc63485aacd09214c (diff) | |
download | busybox-w32-49c6f079acb4edae84b4496bd941cdbb5048ba01.tar.gz busybox-w32-49c6f079acb4edae84b4496bd941cdbb5048ba01.tar.bz2 busybox-w32-49c6f079acb4edae84b4496bd941cdbb5048ba01.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cut.c | 2 | ||||
-rw-r--r-- | coreutils/md5_sha1_sum.c | 13 | ||||
-rw-r--r-- | coreutils/sleep.c | 1 | ||||
-rw-r--r-- | coreutils/sort.c | 13 | ||||
-rw-r--r-- | coreutils/test.c | 2 |
5 files changed, 18 insertions, 13 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c index 7009e74cf..55bdd9386 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -167,7 +167,7 @@ static void cut_file(FILE *file, const char *delim, const char *odelim, | |||
167 | if (!cl_pos && !dcount && !shoe) { | 167 | if (!cl_pos && !dcount && !shoe) { |
168 | if (option_mask32 & CUT_OPT_SUPPRESS_FLGS) | 168 | if (option_mask32 & CUT_OPT_SUPPRESS_FLGS) |
169 | goto next_line; | 169 | goto next_line; |
170 | } else if (dcount<cut_lists[cl_pos].startpos) | 170 | } else if (dcount < cut_lists[cl_pos].startpos) |
171 | start = linelen; | 171 | start = linelen; |
172 | end = linelen; | 172 | end = linelen; |
173 | } else { | 173 | } else { |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 0e57673f1..b4bdc262c 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -301,9 +301,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv) | |||
301 | 301 | ||
302 | count_total++; | 302 | count_total++; |
303 | filename_ptr = strchr(line, ' '); | 303 | filename_ptr = strchr(line, ' '); |
304 | if (filename_ptr == NULL | 304 | if (!filename_ptr) { |
305 | || (filename_ptr[1] != ' ' && filename_ptr[1] != '*') | ||
306 | ) { | ||
307 | if (flags & FLAG_WARN) { | 305 | if (flags & FLAG_WARN) { |
308 | bb_simple_error_msg("invalid format"); | 306 | bb_simple_error_msg("invalid format"); |
309 | } | 307 | } |
@@ -312,8 +310,13 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv) | |||
312 | free(line); | 310 | free(line); |
313 | continue; | 311 | continue; |
314 | } | 312 | } |
315 | *filename_ptr = '\0'; | 313 | *filename_ptr++ = '\0'; |
316 | filename_ptr += 2; | 314 | /* coreutils 9.1 allows "HASH FILENAME" format, |
315 | * with only one space. Skip the 'correct' | ||
316 | * " " or " *" delimiter if it is there: | ||
317 | */ | ||
318 | if (*filename_ptr == ' ' || *filename_ptr == '*') | ||
319 | filename_ptr++; | ||
317 | 320 | ||
318 | hash_value = hash_file(in_buf, filename_ptr, sha3_width); | 321 | hash_value = hash_file(in_buf, filename_ptr, sha3_width); |
319 | 322 | ||
diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 2658e84df..442841210 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c | |||
@@ -37,6 +37,7 @@ | |||
37 | //applet:IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP)) | 37 | //applet:IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP)) |
38 | 38 | ||
39 | //kbuild:lib-$(CONFIG_SLEEP) += sleep.o | 39 | //kbuild:lib-$(CONFIG_SLEEP) += sleep.o |
40 | //kbuild:lib-$(CONFIG_ASH_SLEEP) += sleep.o | ||
40 | 41 | ||
41 | /* BB_AUDIT SUSv3 compliant */ | 42 | /* BB_AUDIT SUSv3 compliant */ |
42 | /* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */ | 43 | /* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */ |
diff --git a/coreutils/sort.c b/coreutils/sort.c index 9aac656fe..01b7c44e5 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -357,9 +357,9 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
357 | int dx; | 357 | int dx; |
358 | char *xx, *yy; | 358 | char *xx, *yy; |
359 | 359 | ||
360 | xx = strptime(x, "%b", &thyme); | 360 | xx = strptime(skip_whitespace(x), "%b", &thyme); |
361 | dx = thyme.tm_mon; | 361 | dx = thyme.tm_mon; |
362 | yy = strptime(y, "%b", &thyme); | 362 | yy = strptime(skip_whitespace(y), "%b", &thyme); |
363 | if (!xx) | 363 | if (!xx) |
364 | retval = (!yy) ? 0 : -1; | 364 | retval = (!yy) ? 0 : -1; |
365 | else if (!yy) | 365 | else if (!yy) |
@@ -652,11 +652,12 @@ int sort_main(int argc UNUSED_PARAM, char **argv) | |||
652 | /* Handle -u */ | 652 | /* Handle -u */ |
653 | if (option_mask32 & FLAG_u) { | 653 | if (option_mask32 & FLAG_u) { |
654 | int j = 0; | 654 | int j = 0; |
655 | /* coreutils 6.3 drop lines for which only key is the same | 655 | /* coreutils 6.3 drop lines for which only key is the same: |
656 | * -- disabling last-resort compare, or else compare_keys() | 656 | * - disabling last-resort compare, or else compare_keys() |
657 | * will be the same only for completely identical lines. | 657 | * will be the same only for completely identical lines |
658 | * - disabling -s (same reasons) | ||
658 | */ | 659 | */ |
659 | option_mask32 |= FLAG_no_tie_break; | 660 | option_mask32 = (option_mask32 | FLAG_no_tie_break) & (~FLAG_s); |
660 | for (i = 1; i < linecount; i++) { | 661 | for (i = 1; i < linecount; i++) { |
661 | if (compare_keys(&lines[j], &lines[i]) == 0) | 662 | if (compare_keys(&lines[j], &lines[i]) == 0) |
662 | free(lines[i]); | 663 | free(lines[i]); |
diff --git a/coreutils/test.c b/coreutils/test.c index 840a0daaf..1d1e6d18b 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -859,7 +859,7 @@ static number_t primary(enum token n) | |||
859 | if (check_operator(args[1]) != EOI) { /* if args[1] != NULL */ | 859 | if (check_operator(args[1]) != EOI) { /* if args[1] != NULL */ |
860 | if (args[2]) { | 860 | if (args[2]) { |
861 | // coreutils also does this: | 861 | // coreutils also does this: |
862 | // if (args[3] && args[0]="-l" && args[2] is BINOP) | 862 | // if (args[3] && args[0] = "-l" && args[2] is BINOP) |
863 | // return binop(1 /* prepended by -l */); | 863 | // return binop(1 /* prepended by -l */); |
864 | if (last_operator->op_type == BINOP) | 864 | if (last_operator->op_type == BINOP) |
865 | unnest_msg_and_return(binop(), "<primary: binop:%lld\n"); | 865 | unnest_msg_and_return(binop(), "<primary: binop:%lld\n"); |