stat no longer accepts the --context (-Z) option. Initially it was
merely accepted and ignored, for compatibility. Starting two years
- ago, with coreutils-7.0, its use evoked a warning.
+ ago, with coreutils-7.0, its use evoked a warning. Printing the
+ SELinux context can be done with the %C format directive, and the
+ default output when no format is specified now automatically
+ includes %C when context information is available.
stat now outputs the full sub-second resolution for the atime,
mtime, and ctime values since the Epoch, when using the %X, %Y, and
if (fs)
{
if (terse)
- format = xstrdup ("%n %i %l %t %s %S %b %f %a %c %d\n");
+ {
+ if (0 < is_selinux_enabled ())
+ format = xstrdup ("%n %i %l %t %s %S %b %f %a %c %d %C\n");
+ else
+ format = xstrdup ("%n %i %l %t %s %S %b %f %a %c %d\n");
+ }
else
{
/* TRANSLATORS: This string uses format specifiers from
Blocks: Total: %-10b Free: %-10f Available: %a\n\
Inodes: Total: %-10c Free: %d\n\
"));
+
+ if (0 < is_selinux_enabled ())
+ {
+ /* TRANSLATORS: This string uses format specifiers from
+ 'stat --help' with --file-system, and NOT from printf. */
+ char *temp = format;
+ format = xasprintf ("%s%s", format, _("\
+Context: %C\n\
+"));
+ free (temp);
+ }
}
}
else /* ! fs */
{
if (terse)
- format = xstrdup ("%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o\n");
+ {
+ if (0 < is_selinux_enabled ())
+ format = xstrdup ("%n %s %b %f %u %g %D %i %h %t %T"
+ " %X %Y %Z %W %o\n");
+ else
+ format = xstrdup ("%n %s %b %f %u %g %D %i %h %t %T"
+ " %X %Y %Z %W %o %C\n");
+ }
else
{
char *temp;
'stat --help' without --file-system, and NOT from printf. */
format = xasprintf ("%s%s", format, _("\
Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n\
+"));
+ free (temp);
+
+ if (0 < is_selinux_enabled ())
+ {
+ temp = format;
+ /* TRANSLATORS: This string uses format specifiers from
+ 'stat --help' without --file-system, and NOT from printf. */
+ format = xasprintf ("%s%s", format, _("\
+Context: %C\n\
+"));
+ free (temp);
+ }
+
+ temp = format;
+ /* TRANSLATORS: This string uses format specifiers from
+ 'stat --help' without --file-system, and NOT from printf. */
+ format = xasprintf ("%s%s", format, _("\
Access: %x\n\
Modify: %y\n\
Change: %z\n\