From 9a1c0e27276d66a3663b432d019ea3bd7e8bd437 Mon Sep 17 00:00:00 2001 From: Ondrej Vasik Date: Feb 26 2009 16:28:44 +0000 Subject: fix showing ACL's for ls -Z (#487374), fix automatic column width computation for it as well, fix couple of bugs (including #485715) in sort with determining end of fields (upstream) --- diff --git a/coreutils-6.12-sort-endoffields.patch b/coreutils-6.12-sort-endoffields.patch new file mode 100644 index 0000000..997feef --- /dev/null +++ b/coreutils-6.12-sort-endoffields.patch @@ -0,0 +1,101 @@ +diff -urNp coreutils-6.12-orig/src/sort.c coreutils-6.12/src/sort.c +--- coreutils-6.12-orig/src/sort.c 2009-02-26 16:01:04.000000000 +0100 ++++ coreutils-6.12/src/sort.c 2009-02-26 16:24:27.000000000 +0100 +@@ -1390,7 +1390,6 @@ begfield_uni (const struct line *line, c + char *ptr = line->text, *lim = ptr + line->length - 1; + size_t sword = key->sword; + size_t schar = key->schar; +- size_t remaining_bytes; + + /* The leading field separator itself is included in a field when -t + is absent. */ +@@ -1416,12 +1415,7 @@ begfield_uni (const struct line *line, c + while (ptr < lim && blanks[to_uchar (*ptr)]) + ++ptr; + +- /* Advance PTR by SCHAR (if possible), but no further than LIM. */ +- remaining_bytes = lim - ptr; +- if (schar < remaining_bytes) +- ptr += schar; +- else +- ptr = lim; ++ ptr = MIN (lim, ptr + schar); + + return ptr; + } +@@ -1493,7 +1487,9 @@ limfield_uni (const struct line *line, c + { + char *ptr = line->text, *lim = ptr + line->length - 1; + size_t eword = key->eword, echar = key->echar; +- size_t remaining_bytes; ++ ++ if (echar == 0) ++ eword++; /* Skip all of end field. */ + + /* Move PTR past EWORD fields or to one past the last byte on LINE, + whichever comes first. If there are more than EWORD fields, leave +@@ -1566,19 +1566,13 @@ limfield_uni (const struct line *line, c + } + #endif + +- /* If we're ignoring leading blanks when computing the End +- of the field, don't start counting bytes until after skipping +- past any leading blanks. */ +- if (key->skipeblanks) +- while (ptr < lim && blanks[to_uchar (*ptr)]) +- ++ptr; +- +- /* Advance PTR by ECHAR (if possible), but no further than LIM. */ +- remaining_bytes = lim - ptr; +- if (echar < remaining_bytes) +- ptr += echar; +- else +- ptr = lim; ++ if (echar != 0) /* We need to skip over a portion of the end field. */ ++ { ++ if (key->skipeblanks) /* blanks not counted in echar. */ ++ while (ptr < lim && blanks[to_uchar (*ptr)]) ++ ++ptr; ++ ptr = MIN (lim, ptr + echar); ++ } + + return ptr; + } +@@ -3582,12 +3579,9 @@ main (int argc, char **argv) + badfieldspec (optarg, N_("field number is zero")); + } + if (*s == '.') +- s = parse_field_count (s + 1, &key->echar, +- N_("invalid number after `.'")); +- else + { +- /* `-k 2,3' is equivalent to `+1 -3'. */ +- key->eword++; ++ s = parse_field_count (s + 1, &key->echar, ++ N_("invalid number after `.'")); + } + s = set_ordering (s, key, bl_end); + } +diff -urNp coreutils-6.12-orig/tests/misc/sort coreutils-6.12/tests/misc/sort +--- coreutils-6.12-orig/tests/misc/sort 2008-05-17 08:41:12.000000000 +0200 ++++ coreutils-6.12/tests/misc/sort 2009-02-26 16:25:39.000000000 +0100 +@@ -108,6 +108,8 @@ my @Tests = + ["07b", '-k 2,3', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}], + ["07c", '-k 2,3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}], + ["07d", '+1 -3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}], ++#ensure a character position of 0 includes whole field ++["07e", '-k 2,3.0', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}], + # + # report an error for `.' without following char spec + ["08a", '-k 2.,3', {EXIT=>2}, +@@ -208,6 +210,10 @@ my @Tests = + # key start and key end. + ["18e", '-nb -k1.1,1.2', {IN=>" 901\n100\n"}, {OUT=>"100\n 901\n"}], + ++# When ignoring leading blanks for end position, ensure blanks from ++# next field are not included in the sort. I.E. order should not change here. ++["18f", '-k1,1b', {IN=>"a y\na z\n"}, {OUT=>"a y\na z\n"}], ++ + # This looks odd, but works properly -- 2nd keyspec is never + # used because all lines are different. + ["19a", '+0 +1nr', {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 1\nb 2\nb 3\n"}], diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch index 56b17f8..7dd868b 100644 --- a/coreutils-selinux.patch +++ b/coreutils-selinux.patch @@ -442,7 +442,26 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c }; ARGMATCH_VERIFY (format_args, format_types); -@@ -1236,7 +1245,7 @@ main (int argc, char **argv) +@@ -1169,7 +1175,8 @@ main (int argc, char **argv) + /* Avoid following symbolic links when possible. */ + if (is_colored (C_ORPHAN) + || (is_colored (C_EXEC) && color_symlink_as_referent) +- || (is_colored (C_MISSING) && format == long_format)) ++ || (is_colored (C_MISSING) && (format == long_format ++ || format == security_format))) + check_symlink_color = true; + + /* If the standard output is a controlling terminal, watch out +@@ -1219,7 +1226,7 @@ main (int argc, char **argv) + if (dereference == DEREF_UNDEFINED) + dereference = ((immediate_dirs + || indicator_style == classify +- || format == long_format) ++ || format == long_format || format == security_format) + ? DEREF_NEVER + : DEREF_COMMAND_LINE_SYMLINK_TO_DIR); + +@@ -1236,7 +1246,7 @@ main (int argc, char **argv) format_needs_stat = sort_type == sort_time || sort_type == sort_size || format == long_format @@ -451,7 +470,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c || print_block_size; format_needs_type = (! format_needs_stat && (recursive -@@ -1267,7 +1276,7 @@ main (int argc, char **argv) +@@ -1267,7 +1277,7 @@ main (int argc, char **argv) } else do @@ -460,7 +479,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c while (i < argc); if (cwd_n_used) -@@ -1429,7 +1438,7 @@ decode_switches (int argc, char **argv) +@@ -1429,7 +1439,7 @@ decode_switches (int argc, char **argv) ignore_mode = IGNORE_DEFAULT; ignore_patterns = NULL; hide_patterns = NULL; @@ -469,7 +488,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c /* FIXME: put this in a function. */ { -@@ -1811,13 +1820,27 @@ decode_switches (int argc, char **argv) +@@ -1811,13 +1821,27 @@ decode_switches (int argc, char **argv) break; case 'Z': @@ -498,7 +517,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c default: usage (LS_FAILURE); } -@@ -2517,8 +2540,10 @@ clear_files (void) +@@ -2517,8 +2541,10 @@ clear_files (void) struct fileinfo *f = sorted_file[i]; free (f->name); free (f->linkname); @@ -511,7 +530,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c } cwd_n_used = 0; -@@ -2560,6 +2585,7 @@ gobble_file (char const *name, enum file +@@ -2560,6 +2586,7 @@ gobble_file (char const *name, enum file memset (f, '\0', sizeof *f); f->stat.st_ino = inode; f->filetype = type; @@ -519,7 +538,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c if (command_line_arg || format_needs_stat -@@ -2659,7 +2685,7 @@ gobble_file (char const *name, enum file +@@ -2659,7 +2686,7 @@ gobble_file (char const *name, enum file f->stat_ok = true; @@ -528,7 +547,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c { bool have_acl = false; int attr_len = (do_deref -@@ -2667,9 +2694,7 @@ gobble_file (char const *name, enum file +@@ -2667,9 +2695,7 @@ gobble_file (char const *name, enum file f->scontext = xstrdup ("unlabeled"); } @@ -539,16 +558,43 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c { f->scontext = UNKNOWN_SECURITY_CONTEXT; -@@ -2681,7 +2706,7 @@ gobble_file (char const *name, enum file +@@ -2681,7 +2707,7 @@ gobble_file (char const *name, enum file err = 0; } - if (err == 0 && ! have_acl && format == long_format) -+ if (err == 0 && format == long_format) ++ if (err == 0 && format == long_format || format == security_format) { int n = file_has_acl (absolute_name, &f->stat); err = (n < 0); -@@ -3255,6 +3281,13 @@ print_current_files (void) +@@ -2741,7 +2767,7 @@ gobble_file (char const *name, enum file + } + + if (S_ISLNK (f->stat.st_mode) +- && (format == long_format || check_symlink_color)) ++ && (format == long_format || format == security_format || check_symlink_color)) + { + char *linkname; + struct stat linkstats; +@@ -2761,7 +2787,7 @@ gobble_file (char const *name, enum file + command line are automatically traced if not being + listed as files. */ + if (!command_line_arg || format == long_format +- || !S_ISDIR (linkstats.st_mode)) ++ || format == security_format || !S_ISDIR (linkstats.st_mode)) + { + /* Get the linked-to file's mode for the filetype indicator + in long listings. */ +@@ -2800,7 +2826,7 @@ gobble_file (char const *name, enum file + block_size_width = len; + } + +- if (format == long_format) ++ if (format == long_format || format == security_format) + { + if (print_owner) + { +@@ -3255,6 +3282,13 @@ print_current_files (void) print_long_format (sorted_file[i]); DIRED_PUTCHAR ('\n'); } @@ -562,7 +608,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c break; } } -@@ -3481,7 +3514,7 @@ print_long_format (const struct fileinfo +@@ -3481,7 +3515,7 @@ print_long_format (const struct fileinfo The latter is wrong when inode_number_width is zero. */ p += strlen (p); } @@ -571,7 +617,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c if (print_block_size) { char hbuf[LONGEST_HUMAN_READABLE + 1]; -@@ -3510,9 +3543,15 @@ print_long_format (const struct fileinfo +@@ -3510,9 +3544,15 @@ print_long_format (const struct fileinfo The latter is wrong when nlink_width is zero. */ p += strlen (p); @@ -588,7 +634,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c { DIRED_FPUTS (buf, stdout, p - buf); -@@ -3525,9 +3564,6 @@ print_long_format (const struct fileinfo +@@ -3525,9 +3565,6 @@ print_long_format (const struct fileinfo if (print_author) format_user (f->stat.st_author, author_width, f->stat_ok); @@ -598,7 +644,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c p = buf; } -@@ -3864,9 +3900,6 @@ print_file_name_and_frills (const struct +@@ -3864,9 +3901,6 @@ print_file_name_and_frills (const struct human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts, ST_NBLOCKSIZE, output_block_size)); @@ -608,7 +654,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f), f->linkok, f->stat_ok, f->filetype, NULL); -@@ -4030,9 +4063,6 @@ length_of_file_name_and_frills (const st +@@ -4030,9 +4064,6 @@ length_of_file_name_and_frills (const st output_block_size)) : block_size_width); @@ -618,7 +664,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c quote_name (NULL, f->name, filename_quoting_options, &name_width); len += name_width; -@@ -4461,9 +4491,16 @@ Mandatory arguments to long options are +@@ -4461,9 +4492,16 @@ Mandatory arguments to long options are -w, --width=COLS assume screen width instead of current value\n\ -x list entries by lines instead of by columns\n\ -X sort alphabetically by entry extension\n\ @@ -636,7 +682,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (_("\n\ -@@ -4487,3 +4524,67 @@ Exit status is 0 if OK, 1 if minor probl +@@ -4487,3 +4525,67 @@ Exit status is 0 if OK, 1 if minor probl } exit (status); } diff --git a/coreutils.spec b/coreutils.spec index da07adf..96902f8 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: The GNU core utilities: a set of tools commonly used in shell scripts Name: coreutils Version: 6.12 -Release: 18%{?dist} +Release: 19%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -25,6 +25,7 @@ Patch4: coreutils-6.12-date_timerelsnumber.patch Patch5: coreutils-6.12-seqdecimalutf8.patch Patch6: coreutils-6.12-catch-known-testsuite-failures.patch Patch7: coreutils-446294-lsexitstatuses.patch +Patch8: coreutils-6.12-sort-endoffields.patch # Our patches Patch100: coreutils-6.10-configuration.patch @@ -120,6 +121,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch5 -p1 -b .sequtf8 %patch6 -p1 -b .tests %patch7 -p1 -b .lsexit +%patch8 -p1 -b .endfields # Our patches %patch100 -p1 -b .configure @@ -340,6 +342,12 @@ fi /sbin/runuser %changelog +* Thu Feb 26 2009 Ondrej Vasik - 6.12-19 +- fix showing ACL's for ls -Z (#487374), fix automatic + column width for it as well +- fix couple of bugs (including #485715) in sort with + determining end of fields(upstream) + * Fri Nov 21 2008 Ondrej Vasik - 6.12-18 - added requirements for util-linux-ng >= 2.14 because of file conflict in update from F-8/F-9(#472445)