mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
stat: drop %C support when printing file system details
* src/stat.c (print_statfs, usage): Drop %C, since it applies to files, not file systems. (out_file_context): Match style of other out_* functions. (print_stat): Update caller. * doc/coreutils.texi (stat invocation): Document %C. * NEWS: Document the change.
This commit is contained in:
1 parent
4c286d341a
commit
b7459696dc
3 files changed
+11
-11
No files matched your search
@@ -76,10 +76,14 @@ GNU coreutils NEWS -*- outline -*-
|
||||
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. Printing the
|
||||
SELinux context can be done with the %C format directive, and the
|
||||
default output when no format is specified now automatically
|
||||
SELinux context of a file 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 no longer accepts the %C directive when the --file-system
|
||||
option is in effect, since security context is a file attribute
|
||||
rather than a file system attribute.
|
||||
|
||||
stat now outputs the full sub-second resolution for the atime,
|
||||
mtime, and ctime values since the Epoch, when using the %X, %Y, and
|
||||
%Z directives of the --format option. This matches the fact that
|
||||
|
||||
@@ -10679,6 +10679,7 @@ The valid @var{format} directives for files with @option{--format} and
|
||||
@item %A - Access rights in human readable form
|
||||
@item %b - Number of blocks allocated (see @samp{%B})
|
||||
@item %B - The size in bytes of each block reported by @samp{%b}
|
||||
@item %C - The SELinux security context of a file, if available
|
||||
@item %d - Device number in decimal
|
||||
@item %D - Device number in hex
|
||||
@item %f - Raw mode in hex
|
||||
|
||||
+4
-9
@@ -513,11 +513,10 @@ out_uint_x (char *pformat, size_t prefix_len, uintmax_t arg)
|
||||
printf (pformat, arg);
|
||||
}
|
||||
|
||||
/* Very specialized function (modifies FORMAT), just so as to avoid
|
||||
duplicating this code between both print_statfs and print_stat.
|
||||
Return zero upon success, nonzero upon failure. */
|
||||
/* Print the context information of FILENAME, and return true iff the
|
||||
context could not be obtained. */
|
||||
static bool ATTRIBUTE_WARN_UNUSED_RESULT
|
||||
out_file_context (char const *filename, char *pformat, size_t prefix_len)
|
||||
out_file_context (char *pformat, size_t prefix_len, char const *filename)
|
||||
{
|
||||
char *scontext;
|
||||
bool fail = false;
|
||||
@@ -617,9 +616,6 @@ print_statfs (char *pformat, size_t prefix_len, char m, char const *filename,
|
||||
case 'd':
|
||||
out_int (pformat, prefix_len, statfsbuf->f_ffree);
|
||||
break;
|
||||
case 'C':
|
||||
fail |= out_file_context (filename, pformat, prefix_len);
|
||||
break;
|
||||
default:
|
||||
fputc ('?', stdout);
|
||||
break;
|
||||
@@ -846,7 +842,7 @@ print_stat (char *pformat, size_t prefix_len, char m,
|
||||
out_string (pformat, prefix_len, epoch_time (get_stat_ctime (statbuf)));
|
||||
break;
|
||||
case 'C':
|
||||
fail |= out_file_context (filename, pformat, prefix_len);
|
||||
fail |= out_file_context (pformat, prefix_len, filename);
|
||||
break;
|
||||
default:
|
||||
fputc ('?', stdout);
|
||||
@@ -1238,7 +1234,6 @@ Valid format sequences for file systems:\n\
|
||||
%c Total file nodes in file system\n\
|
||||
%d Free file nodes in file system\n\
|
||||
%f Free blocks in file system\n\
|
||||
%C SELinux security context string\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
%i File System ID in hex\n\
|
||||
|
||||
Reference in new issue
Block a user