]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
hide first pdiff merge failure debug message
[apt.git] / apt-pkg / acquire-worker.cc
index 64df3c80fe13456734c86ea1e5d94f1fd6f141a8..bee01e6200777c5b2a5a6793b05b0cc63d5c91db 100644 (file)
@@ -34,6 +34,9 @@
 #include <signal.h>
 #include <stdio.h>
 #include <errno.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
 
 #include <apti18n.h>
                                                                        /*}}}*/
@@ -306,7 +309,10 @@ bool pkgAcquire::Worker::RunMessages()
            
            pkgAcquire::Item *Owner = Itm->Owner;
            pkgAcquire::ItemDesc Desc = *Itm;
-           
+
+           if (RealFileExists(Owner->DestFile))
+              ChangeOwnerAndPermissionOfFile("201::URIDone", Owner->DestFile.c_str(), "root", "root", 0644);
+
            // Display update before completion
            if (Log != 0 && Log->MorePulses == true)
               Log->Pulse(Owner->GetOwner());
@@ -326,28 +332,28 @@ bool pkgAcquire::Worker::RunMessages()
                               Owner->DestFile.c_str(), LookupTag(Message,"Size","0").c_str(),TotalSize);
 
            // see if there is a hash to verify
-           HashStringList RecivedHashes;
+           HashStringList ReceivedHashes;
            HashStringList expectedHashes = Owner->HashSums();
            for (HashStringList::const_iterator hs = expectedHashes.begin(); hs != expectedHashes.end(); ++hs)
            {
               std::string const tagname = hs->HashType() + "-Hash";
               std::string const hashsum = LookupTag(Message, tagname.c_str());
               if (hashsum.empty() == false)
-                 RecivedHashes.push_back(HashString(hs->HashType(), hashsum));
+                 ReceivedHashes.push_back(HashString(hs->HashType(), hashsum));
            }
 
            if(_config->FindB("Debug::pkgAcquire::Auth", false) == true)
            {
               std::clog << "201 URI Done: " << Owner->DescURI() << endl
-                 << "RecivedHash:" << endl;
-              for (HashStringList::const_iterator hs = RecivedHashes.begin(); hs != RecivedHashes.end(); ++hs)
+                 << "ReceivedHash:" << endl;
+              for (HashStringList::const_iterator hs = ReceivedHashes.begin(); hs != ReceivedHashes.end(); ++hs)
                  std::clog <<  "\t- " << hs->toStr() << std::endl;
               std::clog << "ExpectedHash:" << endl;
               for (HashStringList::const_iterator hs = expectedHashes.begin(); hs != expectedHashes.end(); ++hs)
                  std::clog <<  "\t- " << hs->toStr() << std::endl;
               std::clog << endl;
            }
-           Owner->Done(Message, ServerSize, RecivedHashes, Config);
+           Owner->Done(Message, ServerSize, ReceivedHashes, Config);
            ItemDone();
 
            // Log that we are done
@@ -379,9 +385,13 @@ bool pkgAcquire::Worker::RunMessages()
            // Display update before completion
            if (Log != 0 && Log->MorePulses == true)
               Log->Pulse(Itm->Owner->GetOwner());
-           
+
            pkgAcquire::Item *Owner = Itm->Owner;
            pkgAcquire::ItemDesc Desc = *Itm;
+
+           if (RealFileExists(Owner->DestFile))
+              ChangeOwnerAndPermissionOfFile("400::URIFailure", Owner->DestFile.c_str(), "root", "root", 0644);
+
            OwnerQ->ItemDone(Itm);
 
            // set some status
@@ -542,7 +552,14 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item)
    }
    Message += Item->Owner->Custom600Headers();
    Message += "\n\n";
-   
+
+   if (RealFileExists(Item->Owner->DestFile))
+   {
+      std::string SandboxUser = _config->Find("APT::Sandbox::User");
+      ChangeOwnerAndPermissionOfFile("Item::QueueURI", Item->Owner->DestFile.c_str(),
+                                     SandboxUser.c_str(), "root", 0600);
+   }
+
    if (Debug == true)
       clog << " -> " << Access << ':' << QuoteString(Message,"\n") << endl;
    OutQueue += Message;