Sfoglia il codice sorgente

- fix parse error when dpkg sends unexpected data
* fix missing SetExecClose() call when the status-fd is used
* debian/apt.cron.daily:
- move unattended-upgrade before apt-get autoclean
* fix "purge" commandline argument, closes: #133421
(thanks to Julien Danjou for the patch)
* cmdline/apt-get.cc:
- do not change the auto-installed information if a package
is reinstalled
* apt-pkg/acquire-item.cc:
- fix crash in diff acquire code
* cmdline/apt-mark:
- Fix chmoding after have renamed the extended-states file (LP: #140019)
(thanks to Laurent Bigonville)
* apt-pkg/contrib/mmap.cc:
- don't fail if msync() returns > 0

Michael Vogt 19 anni fa
parent
commit
3346b38552

+ 1 - 1
README.arch

@@ -1,7 +1,7 @@
 
 
 You can build apt from arch, but this needs the following additional
 You can build apt from arch, but this needs the following additional
 packages (in addtion to the usual build-depends):
 packages (in addtion to the usual build-depends):
-xmlto perlsgml sgml2x sgmlspl docbook
+autoconf automake xmlto perlsgml sgml2x sgmlspl docbook
 
 
 then run:
 then run:
 
 

+ 1 - 1
apt-pkg/acquire-item.cc

@@ -345,7 +345,7 @@ void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash,
  */
  */
 pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
 pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
 				   string URI,string URIDesc,string ShortDesc,
 				   string URI,string URIDesc,string ShortDesc,
-				   HashString ExpectedMD5, 
+				   HashString ExpectedHash, 
 				   vector<DiffInfo> diffs)
 				   vector<DiffInfo> diffs)
    : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), 
    : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), 
      available_patches(diffs)
      available_patches(diffs)

+ 1 - 0
apt-pkg/contrib/hashes.h

@@ -20,6 +20,7 @@
 
 
 #include <algorithm>
 #include <algorithm>
 #include <vector>
 #include <vector>
+#include <cstring>
 
 
 using std::min;
 using std::min;
 using std::vector;
 using std::vector;

+ 2 - 2
apt-pkg/contrib/mmap.cc

@@ -117,7 +117,7 @@ bool MMap::Sync()
    
    
 #ifdef _POSIX_SYNCHRONIZED_IO   
 #ifdef _POSIX_SYNCHRONIZED_IO   
    if ((Flags & ReadOnly) != ReadOnly)
    if ((Flags & ReadOnly) != ReadOnly)
-      if (msync((char *)Base,iSize,MS_SYNC) != 0)
+      if (msync((char *)Base,iSize,MS_SYNC) < 0)
 	 return _error->Errno("msync","Unable to write mmap");
 	 return _error->Errno("msync","Unable to write mmap");
 #endif   
 #endif   
    return true;
    return true;
@@ -134,7 +134,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
 #ifdef _POSIX_SYNCHRONIZED_IO
 #ifdef _POSIX_SYNCHRONIZED_IO
    unsigned long PSize = sysconf(_SC_PAGESIZE);
    unsigned long PSize = sysconf(_SC_PAGESIZE);
    if ((Flags & ReadOnly) != ReadOnly)
    if ((Flags & ReadOnly) != ReadOnly)
-      if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0)
+      if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
 	 return _error->Errno("msync","Unable to write mmap");
 	 return _error->Errno("msync","Unable to write mmap");
 #endif   
 #endif   
    return true;
    return true;

+ 3 - 3
apt-pkg/deb/dpkgpm.cc

@@ -392,14 +392,14 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
    //        statusfd or by rewriting the code here to deal with
    //        statusfd or by rewriting the code here to deal with
    //        it. for now we just ignore it and not crash
    //        it. for now we just ignore it and not crash
    TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]));
    TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]));
-   char *pkg = list[1];
-   char *action = _strstrip(list[2]);
-   if( pkg == NULL || action == NULL) 
+   if( list[0] == NULL || list[1] == NULL || list[2] == NULL) 
    {
    {
       if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
       if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
 	 std::clog << "ignoring line: not enough ':'" << std::endl;
 	 std::clog << "ignoring line: not enough ':'" << std::endl;
       return;
       return;
    }
    }
+   char *pkg = list[1];
+   char *action = _strstrip(list[2]);
 
 
    if(strncmp(action,"error",strlen("error")) == 0)
    if(strncmp(action,"error",strlen("error")) == 0)
    {
    {

+ 21 - 1
apt-pkg/packagemanager.cc

@@ -25,7 +25,7 @@
     
     
 #include <apti18n.h>    
 #include <apti18n.h>    
 #include <iostream>
 #include <iostream>
-									/*}}}*/
+#include <fcntl.h> 
 
 
 using namespace std;
 using namespace std;
 
 
@@ -624,6 +624,26 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
    return Completed;
    return Completed;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/
+// ---------------------------------------------------------------------
+pkgPackageManager::OrderResult 
+pkgPackageManager::DoInstallPostFork(int statusFd)
+{
+      if(statusFd > 0)
+         // FIXME: use SetCloseExec here once it taught about throwing
+	 //        exceptions instead of doing _exit(100) on failure
+	 fcntl(statusFd,F_SETFD,FD_CLOEXEC); 
+      bool goResult = Go(statusFd);
+      if(goResult == false) 
+	 return Failed;
+
+      // if all was fine update the state file
+      if(Res == Completed) {
+	 Cache.writeStateFile(NULL);
+      }
+      return Res;
+};
+
 // PM::DoInstall - Does the installation				/*{{{*/
 // PM::DoInstall - Does the installation				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This uses the filenames in FileNames and the information in the
 /* This uses the filenames in FileNames and the information in the

+ 1 - 12
apt-pkg/packagemanager.h

@@ -90,18 +90,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    };
    };
 
 
    // stuff that needs to be done after the fork
    // stuff that needs to be done after the fork
-   OrderResult DoInstallPostFork(int statusFd=-1) {
-      bool goResult = Go(statusFd);
-      if(goResult == false) 
-	 return Failed;
-
-      // if all was fine update the state file
-      if(Res == Completed) {
-	 Cache.writeStateFile(NULL);
-      }
-      return Res;
-   };
-
+   OrderResult DoInstallPostFork(int statusFd=-1);
    bool FixMissing();
    bool FixMissing();
    
    
    pkgPackageManager(pkgDepCache *Cache);
    pkgPackageManager(pkgDepCache *Cache);

+ 5 - 1
cmdline/apt-get.cc

@@ -1708,7 +1708,8 @@ bool DoInstall(CommandLine &CmdL)
 	    // where foo is marked automatic
 	    // where foo is marked automatic
 	    if(!Remove && 
 	    if(!Remove && 
 	       Cache[Pkg].Install() == false && 
 	       Cache[Pkg].Install() == false && 
-	       (Cache[Pkg].Flags & pkgCache::Flag::Auto))
+	       (Cache[Pkg].Flags & pkgCache::Flag::Auto) &&
+	       _config->FindB("APT::Get::ReInstall",false) == false)
 	    {
 	    {
 	       ioprintf(c1out,_("%s set to manual installed.\n"),
 	       ioprintf(c1out,_("%s set to manual installed.\n"),
 			Pkg.Name());
 			Pkg.Name());
@@ -2471,6 +2472,7 @@ bool DoBuildDep(CommandLine &CmdL)
                            break;
                            break;
                  }
                  }
                  if (CV.end() == true)
                  if (CV.end() == true)
+		 {
 		   if (hasAlternatives)
 		   if (hasAlternatives)
 		   {
 		   {
 		      continue;
 		      continue;
@@ -2483,6 +2485,7 @@ bool DoBuildDep(CommandLine &CmdL)
                                            Last->BuildDepType((*D).Type),Src.c_str(),
                                            Last->BuildDepType((*D).Type),Src.c_str(),
                                            (*D).Package.c_str());
                                            (*D).Package.c_str());
 		   }
 		   }
+		 }
             }
             }
             else
             else
             {
             {
@@ -2752,6 +2755,7 @@ int main(int argc,const char *argv[])
                                    {"install",&DoInstall},
                                    {"install",&DoInstall},
                                    {"remove",&DoInstall},
                                    {"remove",&DoInstall},
 				   {"autoremove",&DoInstall},
 				   {"autoremove",&DoInstall},
+				   {"purge",&DoInstall},
                                    {"dist-upgrade",&DoDistUpgrade},
                                    {"dist-upgrade",&DoDistUpgrade},
                                    {"dselect-upgrade",&DoDSelectUpgrade},
                                    {"dselect-upgrade",&DoDSelectUpgrade},
 				   {"build-dep",&DoBuildDep},
 				   {"build-dep",&DoBuildDep},

+ 2 - 2
cmdline/apt-mark

@@ -40,7 +40,7 @@ if __name__ == "__main__":
     if not options.filename:
     if not options.filename:
         STATE_FILE = apt_pkg.Config.FindDir("Dir::State") + "extended_states"
         STATE_FILE = apt_pkg.Config.FindDir("Dir::State") + "extended_states"
     else:
     else:
-        STATE_FILE=options.state_file
+        STATE_FILE=options.filename
 
 
     # open the statefile
     # open the statefile
     if os.path.exists(STATE_FILE):
     if os.path.exists(STATE_FILE):
@@ -62,4 +62,4 @@ if __name__ == "__main__":
         # all done, rename the tmpfile
         # all done, rename the tmpfile
         os.chmod(outfile.name, 0644)
         os.chmod(outfile.name, 0644)
         os.rename(outfile.name, STATE_FILE)
         os.rename(outfile.name, STATE_FILE)
-        os.chmod(outfile.name, 0644)
+        os.chmod(STATE_FILE, 0644)

+ 6 - 6
debian/apt.cron.daily

@@ -186,17 +186,17 @@ if check_stamp $DOWNLOAD_UPGRADEABLE_STAMP $DownloadUpgradeableInterval; then
     update_stamp $DOWNLOAD_UPGRADEABLE_STAMP
     update_stamp $DOWNLOAD_UPGRADEABLE_STAMP
 fi
 fi
 
 
-AUTOCLEAN_STAMP=/var/lib/apt/periodic/autoclean-stamp
-if check_stamp $AUTOCLEAN_STAMP $AutocleanInterval; then
-    apt-get -qq autoclean
-    update_stamp $AUTOCLEAN_STAMP
-fi
-
 UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
 UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
 if check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
 if check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
     unattended-upgrade
     unattended-upgrade
     update_stamp $UPGRADE_STAMP
     update_stamp $UPGRADE_STAMP
 fi
 fi
 
 
+AUTOCLEAN_STAMP=/var/lib/apt/periodic/autoclean-stamp
+if check_stamp $AUTOCLEAN_STAMP $AutocleanInterval; then
+    apt-get -qq autoclean
+    update_stamp $AUTOCLEAN_STAMP
+fi
+
 # check cache size 
 # check cache size 
 check_size_constraints
 check_size_constraints

+ 18 - 0
debian/changelog

@@ -14,6 +14,7 @@ apt (0.7.7) UNRELEASED; urgency=low
     - merged dpkg-log branch, this lets you specify a 
     - merged dpkg-log branch, this lets you specify a 
       Dir::Log::Terminal file to log dpkg output to
       Dir::Log::Terminal file to log dpkg output to
       (ABI break)
       (ABI break)
+    - fix parse error when dpkg sends unexpected data
   * merged apt--sha256 branch to fully support the new
   * merged apt--sha256 branch to fully support the new
     sha256 checksums in the Packages and Release files
     sha256 checksums in the Packages and Release files
     (ABI break)
     (ABI break)
@@ -25,6 +26,19 @@ apt (0.7.7) UNRELEASED; urgency=low
     - increase MaxPipeDepth for the internal worker<->method
     - increase MaxPipeDepth for the internal worker<->method
       communication to 1000 for the debtorrent backend
       communication to 1000 for the debtorrent backend
   * make apt build with g++ 4.3
   * make apt build with g++ 4.3
+  * fix missing SetExecClose() call when the status-fd is used
+  * debian/apt.cron.daily:
+    - move unattended-upgrade before apt-get autoclean
+  * fix "purge" commandline argument, closes: #133421
+    (thanks to Julien Danjou for the patch)
+  * cmdline/apt-get.cc:
+    - do not change the auto-installed information if a package
+      is reinstalled
+  * apt-pkg/acquire-item.cc:
+    - fix crash in diff acquire code
+  * cmdline/apt-mark:
+    - Fix chmoding after have renamed the extended-states file (LP: #140019)
+      (thanks to Laurent Bigonville)
   
   
   [ Program translations ]
   [ Program translations ]
     - French updated
     - French updated
@@ -46,6 +60,10 @@ apt (0.7.7) UNRELEASED; urgency=low
   [ Ian Jackson ]
   [ Ian Jackson ]
   * dpkg-triggers: Deal properly with new package states.
   * dpkg-triggers: Deal properly with new package states.
 
 
+  [ Colin Watson ]
+  * apt-pkg/contrib/mmap.cc:
+    - don't fail if msync() returns > 0
+ 
  -- Otavio Salvador <otavio@debian.org>  Mon, 06 Aug 2007 10:44:53 -0300
  -- Otavio Salvador <otavio@debian.org>  Mon, 06 Aug 2007 10:44:53 -0300
 
 
 apt (0.7.6) unstable; urgency=low
 apt (0.7.6) unstable; urgency=low