GNU bug report logs - #17220
SELinux options in --help / manpage may be confusing

Previous Next

Package: coreutils;

Reported by: ovasik <at> redhat.com

Date: Tue, 8 Apr 2014 13:49:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17220 in the body.
You can then email your comments to 17220 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#17220; Package coreutils. (Tue, 08 Apr 2014 13:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ovasik <at> redhat.com:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 08 Apr 2014 13:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ondrej Vasik <ovasik <at> redhat.com>
To: CoreutilsBugs <bug-coreutils <at> gnu.org>
Subject: SELinux options in --help / manpage may be confusing
Date: Tue, 08 Apr 2014 15:47:35 +0200
Hi,
recently I got one bug report, asking about mknod not running correctly
with old syntax
mknod -m 666 -Z system_u:object_r:random_device_t:s0 /dev/random2 c 1 9
This is not a bug, as since 8.22, short version of -Z doesn't accept
optional arguments.

However, --help and manpage is a bit misleading. I think we should split
the lines for -Z and --context , as both are doing a bit different
thing.
-Z restores the default SELinux context
--context=[CTX] restores the default SELinux context if no CTX is
specified, otherwise sets the SELinux/SMACK context to CTX.

Now, with having them both on one lines, it gives user the feeling that
-Z accepts argument, which may lead to scripts errors. This is not only
about mknod, but about all utilities with -Z option (and recent change
in behaviour)

Thanks in advance for consideration!

Greetings,
         Ondrej





Information forwarded to bug-coreutils <at> gnu.org:
bug#17220; Package coreutils. (Tue, 08 Apr 2014 15:28:03 GMT) Full text and rfc822 format available.

Message #8 received at 17220 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: ovasik <at> redhat.com
Cc: 17220 <at> debbugs.gnu.org
Subject: Re: bug#17220: SELinux options in --help / manpage may be confusing
Date: Tue, 08 Apr 2014 16:27:44 +0100
On 04/08/2014 02:47 PM, Ondrej Vasik wrote:
> Hi,
> recently I got one bug report, asking about mknod not running correctly
> with old syntax
> mknod -m 666 -Z system_u:object_r:random_device_t:s0 /dev/random2 c 1 9
> This is not a bug, as since 8.22, short version of -Z doesn't accept
> optional arguments.
> 
> However, --help and manpage is a bit misleading. I think we should split
> the lines for -Z and --context , as both are doing a bit different
> thing.
> -Z restores the default SELinux context
> --context=[CTX] restores the default SELinux context if no CTX is
> specified, otherwise sets the SELinux/SMACK context to CTX.
> 
> Now, with having them both on one lines, it gives user the feeling that
> -Z accepts argument, which may lead to scripts errors. This is not only
> about mknod, but about all utilities with -Z option (and recent change
> in behaviour)
> 
> Thanks in advance for consideration!

Note the -o, --option[=optional long arg] is a very common
idiom in the coreutils' --help and thus man pages.
In the unusual case where a short option takes an optional arg we use:

  -w[BYTES], --width[=BYTES]  output BYTES bytes per output line;
                                32 is implied when BYTES is not specified


Though -Z, --context[=CTX] are slightly different concepts as you say
so we should split out the descriptions.

So currently we have this:

  -Z, --context[=CTX]  set the SELinux security context of NAME to
                         default type, or set the SELinux or SMACK
                         security context to CTX if specified


I'll push a patch that changes all utils along the lines of:


  -Z               set the SELinux security context of NAME to default type
  --context[=CTX]  likewise, or if CTX is specified then set the SELinux
                     or SMACK security context to CTX


cheers,
Pádraig.

p.s. for completeness, for mandatory args we use:

  -t, --format=TYPE           select output format or formats





Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Wed, 09 Apr 2014 13:19:02 GMT) Full text and rfc822 format available.

Notification sent to ovasik <at> redhat.com:
bug acknowledged by developer. (Wed, 09 Apr 2014 13:19:02 GMT) Full text and rfc822 format available.

Message #13 received at 17220-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: ovasik <at> redhat.com
Cc: 17220-done <at> debbugs.gnu.org
Subject: Re: bug#17220: SELinux options in --help / manpage may be confusing
Date: Wed, 09 Apr 2014 14:18:27 +0100
[Message part 1 (text/plain, inline)]
Will push the attached soon.

thanks,
Pádraig.
[context-clarification.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 08 May 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.