lsvpd: Fix return code issue Below error was encountered while upgrading Ubuntu: Setting up lsvpd (1.7.5-0ubuntu2~14.04) ... vpdupdate is not supported on the PowerKVM pSeries Guest dpkg: error processing package lsvpd (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of ppc64-diag: ppc64-diag depends on lsvpd; however: Package lsvpd is not configured yet. dpkg: error processing package ppc64-diag (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: lsvpd ppc64-diag E: Sub-process /usr/bin/dpkg returned an error code (1) This patch fixes above configuration/unpacking issue by returning exit status (1) only when error is encountered while unpacking. This will allow Ubuntu to continue unpacking/configuring other packages instead of halting the whole upgrading process. Reported-by: Bharata B Rao Signed-off-by: Kamalesh Babulal Cc: Vasant Hegde [Fixed output across tools and added comment inside switch case - Vasant] Signed-off-by: Vasant Hegde --- --- lsvpd-1.7.5.orig/src/internal/updater.cpp +++ lsvpd-1.7.5/src/internal/updater.cpp @@ -82,15 +82,17 @@ int main( int argc, char** argv ) bool done = false; string idNode; int index = 0; - int rc; + int rc = 1; bool limitSCSISize = false; string platform = PlatformCollector::get_platform_name(); switch (PlatformCollector::platform_type) { - case PF_POWERKVM_PSERIES_GUEST: + case PF_POWERKVM_PSERIES_GUEST: /* Fall through */ + rc = 0; case PF_ERROR: - cout<< "vpdupdate is not supported on the " << platform << endl; - return 1; + cout<< "vpdupdate is not supported on the " << + platform << " platform" << endl; + return rc; } struct option longOpts [] = --- lsvpd-1.7.5.orig/src/output/lscfg.cpp +++ lsvpd-1.7.5/src/output/lscfg.cpp @@ -751,7 +751,7 @@ int main( int argc, char** argv ) bool compressed = false; System * root = NULL; VpdRetriever* vpd = NULL; - int index; + int index, rc = 1; struct option longOpts [] = { @@ -769,11 +769,12 @@ int main( int argc, char** argv ) string platform = PlatformCollector::get_platform_name(); switch (PlatformCollector::platform_type) { - case PF_POWERKVM_PSERIES_GUEST: + case PF_POWERKVM_PSERIES_GUEST: /* Fall through */ + rc = 0; case PF_ERROR: cout<< argv[0] << " is not supported on the " - << platform << endl; - return 1; + << platform << " platform" << endl; + return rc; } if (geteuid() != 0) { --- lsvpd-1.7.5.orig/src/output/lsmcode.cpp +++ lsvpd-1.7.5/src/output/lsmcode.cpp @@ -307,14 +307,17 @@ int main( int argc, char** argv ) bool compressed = false; System * root = NULL; VpdRetriever* vpd = NULL; - int index; + int index, rc = 1; string platform = PlatformCollector::get_platform_name(); switch (PlatformCollector::platform_type) { - case PF_POWERKVM_PSERIES_GUEST: - case PF_ERROR: - cout<< "lsmcode is not supported on the " << platform << endl; - return 1; + case PF_POWERKVM_PSERIES_GUEST: /* Fall through */ + rc = 0; + case PF_NULL: /* Fall through */ + case PF_ERROR: + cout<< "lsmcode is not supported on the " + << platform << " platform" << endl; + return rc; } struct option longOpts [] = --- lsvpd-1.7.5.orig/src/output/lsvio.cpp +++ lsvpd-1.7.5/src/output/lsvio.cpp @@ -213,16 +213,19 @@ int main( int argc, char** argv ) bool compressed = false; System * root = NULL; VpdRetriever* vpd = NULL; - int index; + int index, rc = 1; string platform = PlatformCollector::get_platform_name(); switch (PlatformCollector::platform_type) { - case PF_POWERKVM_PSERIES_GUEST: - case PF_POWERKVM_HOST: + case PF_POWERKVM_PSERIES_GUEST: /* Fall through */ + case PF_POWERKVM_HOST: /* Fall through */ + rc = 0; + case PF_NULL: /* Fall through */ case PF_ERROR: - cout<< "lsvio is not supported on the " << platform << endl; - return 1; + cout<< "lsvio is not supported on the " + << platform << " platform" << endl; + return rc; } struct option longOpts [] = --- lsvpd-1.7.5.orig/src/output/lsvpd.cpp +++ lsvpd-1.7.5/src/output/lsvpd.cpp @@ -398,15 +398,16 @@ int main( int argc, char** argv ) bool compressed = false; System * root = NULL; VpdRetriever* vpd = NULL; - int index; + int index, rc = 1; string platform = PlatformCollector::get_platform_name(); switch (PlatformCollector::platform_type) { - case PF_POWERKVM_PSERIES_GUEST: + case PF_POWERKVM_PSERIES_GUEST: /* Fall through */ + rc = 0; case PF_ERROR: cout<< "lsvpd is not supported on the " << platform << " platform" << endl; - return 1; + return rc; } struct option longOpts [] =