From ebbf0a1f0f75490dd7e8b7d717adc46888075e1e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 11 Sep 2009 16:30:27 +0200 Subject: id: don't print context=... when POSIXLY_CORRECT is set * src/id.c (print_full_info) [POSIXLY_CORRECT]: Don't print context. Reported by Ulrich Drepper. * 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. * tests/id/no-context: New file. Test for this. * tests/Makefile.am (TESTS): Add it. --- src/id.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/id.c b/src/id.c index b28643b18..ec255e2f8 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); } -- cgit v1.2.3-70-g09d2