]> git.saurik.com Git - apt.git/commitdiff
Force file perms to 0644 for cache and lists.
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:59:12 +0000 (16:59 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:59:12 +0000 (16:59 +0000)
Author: jgg
Date: 2002-04-26 05:35:57 GMT
Force file perms to 0644 for cache and lists.

apt-pkg/acquire-item.cc
apt-pkg/pkgcachegen.cc

index 7ff3a58e9a766ba7f3650cd7ea122d129ac601d0..717d64754d1da490190d2c5c6b816bd07bfaec34 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-item.cc,v 1.44 2001/05/07 05:49:43 jgg Exp $
+// $Id: acquire-item.cc,v 1.45 2002/04/26 05:35:57 jgg Exp $
 /* ######################################################################
 
    Acquire Item - Item to acquire
@@ -125,7 +125,7 @@ void pkgAcquire::Item::Rename(string From,string To)
              From.c_str(),To.c_str());
       Status = StatError;
       ErrorText = S;
-   }      
+   }   
 }
                                                                        /*}}}*/
 
@@ -185,6 +185,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
       string FinalFile = _config->FindDir("Dir::State::lists");
       FinalFile += URItoFileName(RealURI);
       Rename(DestFile,FinalFile);
+      chmod(FinalFile.c_str(),0644);
       
       /* We restore the original name to DestFile so that the clean operation
          will work OK */
@@ -312,6 +313,8 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5,
    string FinalFile = _config->FindDir("Dir::State::lists");
    FinalFile += URItoFileName(RealURI);
    Rename(DestFile,FinalFile);
+   
+   chmod(FinalFile.c_str(),0644);
 }
                                                                        /*}}}*/
 // AcqIndexRel::Failed - Silence failure messages for missing rel files        /*{{{*/
@@ -348,7 +351,8 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
    if (Version.Arch() == 0)
    {
       _error->Error(_("I wasn't able to locate a file for the %s package. "
-                   "This might mean you need to manually fix this package. (due to missing arch)"),
+                     "This might mean you need to manually fix this package. "
+                     "(due to missing arch)"),
                    Version.ParentPkg().Name());
       return;
    }
index 534217e9e0945b847c788f476b55be6d18e49667..581df11f482788d59fb7fa9bc83f529e3c621fcc 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcachegen.cc,v 1.50 2001/07/01 22:28:24 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.51 2002/04/26 05:35:57 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -125,7 +125,8 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       if (Version.empty() == true)
       {
         if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false)
-           return _error->Error(_("Error occured while processing %s (UsePackage1)"),PackageName.c_str());
+           return _error->Error(_("Error occured while processing %s (UsePackage1)"),
+                                PackageName.c_str());
         continue;
       }
 
@@ -145,10 +146,12 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       if (Res == 0 && Ver->Hash == Hash)
       {
         if (List.UsePackage(Pkg,Ver) == false)
-           return _error->Error(_("Error occured while processing %s (UsePackage2)"),PackageName.c_str());
+           return _error->Error(_("Error occured while processing %s (UsePackage2)"),
+                                PackageName.c_str());
 
         if (NewFileVer(Ver,List) == false)
-           return _error->Error(_("Error occured while processing %s (NewFileVer1)"),PackageName.c_str());
+           return _error->Error(_("Error occured while processing %s (NewFileVer1)"),
+                                PackageName.c_str());
         
         // Read only a single record and return
         if (OutVer != 0)
@@ -176,13 +179,16 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       Ver->ParentPkg = Pkg.Index();
       Ver->Hash = Hash;
       if (List.NewVersion(Ver) == false)
-        return _error->Error(_("Error occured while processing %s (NewVersion1)"),PackageName.c_str());
+        return _error->Error(_("Error occured while processing %s (NewVersion1)"),
+                             PackageName.c_str());
 
       if (List.UsePackage(Pkg,Ver) == false)
-        return _error->Error(_("Error occured while processing %s (UsePackage3)"),PackageName.c_str());
+        return _error->Error(_("Error occured while processing %s (UsePackage3)"),
+                             PackageName.c_str());
       
       if (NewFileVer(Ver,List) == false)
-        return _error->Error(_("Error occured while processing %s (NewVersion2)"),PackageName.c_str());
+        return _error->Error(_("Error occured while processing %s (NewVersion2)"),
+                             PackageName.c_str());
 
       // Read only a single record and return
       if (OutVer != 0)
@@ -636,6 +642,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
    {
       unlink(CacheFile.c_str());
       CacheF = new FileFd(CacheFile,FileFd::WriteEmpty);
+      fchmod(CacheF->Fd(),0644);
       Map = new DynamicMMap(*CacheF,MMap::Public,MapSize);
       if (_error->PendingError() == true)
         return false;
@@ -686,6 +693,9 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
         FileFd SCacheF(SrcCacheFile,FileFd::WriteEmpty);
         if (_error->PendingError() == true)
            return false;
+        
+        fchmod(SCacheF.Fd(),0644);
+        
         // Write out the main data
         if (SCacheF.Write(Map->Data(),Map->Size()) == false)
            return _error->Error(_("IO Error saving source cache"));
@@ -696,8 +706,8 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
         if (SCacheF.Seek(0) == false ||
             SCacheF.Write(Map->Data(),sizeof(*Gen.GetCache().HeaderP)) == false)
            return _error->Error(_("IO Error saving source cache"));
-        SCacheF.Sync();
         Gen.GetCache().HeaderP->Dirty = true;
+        SCacheF.Sync();
       }
       
       // Build the status cache