[pacman-dev] [PATCH] Exit with failure status if download or installation is not confirmed
Original: https://github.com/vadmium/pacman-arch/commit/a1776b6.patch
From a1776b648faf36e1f1e88f5ee6cfca63af8fec3c Mon Sep 17 00:00:00 2001 From: Martin Panter <vadmium à gmail·com> Date: Tue, 23 Oct 2012 13:32:56 +0000 Subject: [PATCH] Exit with failure status if download or installation is not confirmed
--- src/pacman/sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 3decc40..417773d 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -871,6 +871,7 @@ int sync_prepare_execute(void) confirm = yesno(_("Proceed with installation?")); } if(!confirm) { + retval = 1; goto cleanup; } -- 1.7.10
On 02/02/13 15:26, Martin Panter wrote:
Original: https://github.com/vadmium/pacman-arch/commit/a1776b6.patch
From a1776b648faf36e1f1e88f5ee6cfca63af8fec3c Mon Sep 17 00:00:00 2001 From: Martin Panter <vadmium à gmail·com> Date: Tue, 23 Oct 2012 13:32:56 +0000 Subject: [PATCH] Exit with failure status if download or installation is not confirmed
---
Put comments like the "Original: ..." under the three hyphens here. I do not think exiting with a failure state is correct here. The program has not failed in anyway, it was just aborted by the user.
src/pacman/sync.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 3decc40..417773d 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -871,6 +871,7 @@ int sync_prepare_execute(void) confirm = yesno(_("Proceed with installation?")); } if(!confirm) { + retval = 1; goto cleanup; }
On 2 February 2013 05:35, Allan McRae <allan@archlinux.org> wrote:
On 02/02/13 15:26, Martin Panter wrote:
Original: https://github.com/vadmium/pacman-arch/commit/a1776b6.patch
From a1776b648faf36e1f1e88f5ee6cfca63af8fec3c Mon Sep 17 00:00:00 2001 From: Martin Panter <vadmium à gmail·com> Date: Tue, 23 Oct 2012 13:32:56 +0000 Subject: [PATCH] Exit with failure status if download or installation is not confirmed
---
Put comments like the "Original: ..." under the three hyphens here.
Sorry, will try that next time :)
I do not think exiting with a failure state is correct here. The program has not failed in anyway, it was just aborted by the user.
I used to call Pacman from a script, and from the point of view of the script, if Pacman didn’t end up installing the packages it was asked to, for whatever reason, the script needed to know about it. The workaround was to hit control-C instead of N. I though exit status of 1 might be okay, because it seems to already be returned in similar user interaction cases, e.g. “gcc and gcc-multilib are in conflict. Remove gcc-multilib? [y/N] n”.
src/pacman/sync.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 3decc40..417773d 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -871,6 +871,7 @@ int sync_prepare_execute(void) confirm = yesno(_("Proceed with installation?")); } if(!confirm) { + retval = 1; goto cleanup; }
On 02/02/13 15:50, Martin Panter wrote:
On 2 February 2013 05:35, Allan McRae <allan@archlinux.org> wrote:
On 02/02/13 15:26, Martin Panter wrote:
Original: https://github.com/vadmium/pacman-arch/commit/a1776b6.patch
From a1776b648faf36e1f1e88f5ee6cfca63af8fec3c Mon Sep 17 00:00:00 2001 From: Martin Panter <vadmium à gmail·com> Date: Tue, 23 Oct 2012 13:32:56 +0000 Subject: [PATCH] Exit with failure status if download or installation is not confirmed
---
Put comments like the "Original: ..." under the three hyphens here.
Sorry, will try that next time :)
I do not think exiting with a failure state is correct here. The program has not failed in anyway, it was just aborted by the user.
I used to call Pacman from a script, and from the point of view of the script, if Pacman didn’t end up installing the packages it was asked to, for whatever reason, the script needed to know about it. The workaround was to hit control-C instead of N. I though exit status of 1 might be okay, because it seems to already be returned in similar user interaction cases, e.g. “gcc and gcc-multilib are in conflict. Remove gcc-multilib? [y/N] n”.
Hrmm... I see that as a different "error". One is pacman can not complete the transaction because of not being able to resolved conflicts. The other case is pacman not finishing because the users specifically told it to stop. @ Dan, Dave: Any opinion here? Allan
participants (2)
-
Allan McRae
-
Martin Panter