From 0d4a8172a7bceac5bdca37cc199d9bfba889cc4f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Sep 2009 08:46:33 +0200 Subject: apt/progress/__init__.py: doc update --- apt/progress/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 337bd161..3a6b3f91 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -284,7 +284,11 @@ class InstallProgress(DumbInstallProgress): return os.fork() def waitChild(self): - """Wait for child progress to exit.""" + """Wait for child progress to exit. + + The return values is the full status returned from os.waitpid() + (not only the return code). + """ while True: try: select.select([self.statusfd], [], [], self.selectTimeout) -- cgit v1.2.3 From 2ca7c7acd3f47dc7da07fd8ad77df8c0c6c84735 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Sep 2009 15:01:01 +0200 Subject: * apt/progress/__init__.py: - catch exceptions in pm.DoInstall() --- apt/progress/__init__.py | 11 +++++++++-- debian/changelog | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 3a6b3f91..97090643 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -311,8 +311,15 @@ class InstallProgress(DumbInstallProgress): """Start installing.""" pid = self.fork() if pid == 0: - # child - res = pm.DoInstall(self.writefd) + # pm.DoInstall might raise a exception, + # when this happens, we need to catch + # it, otherwise os._exit() is not run + # and the execution continues in the + # parent code leading to very confusing bugs + try: + res = pm.DoInstall(self.writefd) + except Exception, e: + os._exit(pm.ResultFailed) os._exit(res) self.child_pid = pid res = self.waitChild() diff --git a/debian/changelog b/debian/changelog index ada400bb..3f23a368 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ python-apt (0.7.13.3) UNRELEASED; urgency=low - add actiongroup() method (backport from 0.7.92) - re-work the logic in commit() to fail if installArchives() returns a unexpected result + * apt/progress/__init__.py: + - catch exceptions in pm.DoInstall() [ Sebastian Heinlein ] * apt/package.py: -- cgit v1.2.3 From 7acb16fc4baa43cf2cbbc4de948973bdc099d878 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Sep 2009 15:21:23 +0200 Subject: apt/progress/__init__.py: doc string update for run() --- apt/progress/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 97090643..ca60810f 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -308,7 +308,11 @@ class InstallProgress(DumbInstallProgress): return res def run(self, pm): - """Start installing.""" + """Start installing. + + Returns the PackageManager status: + (pm.ResultCompleted, pm.ResultFailed, pm.ResultIncomplete) + """ pid = self.fork() if pid == 0: # pm.DoInstall might raise a exception, -- cgit v1.2.3 From 7fe83be76c6aac0778225a0106b46293d34543bf Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 10 Sep 2009 19:13:59 +0200 Subject: apt/progress/__init__.py: Correctly ignore ECHILD by checking before EINTR (Closes: #546007) As the check for != EINTR will re-raise the error, we have to check ECHILD before it. --- apt/progress/__init__.py | 4 ++-- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 337bd161..9f348ffd 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -297,10 +297,10 @@ class InstallProgress(DumbInstallProgress): if pid == self.child_pid: break except OSError, (errno_, errstr): - if errno_ != errno.EINTR: - raise if errno_ == errno.ECHILD: break + if errno_ != errno.EINTR: + raise return res def run(self, pm): diff --git a/debian/changelog b/debian/changelog index 6babe14c..6b0c2297 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,8 @@ python-apt (0.7.13.3) UNRELEASED; urgency=low the same behavior as in 0.7.92 * apt/package.py: - Use the source version instead of the binary version in fetch_source(). + * apt/progress/__init__.py: + - Correctly ignore ECHILD by checking before EINTR (Closes: #546007) -- Julian Andres Klode Fri, 28 Aug 2009 14:38:06 +0200 -- cgit v1.2.3