Skip to contentSkip to conversation

Modify exception handling in semanage_migrate_store

PATCH In review Yuli Khodorkovskiy 2 participants 4 messages Oct 11, 2018 SELinux security module

lore
Share & tools
lore
#0 lore raw

v2 cover Modify exception handling in semanage_migrate_store

I'm resending this patch since it only made it to the new list before.

v2:
- No longer handle catching raw Exception.

Yuli Khodorkovskiy (1):
libsemanage: improve semanage_migrate_store import failure

 libsemanage/utils/semanage_migrate_store | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.19.0
#1 lore raw

PATCH v2 1/1 libsemanage: improve semanage_migrate_store import failure

From: Yuli Khodorkovskiy <[email protected]>

The selinux/semanage python module import error in semanage_migrate_store was misleading. Before, it would report that the selinux/semanage modules were not installed even though they were on the system.

Now the import failure is only reported if the modules are not installed. Otherwise, a stack trace is printed for all other errors in the selinux/semanage python modules.

---
 libsemanage/utils/semanage_migrate_store | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/utils/semanage_migrate_store +1 -1
index 2e6cb278..b789d042 100755
@@ -15,7 +15,7 @@ sepol = ctypes.cdll.LoadLibrary('libsepol.so.1')
 try:
 	import selinux
 	import semanage
-except:
+except ImportError:
 	print("You must install libselinux-python and libsemanage-python before running this tool", file=sys.stderr)
 	exit(1)
 
Signature · 1 line
2.19.0
#2 lore raw

Re: [PATCH v2 1/1] libsemanage: improve semanage_migrate_store import failure

Quoted 30 lines · Yuli Khodorkovskiy

From: Yuli Khodorkovskiy <[email protected]>

The selinux/semanage python module import error in semanage_migrate_store was misleading. Before, it would report that the selinux/semanage modules were not installed even though they were on the system.

Now the import failure is only reported if the modules are not installed. Otherwise, a stack trace is printed for all other errors in the selinux/semanage python modules.

---
 libsemanage/utils/semanage_migrate_store | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/utils/semanage_migrate_store +1 -2
index 2e6cb278..b789d042 100755
@@ -15,7 +15,7 @@ sepol = ctypes.cdll.LoadLibrary('libsepol.so.1')
 try:
        import selinux
        import semanage
-except:
+except ImportError:
        print("You must install libselinux-python and libsemanage-python before running this tool", file=sys.stderr)
        exit(1)
 
--
Quoted 2 lines

2.19.0

ack

Quoted 5 lines

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

#3 lore raw

Re: [PATCH v2 1/1] libsemanage: improve semanage_migrate_store import failure

Merged: https://github.com/SELinuxProject/selinux/pull/102

Sorry I got over-zealous and did this under the 24 hour requirement. Considering the
one liner and that v1 had review and no one objected to the change I don't see it as a big issue. My mistake.

Quoted 43 lines · William Roberts
Quoted 30 lines · Yuli Khodorkovskiy

From: Yuli Khodorkovskiy <[email protected]>

The selinux/semanage python module import error in semanage_migrate_store was misleading. Before, it would report that the selinux/semanage modules were not installed even though they were on the system.

Now the import failure is only reported if the modules are not installed. Otherwise, a stack trace is printed for all other errors in the selinux/semanage python modules.

---
 libsemanage/utils/semanage_migrate_store | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/utils/semanage_migrate_store +1 -2
index 2e6cb278..b789d042 100755
@@ -15,7 +15,7 @@ sepol = ctypes.cdll.LoadLibrary('libsepol.so.1')
 try:
        import selinux
        import semanage
-except:
+except ImportError:
        print("You must install libselinux-python and libsemanage-python before running this tool", file=sys.stderr)
        exit(1)
 
--
Quoted 2 lines

2.19.0

ack

Quoted 5 lines

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].