Blame SOURCES/coreutils-selinux.patch

740027
diff -urNp coreutils-8.21-orig/init.cfg coreutils-8.21/init.cfg
740027
--- coreutils-8.21-orig/init.cfg	2013-01-31 01:46:24.000000000 +0100
740027
+++ coreutils-8.21/init.cfg	2013-02-15 14:31:58.957469955 +0100
740027
@@ -308,8 +308,8 @@ require_selinux_()
740027
   # Independent of whether SELinux is enabled system-wide,
740027
   # the current file system may lack SELinux support.
740027
   # Also the current build may have SELinux support disabled.
740027
-  case $(ls -Zd .) in
740027
-    '? .'|'unlabeled .')
740027
+  case $(ls -Zd . | cut -f4 -d" ") in
740027
+    '?'|'unlabeled')
740027
       test -z "$CONFIG_HEADER" \
740027
         && framework_failure_ 'CONFIG_HEADER not defined'
740027
       grep '^#define HAVE_SELINUX_SELINUX_H 1' "$CONFIG_HEADER" > /dev/null \
740027
diff -urNp coreutils-8.21-orig/man/chcon.x coreutils-8.21/man/chcon.x
740027
--- coreutils-8.21-orig/man/chcon.x	2011-08-23 15:44:01.000000000 +0200
740027
+++ coreutils-8.21/man/chcon.x	2013-02-15 14:31:58.937482694 +0100
740027
@@ -1,4 +1,4 @@
740027
 [NAME]
740027
-chcon \- change file security context
740027
+chcon \- change file SELinux security context
740027
 [DESCRIPTION]
740027
 .\" Add any additional description here
740027
diff -urNp coreutils-8.21-orig/man/runcon.x coreutils-8.21/man/runcon.x
740027
--- coreutils-8.21-orig/man/runcon.x	2011-08-23 15:44:01.000000000 +0200
740027
+++ coreutils-8.21/man/runcon.x	2013-02-15 14:31:58.938486496 +0100
740027
@@ -1,5 +1,5 @@
740027
 [NAME]
740027
-runcon \- run command with specified security context
740027
+runcon \- run command with specified SELinux security context
740027
 [DESCRIPTION]
740027
 Run COMMAND with completely-specified CONTEXT, or with current or
740027
 transitioned security context modified by one or more of LEVEL,
740027
diff -urNp coreutils-8.21-orig/src/copy.c coreutils-8.21/src/copy.c
740027
--- coreutils-8.21-orig/src/copy.c	2013-02-07 10:37:05.000000000 +0100
740027
+++ coreutils-8.21/src/copy.c	2013-02-15 14:31:58.941467872 +0100
740027
@@ -2410,6 +2410,17 @@ copy_internal (char const *src_name, cha
740027
       else
740027
         {
740027
           omitted_permissions = 0;
740027
+
740027
+          /* For directories, the process global context could be reset for
740027
+             descendents, so use it to set the context for existing dirs here.
740027
+             This will also give earlier indication of failure to set ctx.  */
740027
+          if (x->set_security_context || x->preserve_security_context)
740027
+            if (! set_file_security_ctx (dst_name, x->preserve_security_context,
740027
+                                         false, x))
740027
+              {
740027
+                if (x->require_preserve_context)
740027
+                  goto un_backup;
740027
+              }
740027
         }
740027
 
740027
       /* Decide whether to copy the contents of the directory.  */
740027
@@ -2415,6 +2426,8 @@ copy_internal (char const *src_name, cha
740027
         {
740027
           /* Here, we are crossing a file system boundary and cp's -x option
740027
              is in effect: so don't copy the contents of this directory. */
740027
+        if (x->preserve_security_context)
740027
+           restore_default_fscreatecon_or_die ();
740027
         }
740027
       else
740027
         {
740027
@@ -2602,7 +2613,7 @@ copy_internal (char const *src_name, cha
740027
 
740027
   /* With -Z or --preserve=context, set the context for existing files.
740027
      Note this is done already for copy_reg() for reasons described therein.  */
740027
-  if (!new_dst && !x->copy_as_regular
740027
+  if (!new_dst && !x->copy_as_regular && !S_ISDIR (src_mode)
740027
       && (x->set_security_context || x->preserve_security_context))
740027
     {
740027
       if (! set_file_security_ctx (dst_name, x->preserve_security_context,
740027
diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c
740027
--- coreutils-8.21-orig/src/cp.c	2013-02-07 10:37:05.000000000 +0100
740027
+++ coreutils-8.21/src/cp.c	2013-02-15 14:31:58.945468929 +0100
740027
@@ -201,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE(
740027
                                  all\n\
740027
 "), stdout);
740027
       fputs (_("\
740027
+  -c                           deprecated, same as --preserve=context\n\
740027
+"), stdout);
740027
+      fputs (_("\
740027
       --no-preserve=ATTR_LIST  don't preserve the specified attributes\n\
740027
       --parents                use full source file name under DIRECTORY\n\
740027
 "), stdout);
740027
@@ -933,7 +939,7 @@ main (int argc, char **argv)
740027
      we'll actually use backup_suffix_string.  */
740027
   backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
740027
 
740027
-  while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
740027
+  while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ",
740027
                            long_opts, NULL))
740027
          != -1)
740027
     {
740027
@@ -981,6 +987,17 @@ main (int argc, char **argv)
740027
           copy_contents = true;
740027
           break;
740027
 
740027
+        case 'c':
740027
+          fprintf (stderr, "%s: warning: option '-c' is deprecated, please use '--preserve=context' instead\n", argv[0]);
740027
+          if ( x.set_security_context ) { 
740027
+              (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
740027
+             exit( 1 );
740027
+           }
740027
+           else if (selinux_enabled) {
740027
+              x.preserve_security_context = true;
740027
+              x.require_preserve_context = true;
740027
+           }
740027
+          break;
740027
         case 'd':
740027
           x.preserve_links = true;
740027
           x.dereference = DEREF_NEVER;
740027
diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c
740027
--- coreutils-8.21-orig/src/id.c	2013-01-31 01:46:24.000000000 +0100
740027
+++ coreutils-8.21/src/id.c	2013-02-15 14:31:58.946469154 +0100
740027
@@ -106,7 +106,7 @@ int
740027
 main (int argc, char **argv)
740027
 {
740027
   int optc;
740027
-  int selinux_enabled = (is_selinux_enabled () > 0);
740027
+  bool selinux_enabled = (is_selinux_enabled () > 0);
740027
   bool smack_enabled = is_smack_enabled ();
740027
   bool opt_zero = false;
740027
   char *pw_name = NULL;
740027
diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c
740027
--- coreutils-8.21-orig/src/install.c	2013-02-07 10:37:05.000000000 +0100
740027
+++ coreutils-8.21/src/install.c	2013-02-15 14:31:58.948469440 +0100
740027
@@ -639,7 +640,7 @@ In the 4th form, create all components o
740027
   -v, --verbose       print the name of each directory as it is created\n\
740027
 "), stdout);
740027
       fputs (_("\
740027
-      --preserve-context  preserve SELinux security context\n\
740027
+  -P, --preserve-context  preserve SELinux security context (-P deprecated)\n\
740027
   -Z, --context[=CTX]     set SELinux security context of destination file to\n\
740027
                             default type, or to CTX if specified\n\
740027
 "), stdout);
740027
@@ -782,7 +783,7 @@ main (int argc, char **argv)
740027
      we'll actually use backup_suffix_string.  */
740027
   backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
740027
 
740027
-  while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options,
740027
+  while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z", long_options,
740027
                               NULL)) != -1)
740027
     {
740027
       switch (optc)
740027
@@ -853,6 +854,8 @@ main (int argc, char **argv)
740027
           no_target_directory = true;
740027
           break;
740027
 
740027
+        case 'P':
740027
+          fprintf (stderr, "%s: warning: option '-P' is deprecated, please use '--preserve-context' instead\n", argv[0]);
740027
         case PRESERVE_CONTEXT_OPTION:
740027
           if (! selinux_enabled)
740027
             {
740027
@@ -860,6 +862,10 @@ main (int argc, char **argv)
740027
                              "this kernel is not SELinux-enabled"));
740027
               break;
740027
             }
740027
+          if ( x.set_security_context ) {
740027
+             (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
740027
+             exit( 1 );
740027
+          }
740027
           x.preserve_security_context = true;
740027
           use_default_selinux_context = false;
740027
           break;
740027
diff -urNp coreutils-8.21-orig/src/ls.c coreutils-8.21/src/ls.c
740027
--- coreutils-8.21-orig/src/ls.c	2013-02-03 04:24:02.000000000 +0100
740027
+++ coreutils-8.21/src/ls.c	2013-02-15 14:31:58.953469008 +0100
740027
@@ -165,7 +165,8 @@ enum filetype
740027
     symbolic_link,
740027
     sock,
740027
     whiteout,
740027
-    arg_directory
740027
+    arg_directory,
740027
+    command_line
740027
   };
740027
 
740027
 /* Display letters and indicators for each filetype.
740027
@@ -281,6 +282,7 @@ static void queue_directory (char const 
740027
                              bool command_line_arg);
740027
 static void sort_files (void);
740027
 static void parse_ls_color (void);
740027
+static void print_scontext_format (const struct fileinfo *f);
740027
 
740027
 /* Initial size of hash table.
740027
    Most hierarchies are likely to be shallower than this.  */
740027
@@ -350,7 +352,7 @@ static struct pending *pending_dirs;
740027
 
740027
 static struct timespec current_time;
740027
 
740027
-static bool print_scontext;
740027
+static int print_scontext = 0;
740027
 static char UNKNOWN_SECURITY_CONTEXT[] = "?";
740027
 
740027
 /* Whether any of the files has an ACL.  This affects the width of the
740027
@@ -390,7 +392,9 @@ enum format
740027
     one_per_line,		/* -1 */
740027
     many_per_line,		/* -C */
740027
     horizontal,			/* -x */
740027
-    with_commas			/* -m */
740027
+    with_commas,			/* -m */
740027
+    security_format, /* -Z */
740027
+    invalid_format
740027
   };
740027
 
740027
 static enum format format;
740027
@@ -793,6 +797,9 @@ enum
740027
   SHOW_CONTROL_CHARS_OPTION,
740027
   SI_OPTION,
740027
   SORT_OPTION,
740027
+  CONTEXT_OPTION,
740027
+  LCONTEXT_OPTION,
740027
+  SCONTEXT_OPTION,
740027
   TIME_OPTION,
740027
   TIME_STYLE_OPTION
740027
 };
740027
@@ -839,7 +846,9 @@ static struct option const long_options[
740027
   {"time-style", required_argument, NULL, TIME_STYLE_OPTION},
740027
   {"color", optional_argument, NULL, COLOR_OPTION},
740027
   {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
740027
-  {"context", no_argument, 0, 'Z'},
740027
+  {"context", no_argument, 0, CONTEXT_OPTION},
740027
+  {"lcontext", no_argument, 0, LCONTEXT_OPTION},
740027
+  {"scontext", no_argument, 0, SCONTEXT_OPTION},
740027
   {"author", no_argument, NULL, AUTHOR_OPTION},
740027
   {GETOPT_HELP_OPTION_DECL},
740027
   {GETOPT_VERSION_OPTION_DECL},
740027
@@ -849,12 +858,12 @@ static struct option const long_options[
740027
 static char const *const format_args[] =
740027
 {
740027
   "verbose", "long", "commas", "horizontal", "across",
740027
-  "vertical", "single-column", NULL
740027
+  "vertical", "single-column", "context", NULL
740027
 };
740027
 static enum format const format_types[] =
740027
 {
740027
   long_format, long_format, with_commas, horizontal, horizontal,
740027
-  many_per_line, one_per_line
740027
+  many_per_line, one_per_line, security_format
740027
 };
740027
 ARGMATCH_VERIFY (format_args, format_types);
740027
 
740027
@@ -1296,7 +1305,8 @@ main (int argc, char **argv)
740027
       /* Avoid following symbolic links when possible.  */
740027
       if (is_colored (C_ORPHAN)
740027
           || (is_colored (C_EXEC) && color_symlink_as_referent)
740027
-          || (is_colored (C_MISSING) && format == long_format))
740027
+          || (is_colored (C_MISSING) && (format == long_format
740027
+              || format == security_format)))
740027
         check_symlink_color = true;
740027
 
740027
       /* If the standard output is a controlling terminal, watch out
740027
@@ -1343,7 +1353,7 @@ main (int argc, char **argv)
740027
   if (dereference == DEREF_UNDEFINED)
740027
     dereference = ((immediate_dirs
740027
                     || indicator_style == classify
740027
-                    || format == long_format)
740027
+                    || format == long_format || format == security_format)
740027
                    ? DEREF_NEVER
740027
                    : DEREF_COMMAND_LINE_SYMLINK_TO_DIR);
740027
 
740027
@@ -1363,7 +1373,7 @@ main (int argc, char **argv)
740027
 
740027
   format_needs_stat = sort_type == sort_time || sort_type == sort_size
740027
     || format == long_format
740027
-    || print_scontext
740027
+    || format == security_format || print_scontext
740027
     || print_block_size;
740027
   format_needs_type = (! format_needs_stat
740027
                        && (recursive
740027
@@ -1394,7 +1404,7 @@ main (int argc, char **argv)
740027
     }
740027
   else
740027
     do
740027
-      gobble_file (argv[i++], unknown, NOT_AN_INODE_NUMBER, true, "");
740027
+      gobble_file (argv[i++], command_line, NOT_AN_INODE_NUMBER, true, "");
740027
     while (i < argc);
740027
 
740027
   if (cwd_n_used)
740027
@@ -1565,7 +1575,7 @@ decode_switches (int argc, char **argv)
740027
   ignore_mode = IGNORE_DEFAULT;
740027
   ignore_patterns = NULL;
740027
   hide_patterns = NULL;
740027
-  print_scontext = false;
740027
+  print_scontext = 0;
740027
 
740027
   /* FIXME: put this in a function.  */
740027
   {
740027
@@ -1941,13 +1951,27 @@ decode_switches (int argc, char **argv)
740027
           break;
740027
 
740027
         case 'Z':
740027
-          print_scontext = true;
740027
+          print_scontext = 1;
740027
+    format = security_format;
740027
           break;
740027
 
740027
         case_GETOPT_HELP_CHAR;
740027
 
740027
         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
740027
 
740027
+  case CONTEXT_OPTION: /* default security context format */
740027
+                print_scontext = 1;
740027
+                format = security_format;
740027
+                break;
740027
+        case LCONTEXT_OPTION: /* long format plus security context */
740027
+                print_scontext = 1;
740027
+                format = long_format;
740027
+                break;
740027
+        case SCONTEXT_OPTION: /* short form of new security format */
740027
+                print_scontext = 0;
740027
+                format = security_format;
740027
+                break;
740027
+
740027
         default:
740027
           usage (LS_FAILURE);
740027
         }
740027
@@ -2883,6 +2907,7 @@ gobble_file (char const *name, enum file
740027
   memset (f, '\0', sizeof *f);
740027
   f->stat.st_ino = inode;
740027
   f->filetype = type;
740027
+  f->scontext = NULL;
740027
 
740027
   if (command_line_arg
740027
       || format_needs_stat
740027
@@ -2995,7 +3020,7 @@ gobble_file (char const *name, enum file
740027
           && print_with_color && is_colored (C_CAP))
740027
         f->has_capability = has_capability_cache (absolute_name, f);
740027
 
740027
-      if (format == long_format || print_scontext)
740027
+      if (format == long_format || format == security_format || print_scontext)
740027
         {
740027
           bool have_scontext = false;
740027
           bool have_acl = false;
740027
@@ -3016,7 +3041,7 @@ gobble_file (char const *name, enum file
740027
                 err = 0;
740027
             }
740027
 
740027
-          if (err == 0 && format == long_format)
740027
+          if (err == 0 && (format == long_format || format == security_format))
740027
             {
740027
               int n = file_has_acl_cache (absolute_name, f);
740027
               err = (n < 0);
740027
@@ -3035,7 +3060,8 @@ gobble_file (char const *name, enum file
740027
         }
740027
 
740027
       if (S_ISLNK (f->stat.st_mode)
740027
-          && (format == long_format || check_symlink_color))
740027
+          && (format == long_format || format == security_format
740027
+              || check_symlink_color))
740027
         {
740027
           struct stat linkstats;
740027
 
740027
@@ -3054,6 +3080,7 @@ gobble_file (char const *name, enum file
740027
                  command line are automatically traced if not being
740027
                  listed as files.  */
740027
               if (!command_line_arg || format == long_format
740027
+                  || format == security_format
740027
                   || !S_ISDIR (linkstats.st_mode))
740027
                 {
740027
                   /* Get the linked-to file's mode for the filetype indicator
740027
@@ -3087,7 +3114,7 @@ gobble_file (char const *name, enum file
740027
             block_size_width = len;
740027
         }
740027
 
740027
-      if (format == long_format)
740027
+      if (format == long_format || format == security_format)
740027
         {
740027
           if (print_owner)
740027
             {
740027
@@ -3591,6 +3618,13 @@ print_current_files (void)
740027
           print_long_format (sorted_file[i]);
740027
           DIRED_PUTCHAR ('\n');
740027
         }
740027
+     break;
740027
+    case security_format:
740027
+      for (i = 0; i < cwd_n_used; i++)
740027
+      {
740027
+        print_scontext_format (sorted_file[i]);
740027
+        DIRED_PUTCHAR ('\n');
740027
+      }
740027
       break;
740027
     }
740027
 }
740027
@@ -3753,6 +3787,67 @@ format_inode (char *buf, size_t buflen, 
740027
           : (char *) "?");
740027
 }
740027
 
740027
+/* Print info about f in scontext format */
740027
+static void
740027
+print_scontext_format (const struct fileinfo *f)
740027
+{
740027
+  char modebuf[12];
740027
+
740027
+  /* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
740027
+     1 10-byte mode string,
740027
+     9 spaces, one following each of these fields, and
740027
+     1 trailing NUL byte.  */
740027
+
740027
+  char init_bigbuf[7 * LONGEST_HUMAN_READABLE + 10  + 9 + 1];
740027
+  char *buf = init_bigbuf;
740027
+  char *p;
740027
+
740027
+  p = buf;
740027
+
740027
+  if ( print_scontext ) { /* zero means terse listing */
740027
+    filemodestring (&f->stat, modebuf);
740027
+    if (! any_has_acl)
740027
+      modebuf[10] = '\0';
740027
+    else if (f->acl_type == ACL_T_SELINUX_ONLY)
740027
+      modebuf[10] = '.';
740027
+    else if (f->acl_type == ACL_T_YES)
740027
+      modebuf[10] = '+';
740027
+    modebuf[11] = '\0';
740027
+
740027
+    /* print mode */
740027
+
740027
+    (void) sprintf (p, "%s ", modebuf);
740027
+    p += strlen (p);
740027
+
740027
+    /* print standard user and group */
740027
+
740027
+    DIRED_FPUTS (buf, stdout, p - buf);
740027
+    format_user (f->stat.st_uid, owner_width, f->stat_ok);
740027
+    format_group (f->stat.st_gid, group_width, f->stat_ok);
740027
+    p = buf;
740027
+  }
740027
+
740027
+  (void) sprintf (p, "%-32s ", f->scontext ?: "");
740027
+  p += strlen (p);
740027
+
740027
+  DIRED_INDENT ();
740027
+  DIRED_FPUTS (buf, stdout, p - buf);
740027
+  size_t w = print_name_with_quoting (f, false, &dired_obstack, p - buf);
740027
+
740027
+  if (f->filetype == symbolic_link) {
740027
+      if (f->linkname) {
740027
+          DIRED_FPUTS_LITERAL (" -> ", stdout);
740027
+          print_name_with_quoting (f, true, NULL, (p - buf) + w + 4);
740027
+          if (indicator_style != none)
740027
+            print_type_indicator (f->stat_ok, f->linkmode, f->filetype);
740027
+      }
740027
+  }
740027
+  else {
740027
+    if (indicator_style != none)
740027
+      print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
740027
+  }
740027
+}
740027
+
740027
 /* Print information about F in long format.  */
740027
 static void
740027
 print_long_format (const struct fileinfo *f)
740027
@@ -3844,9 +3939,15 @@ print_long_format (const struct fileinfo
740027
      The latter is wrong when nlink_width is zero.  */
740027
   p += strlen (p);
740027
 
740027
+  if (print_scontext)
740027
+    {
740027
+      sprintf (p, "%-32s ", f->scontext ? f->scontext : "");
740027
+      p += strlen (p);
740027
+    }
740027
+
740027
   DIRED_INDENT ();
740027
 
740027
-  if (print_owner || print_group || print_author || print_scontext)
740027
+  if (print_owner || print_group || print_author)
740027
     {
740027
       DIRED_FPUTS (buf, stdout, p - buf);
740027
 
740027
@@ -3859,9 +3960,6 @@ print_long_format (const struct fileinfo
740027
       if (print_author)
740027
         format_user (f->stat.st_author, author_width, f->stat_ok);
740027
 
740027
-      if (print_scontext)
740027
-        format_user_or_group (f->scontext, 0, scontext_width);
740027
-
740027
       p = buf;
740027
     }
740027
 
740027
@@ -4207,9 +4305,6 @@ print_file_name_and_frills (const struct
740027
             : human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts,
740027
                               ST_NBLOCKSIZE, output_block_size));
740027
 
740027
-  if (print_scontext)
740027
-    printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext);
740027
-
740027
   size_t width = print_name_with_quoting (f, false, NULL, start_col);
740027
 
740027
   if (indicator_style != none)
740027
@@ -4417,9 +4512,6 @@ length_of_file_name_and_frills (const st
740027
                                             output_block_size))
740027
                 : block_size_width);
740027
 
740027
-  if (print_scontext)
740027
-    len += 1 + (format == with_commas ? strlen (f->scontext) : scontext_width);
740027
-
740027
   quote_name (NULL, f->name, filename_quoting_options, &name_width);
740027
   len += name_width;
740027
 
740027
@@ -4856,9 +4948,16 @@ Sort entries alphabetically if none of -
740027
   -w, --width=COLS           assume screen width instead of current value\n\
740027
   -x                         list entries by lines instead of by columns\n\
740027
   -X                         sort alphabetically by entry extension\n\
740027
-  -Z, --context              print any SELinux security context of each file\n\
740027
   -1                         list one file per line\n\
740027
 "), stdout);
740027
+      fputs(_("\nSELinux options:\n\n\
740027
+  --lcontext                 Display security context.   Enable -l. Lines\n\
740027
+                             will probably be too wide for most displays.\n\
740027
+  -Z, --context              Display security context so it fits on most\n\
740027
+                             displays.  Displays only mode, user, group,\n\
740027
+                             security context and file name.\n\
740027
+  --scontext                 Display only security context and file name.\n\
740027
+"), stdout);
740027
       fputs (HELP_OPTION_DESCRIPTION, stdout);
740027
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
740027
       emit_size_note ();
740027
diff -urNp coreutils-8.21-orig/tests/misc/selinux.sh coreutils-8.21/tests/misc/selinux.sh
740027
--- coreutils-8.21-orig/tests/misc/selinux.sh	2013-01-31 01:46:24.000000000 +0100
740027
+++ coreutils-8.21/tests/misc/selinux.sh	2013-02-15 14:31:58.957469955 +0100
740027
@@ -37,7 +37,7 @@ chcon $ctx f d p ||
740027
 
740027
 # inspect that context with both ls -Z and stat.
740027
 for i in d f p; do
740027
-  c=$(ls -dogZ $i|cut -d' ' -f3); test x$c = x$ctx || fail=1
740027
+  c=$(ls -dogZ $i|cut -d' ' -f4); test x$c = x$ctx || fail=1
740027
   c=$(stat --printf %C $i); test x$c = x$ctx || fail=1
740027
 done
740027