From d7093cd4e9873a637da1ea81facad09c2d735879 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 5 Jan 2006 12:38:07 +0100 Subject: * fix a indention that lead to absurdly large file in /etc/apt/apt.conf.d/10periodic --- SoftwareProperties/SoftwareProperties.py | 21 ++++++++++++--------- debian/changelog | 4 +++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index db9e3e26..3572e8e8 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -64,7 +64,7 @@ class SoftwareProperties(SimpleGladeApp): SimpleGladeApp.__init__(self, datadir+"glade/SoftwareProperties.glade", None, domain="update-manager") self.modified = False - + self.gnome_program = gnome.init("Software Properties", "0.41") self.gconfclient = gconf.client_get_default() @@ -156,25 +156,28 @@ class SoftwareProperties(SimpleGladeApp): self.write_config() def write_config(self): + #print "write_config()" periodic = "/etc/apt/apt.conf.d/10periodic" - + + # read the old content content = [] - if os.path.isfile(periodic): content = open(periodic, "r").readlines() - - cnf = apt_pkg.Config.SubTree("APT::Periodic") - f = open(periodic, "w+") + cnf = apt_pkg.Config.SubTree("APT::Periodic") + + # write a new file without the updated keys + f = open(periodic, "w") for line in content: found = False for key in cnf.List(): if line.find("APT::Periodic::%s" % (key)) >= 0: found = True break - if not found: - f.write(line) - + if not found: + f.write(line) + + # append the updated keys for i in cnf.List(): f.write("APT::Periodic::%s \"%s\";\n" % (i, cnf.FindI(i))) f.close() diff --git a/debian/changelog b/debian/changelog index b9c314d1..77c20978 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,10 @@ update-manager (0.40.2) dapper; urgency=low * SoftwareProperties/SoftwareProperties.py: - fix a problem with transient/parent window in custom apt line dialog (ubuntu #21585) + - fix a problem in the conf file writer that can lead to absurdly + large files - -- Michael Vogt Wed, 28 Dec 2005 14:19:06 +0100 + -- Michael Vogt Thu, 5 Jan 2006 12:37:33 +0100 update-manager (0.40.1) dapper; urgency=low -- cgit v1.2.3