Here's a small change to make id's output (when invoked with no options) conform, when POSIXLY_CORRECT is set: >From ba31e0ce90c64b24cd10c538ddf884ce63b0abf2 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@xxxxxxxxxx> Date: Fri, 11 Sep 2009 16:30:27 +0200 Subject: [PATCH] id: don't print context if POSIXLY_CORRECT is set * src/id.c (print_full_info) [POSIXLY_CORRECT]: Don't print context. * NEWS (Changes in behavior): Mention it. * doc/coreutils.texi (id invocation): Document that id also prints the security context, when possible, and when POSIXLY_CORRECT is not set. Reported by Ulrich Drepper. --- NEWS | 5 +++++ doc/coreutils.texi | 4 ++++ src/id.c | 5 ++++- 3 files changed, 13 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS index 6cfe8bb..b3c6c8c 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ GNU coreutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** Changes in behavior + + id no longer prints SELinux " context=..." when the POSIXLY_CORRECT + environment variable is set. + ** Improvements rm: rewrite to use gnulib's fts diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 22d307a..b065194 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -12825,9 +12825,13 @@ id invocation id [@var{option}]@dots{} [@var{username}] @end example +@vindex POSIXLY_CORRECT By default, it prints the real user ID, real group ID, effective user ID if different from the real user ID, effective group ID if different from the real group ID, and supplemental group IDs. +In addition, if SELinux +is enabled and the @env{POSIXLY_CORRECT} environment variable is not set, +then print @samp{context=@var{C}}, where @var{C} is the security context. Each of these numeric values is preceded by an identifying string and followed by the corresponding user or group name in parentheses. diff --git a/src/id.c b/src/id.c index b28643b..ec255e2 100644 --- a/src/id.c +++ b/src/id.c @@ -328,6 +328,9 @@ print_full_info (const char *username) free (groups); } #endif /* HAVE_GETGROUPS */ - if (context != NULL) + + /* POSIX mandates the precise output format, and that it not include + any context=... part, so skip that if POSIXLY_CORRECT is set. */ + if (context != NULL && ! getenv ("POSIXLY_CORRECT")) printf (_(" context=%s"), context); } -- 1.6.5.rc0.164.g5f6b0 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with the words "unsubscribe selinux" without quotes as the message.