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