From 3e62a08342324031a1d992c700d20f3daf5e3dde Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 6 Feb 2015 16:20:01 +0000 Subject: [PATCH] * package_meta.h (packagemeta::trustp): Make sure that curr and installed exist before using them in version comparisons. Install exp over installed only if exp has a higher version number than installed. --- ChangeLog | 6 ++++++ package_meta.h | 16 +++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57780df4..7db6c628 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-02-06 Corinna Vinschen + + * package_meta.h (packagemeta::trustp): Make sure that curr and + installed exist before using them in version comparisons. Install exp + over installed only if exp has a higher version number than installed. + 2015-02-05 Corinna Vinschen Throughout, change preceeding patch from SHA256 to SHA512. diff --git a/package_meta.h b/package_meta.h index b9e1b5b5..696e9dd8 100644 --- a/package_meta.h +++ b/package_meta.h @@ -98,11 +98,17 @@ public: /* Are we looking for the default version and does the installed version have a higher version number than the "curr" package? This means the user has installed a "test" version, or built her own version newer - than "curr". Rather than pulling the user back to "curr", we stick to - "test" if a "test" version is available, or to "installed" if not. - This reflects the behaviour of `yum update' on Fedora. */ - if (_default && packageversion::compareVersions (curr, installed) < 0) - return exp ? exp : installed; + than "curr". Rather than pulling the user back to "curr", we install + "test" if a "test" version is available and the version number is higher, + or we stick to "installed" if not. This reflects the behaviour of + `yum update' on Fedora. */ + if (_default && curr && installed + && packageversion::compareVersions (curr, installed) < 0) + { + if (exp && packageversion::compareVersions (installed, exp) < 0) + return exp; + return installed; + } /* Otherwise, if a "curr" version exists, return "curr". */ if (curr) return curr; -- 2.43.5