Sfoglia il codice sorgente

Merged with Michael

bubulle@debian.org 19 anni fa
parent
commit
5745571310

+ 9 - 19
apt-pkg/deb/debsrcrecords.cc

@@ -18,6 +18,8 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+
+using std::max;
 									/*}}}*/
 
 // SrcRecordParser::Binaries - Return the binaries field		/*{{{*/
@@ -34,31 +36,19 @@ const char **debSrcRecordParser::Binaries()
    if (Bins.empty() == true || Bins.length() >= 102400)
       return 0;
    
-   // Workaround for #236688.  Only allocate a new buffer if the field
-   // is large, to avoid a performance penalty
-   char *BigBuf = NULL;
-   char *Buf;
-   if (Bins.length() > sizeof(Buffer))
-   {
-      BigBuf = new char[Bins.length()];
-      Buf = BigBuf;
-   }
-   else
+   if (Bins.length() >= BufSize)
    {
-      Buf = Buffer;
+      delete [] Buffer;
+      // allocate new size based on buffer (but never smaller than 4000)
+      BufSize = max((unsigned long)4000, max(Bins.length()+1,2*BufSize));
+      Buffer = new char[BufSize];
    }
 
-   strcpy(Buf,Bins.c_str());
-   if (TokSplitString(',',Buf,StaticBinList,
+   strcpy(Buffer,Bins.c_str());
+   if (TokSplitString(',',Buffer,StaticBinList,
 		      sizeof(StaticBinList)/sizeof(StaticBinList[0])) == false)
-   {
-      if (BigBuf != NULL)
-         delete BigBuf;
       return 0;
-   }
 
-   if (BigBuf != NULL)
-      delete BigBuf;
    return (const char **)StaticBinList;
 }
 									/*}}}*/

+ 5 - 5
apt-pkg/deb/debsrcrecords.h

@@ -24,9 +24,10 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    FileFd Fd;
    pkgTagFile Tags;
    pkgTagSection Sect;
-   char Buffer[10000];
    char *StaticBinList[400];
    unsigned long iOffset;
+   char *Buffer;
+   unsigned long BufSize;
    
    public:
 
@@ -49,10 +50,9 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    };
    virtual bool Files(vector<pkgSrcRecords::File> &F);
 
-   debSrcRecordParser(string File,pkgIndexFile const *Index) :
-                   Parser(Index),      
-                   Fd(File,FileFd::ReadOnly),
-                   Tags(&Fd,102400) {};
+   debSrcRecordParser(string File,pkgIndexFile const *Index) 
+      : Parser(Index), Fd(File,FileFd::ReadOnly), Tags(&Fd,102400), 
+        Buffer(0), BufSize(0) {}
 };
 
 #endif

+ 16 - 7
apt-pkg/deb/dpkgpm.cc

@@ -711,14 +711,23 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       // Check for an error code.
       if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
       {
-	 RunScripts("DPkg::Post-Invoke");
-	 if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV)
-	    return _error->Error("Sub-process %s received a segmentation fault.",Args[0]);
-
-	 if (WIFEXITED(Status) != 0)
-	    return _error->Error("Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
+	 // if it was set to "keep-dpkg-runing" then we won't return
+	 // here but keep the loop going and just report it as a error
+	 // for later
+	 bool stopOnError = _config->FindB("Dpkg::StopOnError",true);
 	 
-	 return _error->Error("Sub-process %s exited unexpectedly",Args[0]);
+	 if(stopOnError)
+	    RunScripts("DPkg::Post-Invoke");
+
+	 if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) 
+	    _error->Error("Sub-process %s received a segmentation fault.",Args[0]);
+	 else if (WIFEXITED(Status) != 0)
+	    _error->Error("Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
+	 else 
+	    _error->Error("Sub-process %s exited unexpectedly",Args[0]);
+
+	 if(stopOnError)
+	    return false;
       }      
    }
 

+ 33 - 1
debian/changelog

@@ -1,10 +1,42 @@
+apt (0.6.46.4) unstable; urgency=low
+
+  * added apt-secure.8 to "See also" section
+  * apt-pkg/deb/dpkgpm.cc:
+    - added "Dpkg::StopOnError" variable that controls if apt
+      will abort on errors from dpkg
+  * apt-pkg/deb/debsrcrecords.{cc,h}:
+    - make the Buffer grow dynmaically (closes: #400874)
+  * Merged from Christian Perrier bzr branch:
+    - uk.po: New Ukrainian translation: 483t28f3u
+    - el.po: Update to 503t9f2u
+    - de.po: Updates and corrections.
+
+ --
+
 apt (0.6.46.3) unstable; urgency=low
 
   * apt-pkg/deb/dpkgpm.cc:
     - make progress reporting robust against multiline error
       messages 
 
- --
+  * Merged from Christian Perrier bzr branch:
+     - ca.po: Updated to 514t
+     - be.po: Updated to 514t
+     - it.po: Updated to 514t
+     - hu.po: Updated to 514t
+     - zh_TW.po: Updated to 514t
+     - ar.po: Updated to 293t221u.
+     - ru.po: Updated to 514t. Closes: #392466
+     - nb.po: Updated to 514t. Closes: #392466
+     - pt.po: Updated to 514t. Closes: #393199
+     - fr.po: One spelling error corrected: s/accèder/accéder
+     - km.po: Updated to 514t.
+     - ko.po: Updated to 514t.
+     - bg.po: Updated to 514t.
+     - de.po: Updated to 514t.
+     - en_GB.po: Updated to 514t.
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 2 Nov 2006 11:37:58 +0100 
 
 apt (0.6.46.2) unstable; urgency=low
 

+ 1 - 1
doc/apt-get.8.xml

@@ -467,7 +467,7 @@
 
  <refsect1><title>See Also</title>
    <para>&apt-cache;, &apt-cdrom;, &dpkg;, &dselect;, &sources-list;,
-   &apt-conf;, &apt-config;,
+   &apt-conf;, &apt-config;, &apt-secure;, 
    The APT User's guide in &guidesdir;, &apt-preferences;, the APT Howto.</para>
  </refsect1>
 

+ 2 - 1
doc/apt.8

@@ -32,7 +32,8 @@ None.
 .BR apt-cache (8),
 .BR apt-get (8),
 .BR apt.conf (5),
-.BR sources.list (5)
+.BR sources.list (5),
+.BR apt-secure (8)
 .SH DIAGNOSTICS
 apt returns zero on normal operation, decimal 100 on error.
 .SH BUGS

+ 4 - 0
doc/examples/configure-index

@@ -237,6 +237,10 @@ DPkg
    // Control the size of the command line passed to dpkg.
    MaxBytes 1024;
    MaxArgs 350;
+
+   // controls if apt will apport on the first dpkg error or if it 
+   // tries to install as many packages as possible
+   StopOnError "true";
 }
 
 /* Options you can set to see some debugging text They correspond to names