commit f7f3177619e022e3657bd9255c544a75da3f0e1c Author: Richard Hughes Date: Fri Aug 29 09:41:00 2008 +0100 bugfix: check the install_files() input to see if it exists before we try to process it. Fixes fd#17350 diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py index 3a3f4c0..0ec2dfe 100644 --- a/backends/yum/helpers/yumBackend.py +++ b/backends/yum/helpers/yumBackend.py @@ -866,6 +866,12 @@ class PackageKitYumBackend(PackageKitBaseBackend): self.percentage(0) self.status(STATUS_RUNNING) + # check that the files still exist + for inst_file in inst_files: + if not os.path.exists(inst_file): + self.error(ERROR_FILE_NOT_FOUND,'%s could not be found' % inst_file) + return + # process these first tempdir = tempfile.mkdtemp() inst_packs = [] @@ -893,7 +899,7 @@ class PackageKitYumBackend(PackageKitBaseBackend): to_remove = [] - # remove files of packages that alrady exist + # remove files of packages that already exist for inst_file in inst_files: try: pkg = YumLocalPackage(ts=self.yumbase.rpmdb.readOnlyTS(), filename=inst_file) diff --git a/docs/api/spec/pk-concepts.xml b/docs/api/spec/pk-concepts.xml index 3a12bce..9c44d61 100644 --- a/docs/api/spec/pk-concepts.xml +++ b/docs/api/spec/pk-concepts.xml @@ -511,7 +511,12 @@ The downloaded package is corrupt. - + + file-not-found + + The file could not be found on the system. + + diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c index d3909d0..e2a8fea 100644 --- a/libpackagekit/pk-enum.c +++ b/libpackagekit/pk-enum.c @@ -159,6 +159,7 @@ static PkEnumMatch enum_error[] = { {PK_ERROR_ENUM_PACKAGE_INSTALL_BLOCKED, "package-install-blocked"}, {PK_ERROR_ENUM_PACKAGE_CORRUPT, "package-corrupt"}, {PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED, "all-packages-already-installed"}, + {PK_ERROR_ENUM_FILE_NOT_FOUND, "file-not-found"}, {0, NULL} }; diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h index 5628218..05ffee8 100644 --- a/libpackagekit/pk-enum.h +++ b/libpackagekit/pk-enum.h @@ -265,6 +265,7 @@ typedef enum { PK_ERROR_ENUM_PACKAGE_INSTALL_BLOCKED, PK_ERROR_ENUM_PACKAGE_CORRUPT, PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED, + PK_ERROR_ENUM_FILE_NOT_FOUND, PK_ERROR_ENUM_UNKNOWN } PkErrorCodeEnum;