The following commit has been merged in the lenny branch:
commit c8d175fd5578a171f91c9d921efac237325232fb
Author: Guillem Jover <[EMAIL PROTECTED]>
Date:   Mon Nov 10 07:22:22 2008 +0200

    dpkg: untangle onerr_abort from too many errors condition
    
    Give the “too many errors” while processing packages or archives
    condition a different flag than the more serious onerr_abort condition
    from unrecoverable fatal errors.
    
    This is needed so that we can do a proper abort and stop dpkg completely
    in case of an actual fatal error, without affecting the normal loop
    processing error handling.

diff --git a/ChangeLog b/ChangeLog
index 5f5aaab..1a37fb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2008-11-14  Guillem Jover  <[EMAIL PROTECTED]>
 
+       * src/main.h (abort_processing): New variable declaration.
+       * src/errors.c (abort_processing): New variable definition.
+       * src/archives.c (print_error_perpackage): Use abort_processing
+       instead of onerr_abort for non fatal errors.
+       (reportbroken_retexitstatus): Likewise. Do not check onerr_abort
+       for the exit value as it should not have reached this function.
+       * src/packages.c (process_queue): Likewise. Return on entering if
+       it should abort processing.
+
+2008-11-14  Guillem Jover  <[EMAIL PROTECTED]>
+
        * lib/ehandle.c (run_error_handler): New function.
        (push_error_handler): Use run_error_handler instead of directly
        calling longjmp.
diff --git a/debian/changelog b/debian/changelog
index 1dca961..ff04be2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,10 @@ dpkg (1.14.23) UNRELEASED; urgency=low
     the including file.
   * Fix Dpkg::Version comparison code. Closes: #504135
 
+  [ Guillem Jover ]
+  * Untangle fatal abort condition from the “too many errors” one in the
+    archives and packages processing loop.
+
   [ Updated dpkg translations ]
   * Catalan (Jordi Mallach).
   * Greek (Emmanuel Galatoulas). Closes: #498585
diff --git a/src/archives.c b/src/archives.c
index 50ca034..a3807fd 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -1187,7 +1187,8 @@ void archivefiles(const char *const *argv) {
   while ((thisarg = *argp++) != NULL) {
     if (setjmp(ejbuf)) {
       error_unwind(ehflag_bombout);
-      if (onerr_abort > 0) break;
+      if (abort_processing)
+        break;
       continue;
     }
     push_error_handler(&ejbuf,print_error_perpackage,thisarg);
diff --git a/src/errors.c b/src/errors.c
index 83daa0f..1712904 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -39,6 +39,7 @@
 
 #include "main.h"
 
+int abort_processing = 0;
 int nerrs= 0;
 
 struct error_report {
@@ -61,7 +62,7 @@ void print_error_perpackage(const char *emsg, const char 
*arg) {
   nr= malloc(sizeof(struct error_report));
   if (!nr) {
     perror(_("dpkg: failed to allocate memory for new entry in list of failed 
packages."));
-    onerr_abort++;
+    abort_processing = 1;
     nr= &emergency;
   }
   nr->what= arg;
@@ -71,7 +72,7 @@ void print_error_perpackage(const char *emsg, const char 
*arg) {
     
   if (nerrs++ < errabort) return;
   fprintf(stderr, _("dpkg: too many errors, stopping\n"));
-  onerr_abort++;
+  abort_processing = 1;
 }
 
 int reportbroken_retexitstatus(void) {
@@ -82,10 +83,10 @@ int reportbroken_retexitstatus(void) {
       reports= reports->next;
     }
   }
-  if (onerr_abort) {
+  if (abort_processing) {
     fputs(_("Processing was halted because there were too many 
errors.\n"),stderr);
   }
-  return nerrs || onerr_abort ? 1 : 0;
+  return nerrs ? 1 : 0;
 }
 
 int skip_due_to_hold(struct pkginfo *pkg) {
diff --git a/src/main.h b/src/main.h
index 3713be0..6fbc289 100644
--- a/src/main.h
+++ b/src/main.h
@@ -102,6 +102,7 @@ extern int fc_nonroot, fc_overwritedir, fc_conff_new, 
fc_conff_miss;
 extern int fc_conff_old, fc_conff_def;
 extern int fc_badverify;
 
+extern int abort_processing;
 extern int errabort;
 extern const char *admindir;
 extern const char *instdir;
diff --git a/src/packages.c b/src/packages.c
index 993301f..9d215e9 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -170,6 +170,9 @@ void process_queue(void) {
   jmp_buf ejbuf;
   enum istobes istobe= itb_normal;
   
+  if (abort_processing)
+    return;
+
   clear_istobes();
 
   switch (cipaction->arg) {
@@ -228,7 +231,7 @@ void process_queue(void) {
       /* give up on it from the point of view of other packages, ie reset 
istobe */
       pkg->clientdata->istobe= itb_normal;
       error_unwind(ehflag_bombout);
-      if (onerr_abort > 0)
+      if (abort_processing)
         return;
       continue;
     }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to