From 8d481d76a95497d19bd0cfa2eadce251e64cae6d Mon Sep 17 00:00:00 2001 From: Xin Ouyang Date: Thu, 17 Jan 2013 16:32:51 +0800 Subject: python: disable exit handler to rw history file oe-core adds a exit handler to rw python command history file (~/.python-history). There are no allow rules for every user&role to use create/read/write ~/.python-history, and it is also improper to add rules because these rules would blow up the user&role's scope of authority. So disable the handler, if selinux enabled. Signed-off-by: Xin Ouyang --- recipes-devtools/python/python/sitecustomize.py | 26 +++++++++++++++++++++++++ recipes-devtools/python/python_2.7.2.bbappend | 5 +++++ 2 files changed, 31 insertions(+) create mode 100644 recipes-devtools/python/python/sitecustomize.py create mode 100644 recipes-devtools/python/python_2.7.2.bbappend diff --git a/recipes-devtools/python/python/sitecustomize.py b/recipes-devtools/python/python/sitecustomize.py new file mode 100644 index 0000000..d2b71fa --- /dev/null +++ b/recipes-devtools/python/python/sitecustomize.py @@ -0,0 +1,26 @@ +# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer +# GPLv2 or later +# Version: 20081123 +# Features: +# * set proper default encoding +# Features removed for SELinux: +# * enable readline completion in the interactive interpreter +# * load command line history on startup +# * save command line history on exit + +import os + +def __enableDefaultEncoding(): + import sys + try: + sys.setdefaultencoding( "utf8" ) + except LookupError: + pass + +import sys +try: + import rlcompleter, readline +except ImportError: + pass +else: + __enableDefaultEncoding() diff --git a/recipes-devtools/python/python_2.7.2.bbappend b/recipes-devtools/python/python_2.7.2.bbappend new file mode 100644 index 0000000..b8447e9 --- /dev/null +++ b/recipes-devtools/python/python_2.7.2.bbappend @@ -0,0 +1,5 @@ +PR .= ".1" + +inherit selinux +# If selinux enabled, disable handlers to rw command history file +FILESEXTRAPATHS_prepend := "${@target_selinux(d, '${THISDIR}/${PN}:')}" -- cgit v1.2.3-54-g00ecf