Historical bug tracker for the Pacman package manager.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
FS#23732 - [libalpm] can't commit empty transactions (alpm_trans_prepare rejects them w/o error code)
Attached to Project:
Pacman
Opened by Rémy Oudompheng (remyoudompheng) - Tuesday, 12 April 2011, 22:46 GMT
Opened by Rémy Oudompheng (remyoudompheng) - Tuesday, 12 April 2011, 22:46 GMT
|
DetailsSummary and Info:
Comments in the code suggest that the following behaviour is a feature: alpm_trans_prepare() will silently exit without setting any error when receiving an empty transaction. *However* it will not mark the transaction as prepared. This triggers an error when trying to commit the transaction. Suggested possible changes: * mark empty transactions as prepared * return -1 and set errno to say "empty transactions are invalid" Steps to Reproduce: * write naïve code like this: alpm_trans_init(0, NULL, NULL, NULL); /* do nothing */ int ret = alpm_trans_prepare(NULL) if (ret != 0) return; alpm_trans_commit(NULL) alpm_trans_release(); return; |
This task depends upon
Line 199 in trans.c (on branch "master") says "If there's nothing to do, return without complaining", so I believe it was somewhat intended in the first place.
8ff3b870 lib/libalpm/trans.c (Xavier Chantry 2009-07-15 19:14:01 +0200 251) if(trans->add == NULL && trans->remove == NULL) {
0303b26b lib/libalpm/trans.c (Dan McGee 2011-03-20 19:45:57 -0500 252) return 0;
04e054f3 lib/libalpm/trans.c (Aurelien Foret 2005-04-06 18:25:33 +0000 253) }
You're looking at a quite old comment; I'd say fix the behavior as you see appropriate in this case. It looks like trans_commit() has the same little sanity check, so one one also need to advance the stage there as well if you were to go with your first suggestion.