semanage cleanup
I've given a few talks on SELinux over the past year and I've spoken to a bunch of people on google+ about SELinux and one topic keeps coming up. Many people find semanage to be large and convoluted with the help text being way to large to sort through. The latter part of the complaint is easy to address. The code for argument parsing in semanage (last time I checked) doesn't use things like argparse. If we switched it over to argparse we could get per sub-command help messages that would be more useful to people when they messed up a sub-command. Would anyone be opposed if I spent the time to migrate semanage argument parsing and help messages over to argparse or a similar library?
The second problem some people have is that semanage is a multiplexed command. I'm not sure what the right way to approach this is. If we look at other applications which are multiplexers we get a few examples. Busybox is the first example and covers most of the discussion. The two ways of invoking busybox is either busybox command_name arguments or command_name arguments where command_name is a symlink to the busybox binary. If we chose the latter way of handling it we would need to decide on one of two ways of naming the sub-commands. The first method would be to come up with a naming convention for the subcommands to avoid collisions like selogin for semanage login or seusers for semanage users etc. The second method would be to do what git use to do which is prepend the tool name onto the subcommand. For example semanage-fcontext, semanage-login, semanage-users etc... If we chose this route then we'd need to investigate what git's reason for moving away from it was and decide if it applies to our situation as well.
If we convert over to argparse for argument parsing it should be trivial to do some processing on argv[0] to extract out a subcommand from a name and use the correct routines. I'm not sure that solving the second problem gets us substantial gains or if having help messages that are specific to each subcommand will help users more.
Does anyone have any thoughts about this?
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Better help text is always a good thing, using a standard way of processing data is also good.
Semanage-fcontext doesn't seem to give any real benefit over "semanage fcontext" though.
Quoted 50 lines · David Quigley
I've given a few talks on SELinux over the past year and I've spoken to
a bunch of people on google+ about SELinux and one topic keeps coming up. Many people find semanage to be large and convoluted with the help text being way to large to sort through. The latter part of the complaint is easy to address. The code for argument parsing in semanage
(last time I checked) doesn't use things like argparse. If we switched it over to argparse we could get per sub-command help messages that would be more useful to people when they messed up a sub-command. Would
anyone be opposed if I spent the time to migrate semanage argument parsing and help messages over to argparse or a similar library?
The second problem some people have is that semanage is a multiplexed command. I'm not sure what the right way to approach this is. If we look
at other applications which are multiplexers we get a few examples. Busybox is the first example and covers most of the discussion. The twoways of invoking busybox is either busybox
command_namearguments orcommand_namearguments wherecommand_nameis a symlink to the busybox binary. If we chose the latter way of handling it we would need to decide on one of two ways of naming the sub-commands. The first method would be to come up with a naming convention for the subcommands to avoid collisions like selogin for semanage login or seusers for semanage
users etc. The second method would be to do what git use to do which isprepend the tool name onto the subcommand. For example semanage-fcontext, semanage-login, semanage-users etc... If we chose this route then we'd need to investigate what git's reason for moving away from it was and decide if it applies to our situation as well.
If we convert over to argparse for argument parsing it should be trivial to do some processing on argv[0] to extract out a subcommand from a name and use the correct routines. I'm not sure that solving the
second problem gets us substantial gains or if having help messages that
are specific to each subcommand will help users more.Does anyone have any thoughts about this?
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Signature · 2 lines
My blog http://etbe.coker.com.au Sent from an Xperia X10 Android phone with K-9 Mail.
Quoted 27 lines · David Quigley
I've given a few talks on SELinux over the past year and I've spoken to a bunch of people on google+ about SELinux and one topic keeps coming up. Many people find semanage to be large and convoluted with the help text being way to large to sort through. The latter part of the complaint is easy to address. The code for argument parsing in semanage (last time I checked) doesn't use things like argparse. If we switched it over to argparse we could get per sub-command help messages that would be more useful to people when they messed up a sub-command. Would anyone be opposed if I spent the time to migrate semanage argument parsing and help messages over to argparse or a similar library?
The second problem some people have is that semanage is a multiplexed command. I'm not sure what the right way to approach this is. If we look at other applications which are multiplexers we get a few examples. Busybox is the first example and covers most of the discussion. The two ways of invoking busybox is either busybox
command_namearguments orcommand_namearguments wherecommand_nameis a symlink to the busybox binary. If we chose the latter way of handling it we would need to decide on one of two ways of naming the sub-commands. The first method would be to come up with a naming convention for the subcommands to avoid collisions like selogin for semanage login or seusers for semanage users etc. The second method would be to do what git use to do which is prepend the tool name onto the subcommand. For example semanage-fcontext, semanage-login, semanage-users etc... If we chose this route then we'd need to investigate what git's reason for moving away from it was and decide if it applies to our situation as well.
Quoted 7 lines
If we convert over to argparse for argument parsing it should be trivial to do some processing on argv[0] to extract out a subcommand from a name and use the correct routines. I'm not sure that solving the second problem gets us substantial gains or if having help messages that are specific to each subcommand will help users more.
Does anyone have any thoughts about this?
I think having context-sensitive help (i.e. sub-command help) and improving the man page would be the best way of addressing it. I don't think splitting them out into separate programs is useful.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 42 lines · Stephen Smalley
Quoted 27 lines · David Quigley
I've given a few talks on SELinux over the past year and I've spoken to a bunch of people on google+ about SELinux and one topic keeps coming up. Many people find semanage to be large and convoluted with the help text being way to large to sort through. The latter part of the complaint is easy to address. The code for argument parsing in semanage (last time I checked) doesn't use things like argparse. If we switched it over to argparse we could get per sub-command help messages that would be more useful to people when they messed up a sub-command. Would anyone be opposed if I spent the time to migrate semanage argument parsing and help messages over to argparse or a similar library?
The second problem some people have is that semanage is a multiplexed command. I'm not sure what the right way to approach this is. If we look at other applications which are multiplexers we get a few examples. Busybox is the first example and covers most of the discussion. The two ways of invoking busybox is either busybox
command_namearguments orcommand_namearguments wherecommand_nameis a symlink to the busybox binary. If we chose the latter way of handling it we would need to decide on one of two ways of naming the sub-commands. The first method would be to come up with a naming convention for the subcommands to avoid collisions like selogin for semanage login or seusers for semanage users etc. The second method would be to do what git use to do which is prepend the tool name onto the subcommand. For example semanage-fcontext, semanage-login, semanage-users etc... If we chose this route then we'd need to investigate what git's reason for moving away from it was and decide if it applies to our situation as well.Quoted 7 lines
If we convert over to argparse for argument parsing it should be trivial to do some processing on argv[0] to extract out a subcommand from a name and use the correct routines. I'm not sure that solving the second problem gets us substantial gains or if having help messages that are specific to each subcommand will help users more.
Does anyone have any thoughts about this?
I think having context-sensitive help (i.e. sub-command help) and improving the man page would be the best way of addressing it. I don't think splitting them out into separate programs is useful.
Quoted 6 lines
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Yea I don't think separating out the commands will really gain us much. I wonder though if separating the man pages might though. Git man pages are still given to you as git-clone or git-commit etc. There could be an semanage manpage which has the man pages for the specific commands as semanage-fcontext etc. Not sure we have enough information to make it worth it. It would be possible to have a more indepth discussion in the man pages about examples and usage if they weren't all crammed into one.
Dave
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 1 line · Dave Quigley
Yea I don't think separating out the commands will really gain us much. I
wonder though if separating the man pages might though. Git man pages are still given to you as git-clone or git-commit etc. There could be an semanage manpage which has the man pages for the specific commands as semanage-fcontext etc. Not sure we have enough information to make it worth it. It would be possible to have a more indepth discussion in the man pages about examples and usage if they weren't all crammed into one.
FWIW, I think that model (one command, separate subcommand man pages) has worked well for openssl.
-kevin
Quoted 10 lines · Kevin W. Wall
Quoted 1 line · Dave Quigley
Yea I dont think separating out the commands will really gain us
much. I wonder though if separating the man pages might though. Git man pages are still given to you as git-clone or git-commit etc. There could be an semanage manpage which has the man pages for the specific commands as semanage-fcontext etc. Not sure we have enough information to make it worth it. It would be possible to have a more indepth discussion in the man pages about examples and usage if they werent all crammed into one.
Quoted 4 lines
FWIW, I think that model (one command, separate subcommand man pages) has worked well for openssl.
-kevin
I Haven't typed in all of the help info yet but the link is to a pastbin with the usage information for the semanage login subcommand. I just need to get it do react that way when there are 0 arguments passed in as well. Right now it will print this when you type semanage login -h or --help. I want it to print this on semanage login with no arguments as well.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.