[OE-core] [PATCH] smartpm: Don't ignore error if RPM transaction fails without problems

Klauer, Daniel Daniel.Klauer at gin.de
Thu Jun 9 08:19:53 UTC 2016


Hello,

the case I encountered the original issue with was a partially broken RPM database, which allowed the "Computing transaction" to work, but failed at "Committing transaction" when installing a package.

To reproduce it, the RPM database can be broken intentionally:
# echo foo > /var/lib/rpm/Arch

Then try to install some package...
# smart install|reinstall|upgrade <package>


SmartPM output & exit code before the fix (commit 1dc5f5d5c844585eec114be9480e0e4d8e60d09c):


Loading cache...
...
Computing transaction...
...
Committing transaction...
Preparing...                    ######################################## [  0%]
   1:Installing <package>       ######################################## [100%]
Output from <package>-<version>@<arch>:
rpmdb: BDB0004 fop_read_meta: /var/lib/rpm/Arch: unexpected file type or format
error: cannot open Arch(1022) index: Invalid argument(22)
	DB: Berkeley DB 6.0.30: (January 23, 2014)

Saving cache...

# echo $?
0


And after the fix:


Loading cache...
...
Computing transaction...
...
Committing transaction...
Preparing...                    ######################################## [  0%]
   1:Installing <package>       ######################################## [100%]
Output from <package>-<version>@<arch>:
rpmdb: BDB0004 fop_read_meta: /var/lib/rpm/Arch: unexpected file type or format
error: cannot open Arch(1022) index: Invalid argument(22)
	DB: Berkeley DB 6.0.30: (January 23, 2014)
error: Unknown error

# echo $?
1


I've only ever tested this with breaking the Arch index database; perhaps the behaviour will be different when breaking another index, and most likely RPM will fail earlier when the main /var/lib/rpm/Packages database is broken. Either way, perhaps this can be used for a test case.

Regards,
Daniel


More information about the Openembedded-core mailing list