There are currently 8 questions that libalpm may ask the user. Each of them has a "pacman default" and a "libalpm default". The pacman default is the response that gets used if the user presses enter without typing anything. Equivalently it is the response when --noconfirm is passed. The libalpm default is what happens when --print is passed and the question callback never even executes. This commit forces pacman to specify responses for --print and therefore never rely on the libalpm default. The following states how each question is handled: ALPM_QUESTION_INSTALL_IGNOREPKG: The pacman default is 1 and the libalpm default is 0. The latter was agreed to be a bug so we return 1 on print. ALPM_QUESTION_REPLACE_PKG: The pacman default is 1 and the libalpm default is 0. We return 0 on print. ALPM_QUESTION_CONFLICT_PKG: The pacman default is 0 and the libalpm default is 0. We return 0 on print even though print should not encounter this. ALPM_QUESTION_REMOVE_PKGS: The pacman default is 0 and the libalpm default is 0. We return 0 on print. ALPM_QUESTION_SELECT_PROVIDER: The pacman default is 0 and the libalpm default is 0. We return 0 on print. ALPM_QUESTION_LOCAL_NEWER: The pacman default is 1 and this is dead code so there is no libalpm default. We return 1 on print. ALPM_QUESTION_CORRUPTED_PKG: The pacman default is 1 and the libalpm default is 0. We return 0 on print even though print should not encounter this. ALPM_QUESTION_IMPORT_KEY: The pacman default is 1 and this is dead code so there is no libalpm default. We return 1 on print. Signed-off-by: Connor Behan <connor.behan@gmail.com> --- src/pacman/callback.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 71d9d04..d46cdbd 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -308,7 +308,16 @@ void cb_event(alpm_event_t event, void *data1, void *data2) void cb_question(alpm_question_t event, void *data1, void *data2, void *data3, int *response) { - if(config->print) { + if (config->print) { + switch(event) { + case ALPM_QUESTION_INSTALL_IGNOREPKG: + case ALPM_QUESTION_LOCAL_NEWER: + case ALPM_QUESTION_IMPORT_KEY: + *response = 1; + break; + default: + *response = 0; + } return; } switch(event) { -- 1.8.1.5