Commit bf76fd9a authored by Gaute Hope's avatar Gaute Hope

use os.environ for setting and unsetting POSIXLY_CORRECT

os.putenv() and os.unsetenv() are not guaranteed to work, neither
does os.environ seem to be, but it appears to be safer.
parent ddfbd3a3
# dump.py - This just dumps crontab tasks with their info to stdout
# dump.py - This just dumps crontab tasks with their info to stdout
# Copyright (C) 2010 Gaute Hope <eg at gaute dot vetsj dot com>
#
# This program is free software; you can redistribute it and/or modify
......@@ -38,7 +38,7 @@ gettext.install(config.GETTEXT_PACKAGE(), config.GNOMELOCALEDIR(), unicode=1)
poscorrect_isset = os.getenv ("POSIXLY_CORRECT", False)
manual_poscorrect = False
if poscorrect_isset == False:
os.putenv ("POSIXLY_CORRECT", "enabled")
os.environ["POSIXLY_CORRECT"] = "enabled"
manual_poscorrect = True
uid = os.geteuid ()
......
......@@ -39,7 +39,7 @@ gettext.install(config.GETTEXT_PACKAGE(), config.GNOMELOCALEDIR(), unicode=1)
poscorrect_isset = os.getenv ("POSIXLY_CORRECT", False)
manual_poscorrect = False
if poscorrect_isset == False:
os.putenv ("POSIXLY_CORRECT", "enabled")
os.environ["POSIXLY_CORRECT"] = "enabled"
manual_poscorrect = True
sys.stderr.write(_("Gnome Schedule: Export tasks") + "\n")
......
......@@ -39,7 +39,7 @@ gettext.install(config.GETTEXT_PACKAGE(), config.GNOMELOCALEDIR(), unicode=1)
poscorrect_isset = os.getenv ("POSIXLY_CORRECT", False)
manual_poscorrect = False
if poscorrect_isset == False:
os.putenv ("POSIXLY_CORRECT", "enabled")
os.environ["POSIXLY_CORRECT"] = "enabled"
manual_poscorrect = True
......
......@@ -36,7 +36,7 @@ gettext.install(config.GETTEXT_PACKAGE(), config.GNOMELOCALEDIR(), unicode=1)
poscorrect_isset = os.getenv ("POSIXLY_CORRECT", False)
manual_poscorrect = False
if poscorrect_isset == False:
os.putenv ("POSIXLY_CORRECT", "enabled")
os.environ['POSIXLY_CORRECT'] = 'enabled'
manual_poscorrect = True
if __name__ == "__main__":
......
......@@ -714,7 +714,8 @@ class main:
os.chmod (path, stat.S_IEXEC | stat.S_IREAD)
# unset POSIXLY_CORRECT if manually set, bug 612459
if self.manual_poscorrect: os.unsetenv ('POSIXLY_CORRECT')
if self.manual_poscorrect:
del os.environ['POSIXLY_CORRECT']
# get terminal and exec params
terminal = None
......@@ -740,7 +741,8 @@ class main:
tex = terminal.strip () + ' ' + terminalparam.strip () + ' ' + execute
subprocess.Popen(tex, cwd = self.user_home_dir, shell=True)
if self.manual_poscorrect: os.putenv ('POSIXLY_CORRECT', 'enabled')
if self.manual_poscorrect:
os.environ['POSIXLY_CORRECT'] = 'enabled'
except Exception, ex:
......
......@@ -28,7 +28,7 @@ import mainWindow
poscorrect_isset = os.getenv ("POSIXLY_CORRECT", False)
manual_poscorrect = False
if poscorrect_isset == False:
os.putenv ("POSIXLY_CORRECT", "enabled")
os.environ["POSIXLY_CORRECT"] = "enabled"
manual_poscorrect = True
##
......
......@@ -34,8 +34,8 @@ gettext.install(config.GETTEXT_PACKAGE(), config.GNOMELOCALEDIR(), unicode=1)
def check_X (display, xauth):
# Checking if I can use X
os.putenv ('DISPLAY', display)
os.putenv ('XAUTHORITY', xauth)
os.environ['DISPLAY'] = display
os.environ['XAUTHORITY'] = xauth
try:
import pygtk
......@@ -64,7 +64,7 @@ def check_X (display, xauth):
poscorrect_isset = os.getenv ("POSIXLY_CORRECT", False)
manual_poscorrect = False
if poscorrect_isset == False:
os.putenv ("POSIXLY_CORRECT", "enabled")
os.environ["POSIXLY_CORRECT"] = "enabled"
manual_poscorrect = True
if (len (sys.argv) < 2):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment