-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEUEARECAAYFAk5D6sMACgkQrlYvE4MpobP8wQCfV6v8m1bJHB0bslapnJN92Bjb HD4Al0QLv/Q7V3FgGOpVST/uTCh/gbg= =MOpn -----END PGP SIGNATURE-----
>From f461b3ed6fb6efdcf72f15ea7b2951bb5e4f0571 Mon Sep 17 00:00:00 2001 From: Eric Paris <eparis@xxxxxxxxxx> Date: Mon, 18 Jul 2011 12:35:15 -0400 Subject: [PATCH 42/96] policycoreutils: semanage: surround getopt with try/except One of the getopt parsers didn't have a try/except pair to show usage when a user did it wrong. Fix that. Signed-off-by: Eric Paris <eparis@xxxxxxxxxx> --- policycoreutils/semanage/semanage | 56 +++++++++++++++++++----------------- 1 files changed, 30 insertions(+), 26 deletions(-) diff --git a/policycoreutils/semanage/semanage b/policycoreutils/semanage/semanage index 304a641..bcb4e7f 100644 --- a/policycoreutils/semanage/semanage +++ b/policycoreutils/semanage/semanage @@ -206,32 +206,36 @@ Object-specific Options (see above): args = argv[1:] - gopts, cmds = getopt.getopt(args, - '01adf:i:lhmnp:s:FCDR:L:r:t:P:S:M:', - ['add', - 'delete', - 'deleteall', - 'ftype=', - 'file', - 'help', - 'input=', - 'list', - 'modify', - 'noheading', - 'localist', - 'off', - 'on', - 'proto=', - 'seuser=', - 'store=', - 'range=', - 'locallist=', - 'level=', - 'roles=', - 'type=', - 'prefix=', - 'mask=' - ]) + try: + gopts, cmds = getopt.getopt(args, + '01adf:i:lhmnp:s:FCDR:L:r:t:P:S:M:', + ['add', + 'delete', + 'deleteall', + 'ftype=', + 'file', + 'help', + 'input=', + 'list', + 'modify', + 'noheading', + 'localist', + 'off', + 'on', + 'proto=', + 'seuser=', + 'store=', + 'range=', + 'locallist=', + 'level=', + 'roles=', + 'type=', + 'prefix=', + 'mask=' + ]) + except getopt.error, error: + usage(_("Options Error %s ") % error.msg) + for o, a in gopts: if o not in option_dict[object]: sys.stderr.write(_("%s not valid for %s objects\n") % ( o, object) ); -- 1.7.6
Attachment:
0042-policycoreutils-semanage-surround-getopt-with-try-ex.patch.sig
Description: PGP signature