From d3849ced08d9cfcfa2c4d0eed72bcb305222ebd8 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Thu, 14 Jul 2016 16:29:59 +0200 Subject: [PATCH] fix patches such that they apply without offset --- coreutils-4.5.3-langinfo.patch | 2 +- coreutils-6.10-configuration.patch | 22 +-- coreutils-6.10-manpages.patch | 2 +- coreutils-8.2-uname-processortype.patch | 7 +- coreutils-8.4-mkdir-modenote.patch | 2 +- coreutils-df-direct.patch | 14 +- coreutils-getgrouplist.patch | 8 +- coreutils-i18n-cut-old.patch | 2 +- coreutils-i18n-cut.patch | 42 +++--- coreutils-i18n-expand-unexpand.patch | 102 ++++++++------ coreutils-i18n.patch | 176 ++++++++++++------------ coreutils-overflow.patch | 2 +- coreutils-selinux.patch | 16 +-- coreutils-selinuxmanpages.patch | 2 +- sh-utils-2.0.11-dateman.patch | 2 +- 15 files changed, 207 insertions(+), 194 deletions(-) diff --git a/coreutils-4.5.3-langinfo.patch b/coreutils-4.5.3-langinfo.patch index 25dec6c..48e0624 100644 --- a/coreutils-4.5.3-langinfo.patch +++ b/coreutils-4.5.3-langinfo.patch @@ -1,6 +1,6 @@ --- coreutils-5.92/src/date.c.langinfo 2005-09-16 09:06:57.000000000 +0100 +++ coreutils-5.92/src/date.c 2005-10-24 18:09:16.000000000 +0100 -@@ -451,14 +451,7 @@ +@@ -474,14 +474,7 @@ main (int argc, char **argv) format = DATE_FMT_LANGINFO (); if (! *format) { diff --git a/coreutils-6.10-configuration.patch b/coreutils-6.10-configuration.patch index 4c68077..7468ba2 100644 --- a/coreutils-6.10-configuration.patch +++ b/coreutils-6.10-configuration.patch @@ -1,7 +1,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-tests/gnulib.mk --- coreutils-8.21-orig/gnulib-tests/gnulib.mk 2013-02-07 17:58:44.000000000 +0100 +++ coreutils-8.21/gnulib-tests/gnulib.mk 2013-02-15 10:12:28.110593165 +0100 -@@ -267,9 +267,9 @@ EXTRA_DIST += nap.h test-chown.h test-ch +@@ -279,9 +279,9 @@ EXTRA_DIST += nap.h test-chown.h test-chown.c signature.h macros.h ## begin gnulib module cloexec-tests @@ -14,7 +14,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module cloexec-tests -@@ -378,9 +378,9 @@ EXTRA_DIST += test-dup.c signature.h mac +@@ -392,9 +392,9 @@ EXTRA_DIST += test-dup.c signature.h macros.h ## begin gnulib module dup2-tests @@ -27,7 +27,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module dup2-tests -@@ -439,10 +439,10 @@ EXTRA_DIST += test-fadvise.c +@@ -453,10 +453,10 @@ EXTRA_DIST += test-fadvise.c ## begin gnulib module fchdir-tests @@ -42,7 +42,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module fchdir-tests -@@ -874,9 +874,9 @@ EXTRA_DIST += test-getloadavg.c signatur +@@ -900,9 +900,9 @@ EXTRA_DIST += test-getloadavg.c signature.h ## begin gnulib module getlogin-tests @@ -55,7 +55,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module getlogin-tests -@@ -1119,10 +1119,10 @@ EXTRA_DIST += test-link.h test-link.c si +@@ -1147,10 +1147,10 @@ EXTRA_DIST += test-link.h test-link.c signature.h macros.h ## begin gnulib module linkat-tests @@ -70,7 +70,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module linkat-tests -@@ -1331,9 +1331,9 @@ EXTRA_DIST += test-memcoll.c macros.h +@@ -1359,9 +1359,9 @@ EXTRA_DIST += test-memcoll.c macros.h ## begin gnulib module memrchr-tests @@ -83,7 +83,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module memrchr-tests -@@ -1978,9 +1978,9 @@ EXTRA_DIST += test-statat.c +@@ -1912,9 +1912,9 @@ EXTRA_DIST += test-statat.c ## begin gnulib module stdalign-tests @@ -96,7 +96,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module stdalign-tests -@@ -2323,9 +2323,9 @@ EXTRA_DIST += test-uname.c signature.h m +@@ -2269,9 +2269,9 @@ EXTRA_DIST += test-uname.c signature.h macros.h ## begin gnulib module unistd-safer-tests @@ -109,7 +109,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test ## end gnulib module unistd-safer-tests -@@ -2438,10 +2438,10 @@ EXTRA_DIST += test-usleep.c signature.h +@@ -2367,10 +2367,10 @@ EXTRA_DIST += test-userspec.c ## begin gnulib module utimens-tests @@ -127,7 +127,7 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk --- coreutils-8.21-orig/tests/local.mk 2013-02-11 11:30:12.000000000 +0100 +++ coreutils-8.21/tests/local.mk 2013-02-15 10:10:55.890532258 +0100 -@@ -131,6 +131,7 @@ all_root_tests = \ +@@ -134,6 +134,7 @@ all_root_tests = \ tests/rm/no-give-up.sh \ tests/rm/one-file-system.sh \ tests/rm/read-only.sh \ @@ -135,7 +135,7 @@ diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk tests/tail-2/append-only.sh \ tests/touch/now-owned-by-other.sh -@@ -163,7 +164,6 @@ all_tests = \ +@@ -168,7 +169,6 @@ all_tests = \ tests/cp/link-heap.sh \ tests/cp/no-ctx.sh \ tests/misc/tty-eof.pl \ diff --git a/coreutils-6.10-manpages.patch b/coreutils-6.10-manpages.patch index 8d5bc94..c795ca5 100644 --- a/coreutils-6.10-manpages.patch +++ b/coreutils-6.10-manpages.patch @@ -1,7 +1,7 @@ diff -urNp coreutils-6.12-orig/src/md5sum.c coreutils-6.12/src/md5sum.c --- coreutils-6.12-orig/src/md5sum.c 2008-05-26 08:40:33.000000000 +0200 +++ coreutils-6.12/src/md5sum.c 2008-10-21 16:07:28.000000000 +0200 -@@ -175,6 +175,9 @@ With no FILE, or when FILE is -, read st +@@ -200,6 +200,9 @@ Print or check %s (%d-bit) checksums.\n\ fputs (_("\ -t, --text read in text mode (default)\n\ "), stdout); diff --git a/coreutils-8.2-uname-processortype.patch b/coreutils-8.2-uname-processortype.patch index 4c83df8..0cb2422 100644 --- a/coreutils-8.2-uname-processortype.patch +++ b/coreutils-8.2-uname-processortype.patch @@ -1,7 +1,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c --- coreutils-8.2-orig/src/uname.c 2009-09-23 10:25:44.000000000 +0200 +++ coreutils-8.2/src/uname.c 2009-12-19 09:09:11.663607110 +0100 -@@ -301,7 +301,7 @@ main (int argc, char **argv) +@@ -299,13 +299,19 @@ main (int argc, char **argv) if (toprint & PRINT_PROCESSOR) { @@ -10,7 +10,6 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c #if HAVE_SYSINFO && defined SI_ARCHITECTURE { static char processor[257]; -@@ -308,6 +308,12 @@ main (int argc, char **argv) if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) element = processor; } @@ -23,7 +22,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c #endif #ifdef UNAME_PROCESSOR if (element == unknown) -@@ -351,7 +357,7 @@ main (int argc, char **argv) +@@ -343,7 +349,7 @@ main (int argc, char **argv) if (toprint & PRINT_HARDWARE_PLATFORM) { @@ -32,7 +31,7 @@ diff -urNp coreutils-8.2-orig/src/uname.c coreutils-8.2/src/uname.c #if HAVE_SYSINFO && defined SI_PLATFORM { static char hardware_platform[257]; -@@ -353,6 +359,14 @@ main (int argc, char **argv) +@@ -351,6 +357,14 @@ main (int argc, char **argv) hardware_platform, sizeof hardware_platform)) element = hardware_platform; } diff --git a/coreutils-8.4-mkdir-modenote.patch b/coreutils-8.4-mkdir-modenote.patch index 3576ec6..1f03c8d 100644 --- a/coreutils-8.4-mkdir-modenote.patch +++ b/coreutils-8.4-mkdir-modenote.patch @@ -1,7 +1,7 @@ diff -urNp coreutils-8.4-orig/doc/coreutils.texi coreutils-8.4/doc/coreutils.texi --- coreutils-8.4-orig/doc/coreutils.texi 2011-01-07 15:01:18.575654333 +0100 +++ coreutils-8.4/doc/coreutils.texi 2011-01-07 15:05:38.791655243 +0100 -@@ -9058,6 +9058,8 @@ incorrect. @xref{Directory Setuid and S +@@ -9993,6 +9993,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the set-user-ID and set-group-ID bits of directories are inherited unless overridden in this way. diff --git a/coreutils-df-direct.patch b/coreutils-df-direct.patch index 361b813..e69cd2b 100644 --- a/coreutils-df-direct.patch +++ b/coreutils-df-direct.patch @@ -1,7 +1,7 @@ diff -urNp coreutils-8.21-orig/doc/coreutils.texi coreutils-8.21/doc/coreutils.texi --- coreutils-8.21-orig/doc/coreutils.texi 2013-02-11 10:37:28.000000000 +0100 +++ coreutils-8.21/doc/coreutils.texi 2013-02-15 10:15:26.497593689 +0100 -@@ -10961,6 +10961,13 @@ +@@ -11221,6 +11221,13 @@ some systems (notably SunOS), doing this yields more up to date results, but in general this option makes @command{df} much slower, especially when there are many or very busy file systems. @@ -28,7 +28,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c /* Grand total data. */ static struct fs_usage grand_fsu; -@@ -238,13 +241,15 @@ enum +@@ -243,13 +246,15 @@ enum NO_SYNC_OPTION = CHAR_MAX + 1, SYNC_OPTION, TOTAL_OPTION, @@ -45,7 +45,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c {"inodes", no_argument, NULL, 'i'}, {"human-readable", no_argument, NULL, 'h'}, {"si", no_argument, NULL, 'H'}, -@@ -500,7 +505,10 @@ get_header (void) +@@ -505,7 +510,10 @@ get_header (void) for (col = 0; col < ncolumns; col++) { char *cell = NULL; @@ -57,7 +57,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c if (columns[col]->field == SIZE_FIELD && (header_mode == DEFAULT_MODE -@@ -1150,6 +1158,19 @@ get_point (const char *point, const stru +@@ -1352,6 +1360,19 @@ get_point (const char *point, const struct stat *statp) static void get_entry (char const *name, struct stat const *statp) { @@ -77,7 +77,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode)) && get_disk (name)) return; -@@ -1219,6 +1238,7 @@ or all file systems by default.\n\ +@@ -1422,6 +1443,7 @@ or all file systems by default.\n\ -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ '-BM' prints sizes in units of 1,048,576 bytes;\n\ see SIZE format below\n\ @@ -85,7 +85,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c -h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\ -H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\ "), stdout); -@@ -1305,6 +1325,9 @@ main (int argc, char **argv) +@@ -1512,6 +1534,9 @@ main (int argc, char **argv) xstrtol_fatal (e, oi, c, long_options, optarg); } break; @@ -95,7 +95,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c case 'i': if (header_mode == OUTPUT_MODE) { -@@ -1408,6 +1431,13 @@ main (int argc, char **argv) +@@ -1608,6 +1633,13 @@ main (int argc, char **argv) } } diff --git a/coreutils-getgrouplist.patch b/coreutils-getgrouplist.patch index 86bbcef..7defd19 100644 --- a/coreutils-getgrouplist.patch +++ b/coreutils-getgrouplist.patch @@ -12,7 +12,7 @@ index 299bae6..8ece29b 100644 #include "getugroups.h" #include -@@ -123,3 +126,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username, +@@ -126,3 +129,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username, } #endif /* HAVE_GRP_H */ @@ -21,7 +21,7 @@ diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c index 76474c2..0a9d221 100644 --- a/lib/mgetgroups.c +++ b/lib/mgetgroups.c -@@ -115,9 +115,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups) +@@ -121,9 +121,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups) /* else no username, so fall through and use getgroups. */ #endif @@ -42,7 +42,7 @@ index 76474c2..0a9d221 100644 /* If we failed to count groups because there is no supplemental group support, then return an array containing just GID. -@@ -139,10 +147,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups) +@@ -145,10 +153,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups) if (g == NULL) return -1; @@ -76,7 +76,7 @@ diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4 index 62777c7..5180243 100644 --- a/m4/jm-macros.m4 +++ b/m4/jm-macros.m4 -@@ -78,6 +78,7 @@ +@@ -82,6 +82,7 @@ AC_DEFUN([coreutils_MACROS], fchown fchmod ftruncate diff --git a/coreutils-i18n-cut-old.patch b/coreutils-i18n-cut-old.patch index 29c69fc..008cecb 100644 --- a/coreutils-i18n-cut-old.patch +++ b/coreutils-i18n-cut-old.patch @@ -132,7 +132,7 @@ diff -urNp coreutils-8.25-orig/src/cut.c coreutils-8.25/src/cut.c /* The delimiter for each line/record. */ static unsigned char line_delim = '\n'; -@@ -164,7 +243,7 @@ Print selected parts of lines from each +@@ -164,7 +243,7 @@ Print selected parts of lines from each FILE to standard output.\n\ -f, --fields=LIST select only these fields; also print any line\n\ that contains no delimiter character, unless\n\ the -s option is specified\n\ diff --git a/coreutils-i18n-cut.patch b/coreutils-i18n-cut.patch index ec85cf0..f680df6 100644 --- a/coreutils-i18n-cut.patch +++ b/coreutils-i18n-cut.patch @@ -12,7 +12,7 @@ #include "system.h" #include "error.h" -@@ -90,25 +95,16 @@ add_range_pair (size_t lo, size_t hi) +@@ -61,25 +66,16 @@ CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */ static struct field_range_pair *current_rp; @@ -42,7 +42,7 @@ /* Output the given delimiter-separated fields. */ field_mode }; -@@ -120,12 +116,16 @@ static enum operating_mode operating_mod +@@ -91,12 +87,16 @@ static enum operating_mode operating_mode; with field mode. */ static bool suppress_non_delimited; @@ -60,7 +60,7 @@ /* The delimiter for each line/record. */ static unsigned char line_delim = '\n'; -@@ -135,7 +135,7 @@ static size_t output_delimiter_length; +@@ -109,7 +109,7 @@ static size_t output_delimiter_length; /* The output field separator string. Defaults to the 1-character string consisting of the input delimiter. */ @@ -69,7 +69,7 @@ /* True if we have ever read standard input. */ static bool have_read_stdin; -@@ -189,7 +189,7 @@ Print selected parts of lines from each +@@ -164,7 +164,7 @@ Print selected parts of lines from each FILE to standard output.\n\ -f, --fields=LIST select only these fields; also print any line\n\ that contains no delimiter character, unless\n\ the -s option is specified\n\ @@ -78,7 +78,7 @@ "), stdout); fputs (_("\ --complement complement the set of selected bytes, characters\n\ -@@ -435,6 +435,12 @@ next_item (size_t *item_idx) +@@ -211,6 +211,12 @@ next_item (size_t *item_idx) current_rp++; } @@ -91,7 +91,7 @@ /* Return nonzero if the K'th field or byte is printable. */ static inline bool -@@ -443,6 +449,15 @@ print_kth (size_t k) +@@ -219,6 +225,15 @@ print_kth (size_t k) return current_rp->lo <= k; } @@ -107,7 +107,7 @@ /* Return nonzero if K'th byte is the beginning of a range. */ static inline bool -@@ -505,23 +520,215 @@ cut_bytes (FILE *stream) +@@ -281,23 +296,215 @@ cut_bytes (FILE *stream) } /* Read from stream STREAM, printing to standard output any selected fields. */ @@ -328,7 +328,7 @@ /* To support the semantics of the -s flag, we may have to buffer all of the first field to determine whether it is 'delimited.' -@@ -536,10 +744,14 @@ cut_fields (FILE *stream) +@@ -312,10 +519,14 @@ cut_fields (FILE *stream) if (field_idx == 1 && buffer_first_field) { ssize_t len; @@ -346,7 +346,7 @@ if (len < 0) { free (field_1_buffer); -@@ -549,15 +761,15 @@ cut_fields (FILE *stream) +@@ -325,15 +536,15 @@ cut_fields (FILE *stream) xalloc_die (); } @@ -366,7 +366,7 @@ { if (suppress_non_delimited) { -@@ -565,26 +777,30 @@ cut_fields (FILE *stream) +@@ -341,26 +552,30 @@ cut_fields (FILE *stream) } else { @@ -405,7 +405,7 @@ found_any_selected_field = true; } } -@@ -594,7 +810,8 @@ cut_fields (FILE *stream) +@@ -370,7 +585,8 @@ cut_fields (FILE *stream) next_item (&field_idx); } @@ -415,7 +415,7 @@ if (print_kth (field_idx)) { -@@ -605,42 +822,46 @@ cut_fields (FILE *stream) +@@ -381,42 +597,46 @@ cut_fields (FILE *stream) } found_any_selected_field = true; @@ -477,7 +477,7 @@ break; field_idx = 1; current_rp = frp; -@@ -652,7 +874,14 @@ static void +@@ -429,7 +649,14 @@ static void cut_stream (FILE *stream) { if (operating_mode == byte_mode) @@ -493,7 +493,7 @@ else cut_fields (stream); } -@@ -706,6 +935,7 @@ main (int argc, char **argv) +@@ -483,6 +710,7 @@ main (int argc, char **argv) bool ok; bool delim_specified = false; char *spec_list_string IF_LINT ( = NULL); @@ -501,7 +501,7 @@ initialize_main (&argc, &argv); set_program_name (argv[0]); -@@ -719,8 +949,10 @@ main (int argc, char **argv) +@@ -496,8 +724,10 @@ main (int argc, char **argv) /* By default, all non-delimited lines are printed. */ suppress_non_delimited = false; @@ -513,7 +513,7 @@ have_read_stdin = false; while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1) -@@ -728,7 +960,6 @@ main (int argc, char **argv) +@@ -505,7 +735,6 @@ main (int argc, char **argv) switch (optc) { case 'b': @@ -521,7 +521,7 @@ /* Build the byte list. */ if (operating_mode != undefined_mode) FATAL_ERROR (_("only one type of list may be specified")); -@@ -736,6 +967,14 @@ main (int argc, char **argv) +@@ -513,6 +742,14 @@ main (int argc, char **argv) spec_list_string = optarg; break; @@ -536,7 +536,7 @@ case 'f': /* Build the field list. */ if (operating_mode != undefined_mode) -@@ -747,9 +986,17 @@ main (int argc, char **argv) +@@ -524,9 +761,17 @@ main (int argc, char **argv) case 'd': /* New delimiter. */ /* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */ @@ -551,12 +551,12 @@ + mbi_advance (iter); + if (mbi_avail (iter)) FATAL_ERROR (_("the delimiter must be a single character")); -+ } - delim = optarg[0]; ++ } delim_specified = true; break; -@@ -763,6 +1008,7 @@ main (int argc, char **argv) +@@ -540,6 +785,7 @@ main (int argc, char **argv) break; case 'n': @@ -564,7 +564,7 @@ break; case 's': -@@ -802,15 +1048,12 @@ main (int argc, char **argv) +@@ -579,15 +825,12 @@ main (int argc, char **argv) | (complement ? SETFLD_COMPLEMENT : 0) ); if (!delim_specified) diff --git a/coreutils-i18n-expand-unexpand.patch b/coreutils-i18n-expand-unexpand.patch index d8a5968..d23e0f0 100644 --- a/coreutils-i18n-expand-unexpand.patch +++ b/coreutils-i18n-expand-unexpand.patch @@ -23,19 +23,24 @@ properly. Co-authored-by: Pádraig Brady --- - NEWS | 3 + bootstrap.conf | 1 + configure.ac | 2 + + lib/mbfile.c | 3 + + lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++ + m4/mbfile.m4 | 14 +++ po/POTFILES.in | 1 + - src/expand-core.c | 150 +++++++++++++++++++++++++++++++++++++++ - src/expand-core.h | 44 ++++++++++++ - src/expand.c | 183 ++++++++++------------------------------------- + src/expand-core.c | 150 ++++++++++++++++++++++++++++++ + src/expand-core.h | 41 +++++++++ + src/expand.c | 186 ++++++++----------------------------- src/local.mk | 2 + - src/unexpand.c | 197 ++++++++++++--------------------------------------- - tests/expand/mb.sh | 98 +++++++++++++++++++++++++ + src/unexpand.c | 195 ++++++++++----------------------------- + tests/expand/mb.sh | 98 ++++++++++++++++++++ tests/local.mk | 2 + - tests/unexpand/mb.sh | 97 +++++++++++++++++++++++++ - 12 files changed, 482 insertions(+), 298 deletions(-) + tests/unexpand/mb.sh | 97 ++++++++++++++++++++ + 14 files changed, 750 insertions(+), 297 deletions(-) + create mode 100644 lib/mbfile.c + create mode 100644 lib/mbfile.h + create mode 100644 m4/mbfile.m4 create mode 100644 src/expand-core.c create mode 100644 src/expand-core.h create mode 100755 tests/expand/mb.sh @@ -45,7 +50,7 @@ diff --git a/bootstrap.conf b/bootstrap.conf index ef1c078..ea8cebc 100644 --- a/bootstrap.conf +++ b/bootstrap.conf -@@ -152,6 +152,7 @@ gnulib_modules=" +@@ -151,6 +151,7 @@ gnulib_modules=" maintainer-makefile malloc-gnu manywarnings @@ -57,7 +62,7 @@ diff --git a/configure.ac b/configure.ac index 8dc2192..b8b5114 100644 --- a/configure.ac +++ b/configure.ac -@@ -422,6 +422,8 @@ gl_WINSIZE_IN_PTEM +@@ -425,6 +425,8 @@ fi # I'm leaving it here for now. This whole thing needs to be modernized... gl_WINSIZE_IN_PTEM @@ -338,12 +343,10 @@ index 0a40a1a..ed97fd4 100644 static char const shortopts[] = "it:0::1::2::3::4::5::6::7::8::9::"; -@@ -125,128 +129,6 @@ - if (first_free_tab == n_tabs_allocated) - tab_list = X2NREALLOC (tab_list, &n_tabs_allocated); +@@ -135,128 +139,6 @@ add_tab_stop (uintmax_t tabval) tab_list[first_free_tab++] = tabval; --} -- + } + -/* Add the comma or blank separated list of tab stops STOPS - to the list of tab stops. */ - @@ -464,10 +467,12 @@ index 0a40a1a..ed97fd4 100644 - exit_status = EXIT_FAILURE; - } - return NULL; - } - +-} +- /* Change tabs to spaces, writing to stdout. -@@ -265,19 +146,19 @@ expand (void) + Read each file in 'file_list', in order. */ + +@@ -265,19 +147,19 @@ expand (void) { /* Input stream. */ FILE *fp = next_file (NULL); @@ -491,7 +496,7 @@ index 0a40a1a..ed97fd4 100644 /* The following variables have valid values only when CONVERT is true: */ -@@ -287,17 +168,23 @@ expand (void) +@@ -287,17 +169,23 @@ expand (void) /* Index in TAB_LIST of next tab stop to examine. */ size_t tab_index = 0; @@ -519,7 +524,7 @@ index 0a40a1a..ed97fd4 100644 { /* Column the next input tab stop is on. */ uintmax_t next_tab_column; -@@ -328,32 +215,34 @@ expand (void) +@@ -328,32 +216,34 @@ expand (void) if (putchar (' ') < 0) error (EXIT_FAILURE, errno, _("write error")); @@ -562,7 +567,7 @@ index 0a40a1a..ed97fd4 100644 } } -@@ -385,19 +274,19 @@ main (int argc, char **argv) +@@ -385,19 +275,19 @@ main (int argc, char **argv) break; case 't': @@ -589,7 +594,7 @@ diff --git a/src/local.mk b/src/local.mk index 536b7cc..bfede88 100644 --- a/src/local.mk +++ b/src/local.mk -@@ -362,6 +362,8 @@ src_coreutils_SOURCES = src/coreutils.c +@@ -361,6 +361,8 @@ src_coreutils_SOURCES = src/coreutils.c src_cp_SOURCES = src/cp.c $(copy_sources) $(selinux_sources) src_dir_SOURCES = src/ls.c src/ls-dir.c @@ -655,7 +660,7 @@ index e0f7c22..48fbb32 100644 /* For long options that have no equivalent short option, use a non-character as a pseudo short option, starting with CHAR_MAX + 1. */ -@@ -154,128 +156,6 @@ add_tab_stop (uintmax_t tabval) +@@ -154,128 +158,6 @@ add_tab_stop (uintmax_t tabval) } } @@ -784,7 +789,7 @@ index e0f7c22..48fbb32 100644 /* Change blanks to tabs, writing to stdout. Read each file in 'file_list', in order. */ -@@ -284,11 +164,12 @@ unexpand (void) +@@ -284,11 +166,12 @@ unexpand (void) { /* Input stream. */ FILE *fp = next_file (NULL); @@ -798,7 +803,7 @@ index e0f7c22..48fbb32 100644 if (!fp) return; -@@ -296,12 +177,14 @@ unexpand (void) +@@ -296,12 +179,14 @@ unexpand (void) /* The worst case is a non-blank character, then one blank, then a tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so allocate MAX_COLUMN_WIDTH bytes to store the blanks. */ @@ -815,7 +820,7 @@ index e0f7c22..48fbb32 100644 /* If true, perform translations. */ bool convert = true; -@@ -335,12 +218,19 @@ unexpand (void) +@@ -335,12 +220,19 @@ unexpand (void) do { @@ -838,7 +843,7 @@ index e0f7c22..48fbb32 100644 if (blank) { -@@ -372,16 +262,16 @@ unexpand (void) +@@ -372,16 +264,16 @@ unexpand (void) if (next_tab_column < column) error (EXIT_FAILURE, 0, _("input line is too long")); @@ -858,7 +863,7 @@ index e0f7c22..48fbb32 100644 if (! (prev_blank && column == next_tab_column)) { -@@ -389,13 +279,14 @@ unexpand (void) +@@ -389,13 +281,14 @@ unexpand (void) will be replaced by tabs. */ if (column == next_tab_column) one_blank_before_tab_stop = true; @@ -875,7 +880,7 @@ index e0f7c22..48fbb32 100644 } /* Discard pending blanks, unless it was a single -@@ -403,7 +294,7 @@ unexpand (void) +@@ -403,7 +296,7 @@ unexpand (void) pending = one_blank_before_tab_stop; } } @@ -884,7 +889,7 @@ index e0f7c22..48fbb32 100644 { /* Go back one column, and force recalculation of the next tab stop. */ -@@ -413,7 +304,7 @@ unexpand (void) +@@ -413,7 +306,7 @@ unexpand (void) } else { @@ -893,7 +898,7 @@ index e0f7c22..48fbb32 100644 if (!column) error (EXIT_FAILURE, 0, _("input line is too long")); } -@@ -421,9 +312,13 @@ unexpand (void) +@@ -421,9 +314,13 @@ unexpand (void) if (pending) { if (pending > 1 && one_blank_before_tab_stop) @@ -909,7 +914,7 @@ index e0f7c22..48fbb32 100644 pending = 0; one_blank_before_tab_stop = false; } -@@ -432,16 +327,16 @@ unexpand (void) +@@ -432,16 +329,16 @@ unexpand (void) convert &= convert_entire_line || blank; } @@ -930,7 +935,7 @@ index e0f7c22..48fbb32 100644 } } -@@ -482,7 +377,7 @@ main (int argc, char **argv) +@@ -482,7 +379,7 @@ main (int argc, char **argv) break; case 't': convert_entire_line = true; @@ -1047,7 +1052,7 @@ diff --git a/tests/local.mk b/tests/local.mk index 7df04da..d3462be 100644 --- a/tests/local.mk +++ b/tests/local.mk -@@ -532,6 +532,7 @@ all_tests = \ +@@ -536,6 +536,7 @@ all_tests = \ tests/du/threshold.sh \ tests/du/trailing-slash.sh \ tests/du/two-args.sh \ @@ -1055,7 +1060,7 @@ index 7df04da..d3462be 100644 tests/id/gnu-zero-uids.sh \ tests/id/no-context.sh \ tests/id/context.sh \ -@@ -671,6 +672,7 @@ all_tests = \ +@@ -674,6 +675,7 @@ all_tests = \ tests/touch/read-only.sh \ tests/touch/relative.sh \ tests/touch/trailing-slash.sh \ @@ -1166,11 +1171,11 @@ index 0000000..60d4c1a + +unexpand -a < in > out || fail=1 +compare exp out > /dev/null 2>&1 || fail=1 --- -2.4.3 - ---- /dev/null 2015-11-30 08:40:17.566742513 +0100 -+++ coreutils-8.24/m4/mbfile.m4 2015-12-01 09:30:55.951149907 +0100 +diff --git a/m4/mbfile.m4 b/m4/mbfile.m4 +new file mode 100644 +index 0000000..8589902 +--- /dev/null ++++ b/m4/mbfile.m4 @@ -0,0 +1,14 @@ +# mbfile.m4 serial 7 +dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc. @@ -1186,14 +1191,20 @@ index 0000000..60d4c1a + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + : +]) ---- /dev/null 2015-11-30 08:40:17.566742513 +0100 -+++ coreutils-8.24/lib/mbfile.c 2015-12-01 09:28:22.254928468 +0100 +diff --git a/lib/mbfile.c b/lib/mbfile.c +new file mode 100644 +index 0000000..b0a468e +--- /dev/null ++++ b/lib/mbfile.c @@ -0,0 +1,3 @@ +#include +#define MBFILE_INLINE _GL_EXTERN_INLINE +#include "mbfile.h" ---- /dev/null 2015-11-30 08:40:17.566742513 +0100 -+++ coreutils-8.24/lib/mbfile.h 2015-12-01 09:28:30.829885570 +0100 +diff --git a/lib/mbfile.h b/lib/mbfile.h +new file mode 100644 +index 0000000..11f1b12 +--- /dev/null ++++ b/lib/mbfile.h @@ -0,0 +1,255 @@ +/* Multibyte character I/O: macros for multi-byte encodings. + Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc. @@ -1450,3 +1461,6 @@ index 0000000..60d4c1a +_GL_INLINE_HEADER_BEGIN + +#endif /* _MBFILE_H */ +-- +2.5.5 + diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 79449d4..bcce9ff 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -106,7 +106,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c {"spaces", no_argument, NULL, 's'}, {"width", required_argument, NULL, 'w'}, {GETOPT_HELP_OPTION_DECL}, -@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing t +@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing to standard output.\n\ fputs (_("\ -b, --bytes count bytes rather than columns\n\ @@ -114,7 +114,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c -s, --spaces break at spaces\n\ -w, --width=WIDTH use WIDTH columns instead of 80\n\ "), stdout); -@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing t +@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing to standard output.\n\ static size_t adjust_column (size_t column, char c) { @@ -156,7 +156,7 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c fadvise (istream, FADVISE_SEQUENTIAL); -@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t +@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t width) bool found_blank = false; size_t logical_end = offset_out; @@ -172,16 +172,16 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c /* Look for the last blank. */ while (logical_end) { -@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t +@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t width) line_out[offset_out++] = c; } - saved_errno = errno; + *saved_errno = errno; -+ -+ if (offset_out) -+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); -+ + + if (offset_out) + fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); + +} + +#if HAVE_MBRTOWC @@ -353,10 +353,10 @@ diff -urNp coreutils-8.24-orig/src/fold.c coreutils-8.24/src/fold.c + } + + *saved_errno = errno; - - if (offset_out) - fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); - ++ ++ if (offset_out) ++ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); ++ +} +#endif + @@ -642,7 +642,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c static void freeline (struct line *line) { -@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct +@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct line const *line2, size_t jf_1, size_t jf_2) { /* Start of field to compare in each file. */ @@ -773,8 +773,8 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c - diff = memcmp (beg1, beg2, MIN (len1, len2)); + copy[0] = beg[0]; + copy[1] = beg[1]; -+ } -+ + } + + if (hard_LC_COLLATE) + { + diff = xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]); @@ -784,14 +784,14 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c + free (copy[i]); + + return diff; - } ++ } + diff = memcmp (copy[0], copy[1], MIN (len[0], len[1])); + + if (mallocd) + for (i = 0; i < 2; i++) + free (copy[i]); + - ++ if (diff) return diff; - return len1 < len2 ? -1 : len1 != len2; @@ -799,7 +799,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c } /* Check that successive input lines PREV and CURRENT from input file -@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep, +@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep, int which) } ++line_no[which - 1]; @@ -811,7 +811,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c xfields (line); if (prevline[which - 1]) -@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *li +@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *line) /* Output all the fields in line, other than the join field. */ @@ -851,7 +851,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c size_t field; struct line const *line; -@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct +@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct line const *line2) o = o->next; if (o == NULL) break; @@ -920,7 +920,7 @@ diff -urNp coreutils-8.24-orig/src/join.c coreutils-8.24/src/join.c diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c --- coreutils-8.24-orig/src/pr.c 2015-06-26 19:05:22.000000000 +0200 +++ coreutils-8.24/src/pr.c 2015-07-05 09:04:33.030546965 +0200 -@@ -312,6 +312,24 @@ +@@ -311,6 +311,24 @@ #include #include @@ -945,7 +945,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c #include "system.h" #include "error.h" #include "fadvise.h" -@@ -324,6 +342,18 @@ +@@ -323,6 +341,18 @@ #include "xstrtol.h" #include "xdectoint.h" @@ -964,7 +964,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "pr" -@@ -416,7 +446,20 @@ struct COLUMN +@@ -415,7 +445,20 @@ struct COLUMN typedef struct COLUMN COLUMN; @@ -986,7 +986,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c static bool read_line (COLUMN *p); static bool print_page (void); static bool print_stored (COLUMN *p); -@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p); +@@ -427,6 +470,7 @@ static void add_line_number (COLUMN *p); static void getoptnum (const char *n_str, int min, int *num, const char *errfmt); static void getoptarg (char *arg, char switch_char, char *character, @@ -994,7 +994,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c int *number); static void print_files (int number_of_files, char **av); static void init_parameters (int number_of_files); -@@ -441,7 +485,6 @@ static void store_char (char c); +@@ -440,7 +484,6 @@ static void store_char (char c); static void pad_down (unsigned int lines); static void read_rest_of_line (COLUMN *p); static void skip_read (COLUMN *p, int column_number); @@ -1002,7 +1002,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c static void cleanup (void); static void print_sep_string (void); static void separator_string (const char *optarg_S); -@@ -453,7 +496,7 @@ static COLUMN *column_vector; +@@ -452,7 +495,7 @@ static COLUMN *column_vector; we store the leftmost columns contiguously in buff. To print a line from buff, get the index of the first character from line_vector[i], and print up to line_vector[i + 1]. */ @@ -1011,7 +1011,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* Index of the position in buff where the next character will be stored. */ -@@ -557,7 +600,7 @@ static int chars_per_column; +@@ -556,7 +599,7 @@ static int chars_per_column; static bool untabify_input = false; /* (-e) The input tab character. */ @@ -1020,7 +1020,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ... where the leftmost column is 1. */ -@@ -567,7 +610,10 @@ static int chars_per_input_tab = 8; +@@ -566,7 +609,10 @@ static int chars_per_input_tab = 8; static bool tabify_output = false; /* (-i) The output tab character. */ @@ -1032,7 +1032,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* (-i) The width of the output tab. */ static int chars_per_output_tab = 8; -@@ -637,7 +683,13 @@ static int line_number; +@@ -636,7 +682,13 @@ static int line_number; static bool numbered_lines = false; /* (-n) Character which follows each line number. */ @@ -1047,7 +1047,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* (-n) line counting starts with 1st line of input file (not with 1st line of 1st page printed). */ -@@ -690,6 +742,7 @@ static bool use_col_separator = false; +@@ -689,6 +741,7 @@ static bool use_col_separator = false; -a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */ static char *col_sep_string = (char *) ""; static int col_sep_length = 0; @@ -1055,7 +1055,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c static char *column_separator = (char *) " "; static char *line_separator = (char *) "\t"; -@@ -840,6 +893,13 @@ separator_string (const char *optarg_S) +@@ -839,6 +892,13 @@ separator_string (const char *optarg_S) col_sep_length = (int) strlen (optarg_S); col_sep_string = xmalloc (col_sep_length + 1); strcpy (col_sep_string, optarg_S); @@ -1069,7 +1069,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c } int -@@ -864,6 +924,21 @@ main (int argc, char **argv) +@@ -863,6 +923,21 @@ main (int argc, char **argv) atexit (close_stdout); @@ -1091,7 +1091,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c n_files = 0; file_names = (argc > 1 ? xmalloc ((argc - 1) * sizeof (char *)) -@@ -940,8 +1015,12 @@ main (int argc, char **argv) +@@ -939,8 +1014,12 @@ main (int argc, char **argv) break; case 'e': if (optarg) @@ -1106,7 +1106,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* Could check tab width > 0. */ untabify_input = true; break; -@@ -954,8 +1033,12 @@ main (int argc, char **argv) +@@ -953,8 +1032,12 @@ main (int argc, char **argv) break; case 'i': if (optarg) @@ -1121,7 +1121,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* Could check tab width > 0. */ tabify_output = true; break; -@@ -973,8 +1056,8 @@ main (int argc, char **argv) +@@ -972,8 +1055,8 @@ main (int argc, char **argv) case 'n': numbered_lines = true; if (optarg) @@ -1132,7 +1132,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c break; case 'N': skip_count = false; -@@ -998,7 +1081,7 @@ main (int argc, char **argv) +@@ -997,7 +1080,7 @@ main (int argc, char **argv) old_s = false; /* Reset an additional input of -s, -S dominates -s */ col_sep_string = bad_cast (""); @@ -1141,7 +1141,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c use_col_separator = true; if (optarg) separator_string (optarg); -@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, i +@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err) a number. */ static void @@ -1359,7 +1359,7 @@ diff -urNp coreutils-8.24-orig/src/pr.c coreutils-8.24/src/pr.c /* sep_string ends with some spaces */ if (spaces_not_printed > 0) print_white_space (); -@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clu +@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clump) required number of tabs and spaces. */ static void @@ -1701,7 +1701,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c #include "system.h" #include "argmatch.h" #include "error.h" -@@ -164,14 +172,39 @@ static int decimal_point; +@@ -163,14 +171,39 @@ static int decimal_point; /* Thousands separator; if -1, then there isn't one. */ static int thousands_sep; @@ -1742,7 +1742,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; -@@ -345,13 +378,11 @@ static bool reverse; +@@ -344,13 +377,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; @@ -1815,7 +1815,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c static int struct_month_cmp (void const *m1, void const *m2) -@@ -1269,7 +1340,7 @@ struct_month_cmp (void const *m1, void c +@@ -1269,7 +1340,7 @@ struct_month_cmp (void const *m1, void const *m2) /* Initialize the character class tables. */ static void @@ -1833,7 +1833,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1363,6 +1434,84 @@ specify_nmerge (int oi, char c, char con +@@ -1363,6 +1434,84 @@ specify_nmerge (int oi, char c, char const *s) xstrtol_fatal (e, oi, c, long_options, s); } @@ -1918,7 +1918,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c /* Specify the amount of main memory to use when sorting. */ static void specify_sort_size (int oi, char c, char const *s) -@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf +@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf) by KEY in LINE. */ static char * @@ -1927,7 +1927,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struc +@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struct keyfield const *key) /* The leading field separator itself is included in a field when -t is absent. */ @@ -1940,7 +1940,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c ++ptr; if (ptr < lim) ++ptr; -@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struc +@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struct keyfield const *key) return ptr; } @@ -2012,7 +2012,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struc +@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struct keyfield const *key) 'beginning' is the first character following the delimiting TAB. Otherwise, leave PTR pointing at the first 'blank' character after the preceding field. */ @@ -2025,7 +2025,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struc +@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struct keyfield const *key) */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -2038,7 +2038,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c if (newlim) lim = newlim; } -@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struc +@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struct keyfield const *key) return ptr; } @@ -2169,7 +2169,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c /* Fill BUF reading from FP, moving buf->left bytes from the end of buf->buf to the beginning first. If EOF is reached and the file wasn't terminated by a newline, supply one. Set up BUF's line -@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) else { if (key->skipsblanks) @@ -2194,7 +2194,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c line->keybeg = line_start; } } -@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char co +@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char const *b) hideously fast. */ static int @@ -2203,7 +2203,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c { while (blanks[to_uchar (*a)]) a++; -@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b +@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b) return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -2229,7 +2229,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c /* Work around a problem whereby the long double value returned by glibc's strtold ("NaN", ...) contains uninitialized bits: clear all bytes of A and B before calling strtold. FIXME: remove this function once -@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char +@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char const *sb) Return 0 if the name in S is not recognized. */ static int @@ -2238,7 +2238,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2279,15 +2644,14 @@ debug_key (struct line const *line, stru +@@ -2280,15 +2645,14 @@ debug_key (struct line const *line, struct keyfield const *key) char saved = *lim; *lim = '\0'; @@ -2256,7 +2256,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -2431,7 +2795,7 @@ key_warnings (struct keyfield const *gke +@@ -2432,7 +2796,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) && !(key->schar || key->echar); bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ @@ -2265,7 +2265,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2489,11 +2853,87 @@ key_warnings (struct keyfield const *gke +@@ -2490,11 +2854,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) error (0, 0, _("option '-r' only applies to last-resort comparison")); } @@ -2354,7 +2354,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c { struct keyfield *key = keylist; -@@ -2578,7 +3018,7 @@ keycompare (struct line const *a, struct +@@ -2579,7 +3019,7 @@ keycompare (struct line const *a, struct line const *b) else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -2363,7 +2363,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2694,6 +3134,211 @@ keycompare (struct line const *a, struct +@@ -2695,6 +3135,211 @@ keycompare (struct line const *a, struct line const *b) return key->reverse ? -diff : diff; } @@ -2575,7 +2575,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c /* Compare two lines A and B, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B. */ -@@ -2721,7 +3366,7 @@ compare (struct line const *a, struct line const *b) +@@ -2722,7 +3367,7 @@ compare (struct line const *a, struct line const *b) diff = - NONZERO (blen); else if (blen == 0) diff = 1; @@ -2584,7 +2584,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c { /* Note xmemcoll0 is a performance enhancement as it will not unconditionally write '\0' after the -@@ -4120,6 +4765,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype) +@@ -4121,6 +4766,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype) break; case 'f': key->translate = fold_toupper; @@ -2592,7 +2592,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c break; case 'g': key->general_numeric = true; -@@ -4197,7 +4843,7 @@ main (int argc, char **argv) +@@ -4199,7 +4845,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -2601,7 +2601,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -4218,6 +4864,29 @@ main (int argc, char **argv) +@@ -4220,6 +4866,29 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -2631,7 +2631,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c have_read_stdin = false; inittables (); -@@ -4492,13 +5161,34 @@ main (int argc, char **argv) +@@ -4494,13 +5163,34 @@ main (int argc, char **argv) case 't': { @@ -2670,7 +2670,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c else { /* Provoke with 'sort -txx'. Complain about -@@ -4509,9 +5199,12 @@ main (int argc, char **argv) +@@ -4511,9 +5201,12 @@ main (int argc, char **argv) quote (optarg)); } } @@ -2685,7 +2685,7 @@ diff -urNp coreutils-8.24-orig/src/sort.c coreutils-8.24/src/sort.c } break; -@@ -5444,12 +5444,10 @@ main (int argc, char **argv) +@@ -4751,12 +5444,10 @@ main (int argc, char **argv) sort (files, nfiles, outfile, nthreads); } @@ -2719,14 +2719,14 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c #include "system.h" #include "argmatch.h" #include "linebuffer.h" -@@ -32,8 +43,20 @@ +@@ -31,9 +42,21 @@ #include "stdio--.h" #include "xmemcoll.h" #include "xstrtol.h" -#include "memcasecmp.h" +#include "xmemcoll.h" #include "quote.h" -+ + +/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC + installation; work around this configuration error. */ +#if !defined MB_LEN_MAX || MB_LEN_MAX < 2 @@ -2738,9 +2738,10 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c +# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) +#endif + - ++ /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "uniq" + @@ -143,6 +166,10 @@ enum GROUP_OPTION = CHAR_MAX + 1 }; @@ -2752,7 +2753,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c static struct option const longopts[] = { {"count", no_argument, NULL, 'c'}, -@@ -251,7 +278,7 @@ size_opt (char const *opt, char const *m +@@ -252,7 +279,7 @@ size_opt (char const *opt, char const *msgid) return a pointer to the beginning of the line's field to be compared. */ static char * _GL_ATTRIBUTE_PURE @@ -2761,7 +2762,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c { size_t count; char const *lp = line->buffer; -@@ -271,6 +298,83 @@ find_field (struct linebuffer const *lin +@@ -272,6 +299,83 @@ find_field (struct linebuffer const *line) return line->buffer + i; } @@ -2845,7 +2846,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c /* Return false if two strings OLD and NEW match, true if not. OLD and NEW point not to the beginnings of the lines but rather to the beginnings of the fields to compare. -@@ -279,6 +383,8 @@ find_field (struct linebuffer const *lin +@@ -280,6 +384,8 @@ find_field (struct linebuffer const *line) static bool different (char *old, char *new, size_t oldlen, size_t newlen) { @@ -2854,7 +2855,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c if (check_chars < oldlen) oldlen = check_chars; if (check_chars < newlen) -@@ -286,15 +392,104 @@ different (char *old, char *new, size_t +@@ -287,14 +393,103 @@ different (char *old, char *new, size_t oldlen, size_t newlen) if (ignore_case) { @@ -2886,8 +2887,8 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c + + return xmemcoll (copy_old, oldlen, copy_new, newlen); + - } - ++} ++ +#if HAVE_MBRTOWC +static int +different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate) @@ -2958,13 +2959,12 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c + free (copy[1]); + return rc; + -+} + } +#endif -+ + /* Output the line in linebuffer LINE to standard output provided that the switches say it should be output. - MATCH is true if the line matches the previous line. -@@ -358,19 +553,38 @@ check_file (const char *infile, const ch +@@ -359,19 +554,38 @@ check_file (const char *infile, const char *outfile, char delimiter) char *prevfield IF_LINT ( = NULL); size_t prevlen IF_LINT ( = 0); bool first_group_printed = false; @@ -3003,7 +3003,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c new_group = (prevline->length == 0 || different (thisfield, prevfield, thislen, prevlen)); -@@ -388,6 +602,10 @@ check_file (const char *infile, const ch +@@ -389,6 +603,10 @@ check_file (const char *infile, const char *outfile, char delimiter) SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -3014,7 +3014,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c first_group_printed = true; } } -@@ -400,17 +618,26 @@ check_file (const char *infile, const ch +@@ -401,17 +619,26 @@ check_file (const char *infile, const char *outfile, char delimiter) size_t prevlen; uintmax_t match_count = 0; bool first_delimiter = true; @@ -3041,7 +3041,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c if (readlinebuffer_delim (thisline, stdin, delimiter) == 0) { if (ferror (stdin)) -@@ -419,6 +646,14 @@ check_file (const char *infile, const ch +@@ -420,6 +647,14 @@ check_file (const char *infile, const char *outfile, char delimiter) } thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); @@ -3056,7 +3056,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c match = !different (thisfield, prevfield, thislen, prevlen); match_count += match; -@@ -451,6 +686,9 @@ check_file (const char *infile, const ch +@@ -452,6 +687,9 @@ check_file (const char *infile, const char *outfile, char delimiter) SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -3066,7 +3066,7 @@ diff -urNp coreutils-8.24-orig/src/uniq.c coreutils-8.24/src/uniq.c if (!match) match_count = 0; } -@@ -497,6 +735,19 @@ main (int argc, char **argv) +@@ -498,6 +736,19 @@ main (int argc, char **argv) atexit (close_stdout); @@ -3122,7 +3122,7 @@ diff -urNp coreutils-8.24-orig/tests/i18n/sort.sh coreutils-8.24/tests/i18n/sort diff -urNp coreutils-8.24-orig/tests/local.mk coreutils-8.24/tests/local.mk --- coreutils-8.24-orig/tests/local.mk 2015-07-05 09:00:46.526859558 +0200 +++ coreutils-8.24/tests/local.mk 2015-07-05 09:04:33.033546987 +0200 -@@ -341,6 +341,8 @@ all_tests = \ +@@ -344,6 +344,8 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ @@ -3148,7 +3148,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/cut.pl coreutils-8.24/tests/misc/cut.p my $prog = 'cut'; my $try = "Try '$prog --help' for more information.\n"; -@@ -227,6 +229,7 @@ if ($mb_locale ne 'C') +@@ -240,6 +242,7 @@ if ($mb_locale ne 'C') my @new_t = @$t; my $test_name = shift @new_t; @@ -3304,7 +3304,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/join.pl coreutils-8.24/tests/misc/join my $delim = chr 0247; sub t_subst ($) { -@@ -326,8 +335,49 @@ foreach my $t (@tv) +@@ -329,8 +338,49 @@ foreach my $t (@tv) push @Tests, $new_ent; } @@ -3482,7 +3482,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort # Since each test is run with a file name and with redirected stdin, # the name in the diagnostic is either the file name or "-". # Normalize each diagnostic to use '-'. -@@ -419,6 +428,38 @@ foreach my $t (@Tests) +@@ -424,6 +429,38 @@ foreach my $t (@Tests) } } @@ -3521,7 +3521,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/sort.pl coreutils-8.24/tests/misc/sort @Tests = triple_test \@Tests; # Remember that triple_test creates from each test with exactly one "IN" -@@ -428,6 +469,7 @@ foreach my $t (@Tests) +@@ -433,6 +470,7 @@ foreach my $t (@Tests) # Remove the IN_PIPE version of the "output-is-input" test above. # The others aren't susceptible because they have three inputs each. @Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; @@ -3606,7 +3606,7 @@ diff -urNp coreutils-8.24-orig/tests/misc/uniq.pl coreutils-8.24/tests/misc/uniq # When possible, create a "-z"-testing variant of each test. sub add_z_variants($) { -@@ -261,6 +269,53 @@ foreach my $t (@Tests) +@@ -262,6 +270,53 @@ foreach my $t (@Tests) and push @$t, {ENV=>'_POSIX2_VERSION=199209'}; } diff --git a/coreutils-overflow.patch b/coreutils-overflow.patch index 0d55a6d..06059a9 100644 --- a/coreutils-overflow.patch +++ b/coreutils-overflow.patch @@ -1,6 +1,6 @@ --- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100 +++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100 -@@ -75,7 +75,7 @@ +@@ -79,7 +79,7 @@ # define UT_TYPE_NEW_TIME(U) false #endif diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch index bfcc9d3..9f45177 100644 --- a/coreutils-selinux.patch +++ b/coreutils-selinux.patch @@ -20,7 +20,7 @@ diff -urNp coreutils-8.21-orig/man/runcon.x coreutils-8.21/man/runcon.x diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c --- coreutils-8.21-orig/src/cp.c 2013-02-07 10:37:05.000000000 +0100 +++ coreutils-8.21/src/cp.c 2013-02-15 14:31:58.945468929 +0100 -@@ -201,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE( +@@ -202,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\ all\n\ "), stdout); fputs (_("\ @@ -30,7 +30,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c --no-preserve=ATTR_LIST don't preserve the specified attributes\n\ --parents use full source file name under DIRECTORY\n\ "), stdout); -@@ -933,7 +939,7 @@ main (int argc, char **argv) +@@ -943,7 +946,7 @@ main (int argc, char **argv) we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); @@ -39,7 +39,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c long_opts, NULL)) != -1) { -@@ -981,6 +987,17 @@ main (int argc, char **argv) +@@ -991,6 +994,17 @@ main (int argc, char **argv) copy_contents = true; break; @@ -60,7 +60,7 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c --- coreutils-8.21-orig/src/id.c 2013-01-31 01:46:24.000000000 +0100 +++ coreutils-8.21/src/id.c 2013-02-15 14:31:58.946469154 +0100 -@@ -106,7 +106,7 @@ int +@@ -113,7 +113,7 @@ int main (int argc, char **argv) { int optc; @@ -72,7 +72,7 @@ diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c --- coreutils-8.21-orig/src/install.c 2013-02-07 10:37:05.000000000 +0100 +++ coreutils-8.21/src/install.c 2013-02-15 14:31:58.948469440 +0100 -@@ -639,7 +640,7 @@ In the 4th form, create all components o +@@ -649,7 +649,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\ -v, --verbose print the name of each directory as it is created\n\ "), stdout); fputs (_("\ @@ -81,7 +81,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c -Z set SELinux security context of destination\n\ file to default type\n\ --context[=CTX] like -Z, or if CTX is specified then set the\n\ -@@ -782,7 +783,7 @@ main (int argc, char **argv) +@@ -817,7 +817,7 @@ main (int argc, char **argv) we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); @@ -90,7 +90,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c NULL)) != -1) { switch (optc) -@@ -853,6 +854,8 @@ main (int argc, char **argv) +@@ -878,6 +878,8 @@ main (int argc, char **argv) no_target_directory = true; break; @@ -99,7 +99,7 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c case PRESERVE_CONTEXT_OPTION: if (! selinux_enabled) { -@@ -860,6 +862,10 @@ main (int argc, char **argv) +@@ -885,6 +887,10 @@ main (int argc, char **argv) "this kernel is not SELinux-enabled")); break; } diff --git a/coreutils-selinuxmanpages.patch b/coreutils-selinuxmanpages.patch index 7b27f90..1540613 100644 --- a/coreutils-selinuxmanpages.patch +++ b/coreutils-selinuxmanpages.patch @@ -1,7 +1,7 @@ diff -urNp coreutils-6.10-orig/doc/coreutils.texi coreutils-6.10/doc/coreutils.texi --- coreutils-6.10-orig/doc/coreutils.texi 2008-04-07 17:52:11.000000000 +0200 +++ coreutils-6.10/doc/coreutils.texi 2008-04-07 18:01:43.000000000 +0200 -@@ -6981,6 +6981,11 @@ for i; do +@@ -8002,6 +8002,11 @@ done exit $fail @end example diff --git a/sh-utils-2.0.11-dateman.patch b/sh-utils-2.0.11-dateman.patch index 8684dc7..60cdaa6 100644 --- a/sh-utils-2.0.11-dateman.patch +++ b/sh-utils-2.0.11-dateman.patch @@ -1,7 +1,7 @@ diff -urNp coreutils-5.97-orig/man/date.x coreutils-5.97/man/date.x --- coreutils-5.97-orig/man/date.x 1999-11-02 15:07:36.000000000 +0100 +++ coreutils-5.97/man/date.x 2008-10-15 10:13:31.000000000 +0200 -@@ -11,3 +11,8 @@ +@@ -11,3 +11,8 @@ calendar date, time of day, time zone, day of week, relative time, relative date, and numbers. An empty string indicates the beginning of the day. The date string format is more complex than is easily documented here but is fully described in the info documentation.