More Fixes
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:55:38 +0000 (16:55 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:55:38 +0000 (16:55 +0000)
Author: jgg
Date: 2000-01-14 06:26:36 GMT
More Fixes

apt-pkg/contrib/strutl.cc
apt-pkg/pkgcachegen.cc
buildlib/program.mak
cmdline/apt-get.cc
debian/changelog
doc/apt-cache.8.yo
test/makefile

index 6b22cfe..9899694 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: strutl.cc,v 1.32 2000/01/10 03:44:54 jgg Exp $
+// $Id: strutl.cc,v 1.33 2000/01/14 06:26:37 jgg Exp $
 /* ######################################################################
 
    String Util - Some usefull string functions.
@@ -759,7 +759,18 @@ void URI::CopyFrom(string U)
    string::const_iterator SingleSlash = I;
    if (I + 3 < U.end() && I[1] == '/' && I[2] == '/')
       SingleSlash += 3;
-   for (; SingleSlash < U.end() && *SingleSlash != '/'; SingleSlash++);
+   
+   /* Find the / indicating the end of the hostname, ignoring /'s in the
+      square brackets */
+   bool InBracket = false;
+   for (; SingleSlash < U.end() && (*SingleSlash != '/' || InBracket == true); SingleSlash++)
+   {
+      if (*SingleSlash == '[')
+        InBracket = true;
+      if (InBracket == true && *SingleSlash == ']')
+        InBracket = false;
+   }
+   
    if (SingleSlash > U.end())
       SingleSlash = U.end();
 
@@ -806,10 +817,39 @@ void URI::CopyFrom(string U)
         Password = string(U,SecondColon - U.begin() + 1,At - SecondColon - 1);
    }   
    
+   // Now we parse the RFC 2732 [] hostnames.
+   unsigned long PortEnd = 0;
+   InBracket = false;
+   for (unsigned I = 0; I != Host.length();)
+   {
+      if (Host[I] == '[')
+      {
+        InBracket = true;
+        Host.erase(I,1);
+        continue;
+      }
+      
+      if (InBracket == true && Host[I] == ']')
+      {
+        InBracket = false;
+        Host.erase(I,1);
+        PortEnd = I;
+        continue;
+      }
+      I++;
+   }
+   
+   // Tsk, weird.
+   if (InBracket == true)
+   {
+      Host = string();
+      return;
+   }
+   
    // Now we parse off a port number from the hostname
    Port = 0;
    string::size_type Pos = Host.rfind(':');
-   if (Pos == string::npos)
+   if (Pos == string::npos || Pos < PortEnd)
       return;
    
    Port = atoi(string(Host,Pos+1).c_str());
index 404ef65..c3cddd6 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcachegen.cc,v 1.44 2000/01/10 03:44:54 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.45 2000/01/14 06:26:36 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -747,6 +747,10 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
    {      
       string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
       FileFd SCacheF(SCacheFile,FileFd::WriteEmpty);
+      
+      /* Open the pkgcache, we want a new inode here so we do no corrupt
+                existing mmaps */
+      unlink(CacheFile.c_str());             
       FileFd CacheF(CacheFile,FileFd::WriteEmpty);
       DynamicMMap Map(CacheF,MMap::Public,MapSize);
       if (_error->PendingError() == true)
@@ -776,8 +780,11 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
    
    // We use the source cache to generate the package cache
    string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
-
    FileFd SCacheF(SCacheFile,FileFd::ReadOnly);
+   
+   /* Open the pkgcache, we want a new inode here so we do no corrupt
+      existing mmaps */
+   unlink(CacheFile.c_str());             
    FileFd CacheF(CacheFile,FileFd::WriteEmpty);
    DynamicMMap Map(CacheF,MMap::Public,MapSize);
    if (_error->PendingError() == true)
index fe0d30d..98bea9a 100644 (file)
@@ -25,12 +25,16 @@ clean: clean/$(LOCAL)
 veryclean: veryclean/$(LOCAL)
 
 # The clean rules
-.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
+.PHONY: clean/$(LOCAL) veryclean/$(LOCAL) 
 clean/$(LOCAL):
        -rm -f $($(@F)-OBJS) $($(@F)-DEP)
 veryclean/$(LOCAL): clean/$(LOCAL)
        -rm -f $($(@F)-BIN)
 
+# The convience binary build rule
+.PHONY: $(PROGRAM)
+$(PROGRAM): $($(LOCAL)-BIN)
+
 # The binary build rule
 $($(LOCAL)-BIN): $($(LOCAL)-OBJS) $($(LOCAL)-MKS)
        echo Building program $@
index 231717d..92efd1b 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.94 1999/12/10 07:27:03 jgg Exp $
+// $Id: apt-get.cc,v 1.95 2000/01/14 06:26:37 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -955,7 +955,7 @@ bool DoUpdate(CommandLine &)
    }
    
    // Clean out any old list files
-   if (_config->FindB("APT::Get::List-Cleanup",false) == false)
+   if (_config->FindB("APT::Get::List-Cleanup",true) == true)
    {
       if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false ||
          Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false)
@@ -1735,7 +1735,7 @@ int main(int argc,const char *argv[])
        _config->FindB("version") == true ||
        CmdL.FileSize() == 0)
       return ShowHelp(CmdL);
-
+   
    // Deal with stdout not being a tty
    if (ttyname(STDOUT_FILENO) == 0 && _config->FindI("quiet",0) < 1)
       _config->Set("quiet","1");
index d9f6cb2..13a7ef1 100644 (file)
@@ -3,10 +3,14 @@ apt (0.3.15.1) unstable; urgency=low
   * Made --no-download work. Closes: #52993
   * Now compiles on OpenBSD, Solaris and HP-UX
   * Clarify segfault errors
-  * More debhelper fixes. Closes: #52662, #54566
+  * More debhelper fixes. Closes: #52662, #54566, #52090, #53531, #54769
   * Fix for Joel's discovery of glibc removal behavoir.
   * Fix for Ben Collins file: uri from slink upgrade.
   * Fixed resume code in FTP. Closes: #54323
+  * Take more precautions to prevent the corruption Joey Hess saw.
+  * Fixed --no-list-cleanup
+  * RFC 2732 URI parsing ([] for hostnames).
+  * Typo in apt-cache man page. Closes: #54949
   
  -- Jason Gunthorpe <jgg@debian.org>  Sat,  4 Dec 1999 21:17:24 -0800
   
index cf0a116..18327a2 100644 (file)
@@ -131,7 +131,7 @@ for debugging.
 
 dit(bf(dumpavail))
 bf(dumpavail) prints out an available list to stdout. This is suitable for use
-with df(dpkg) and is used by the bf(dselect) method.
+with bf(dpkg) and is used by the bf(dselect) method.
 
 dit(bf(unmet))
 bf(unmet) displays a summary of all unmet dependencies in the package cache.
index 466c073..7879331 100644 (file)
@@ -11,6 +11,12 @@ SLIBS =
 SOURCE = mthdcat.cc
 include $(PROGRAM_H)
 
+# Program for testing methods
+PROGRAM=uritest
+SLIBS = -lapt-pkg
+SOURCE = uri.cc
+include $(PROGRAM_H)
+
 # Scratch program to test incomplete code fragments in
 PROGRAM=scratch-test
 SLIBS = -lapt-inst -lapt-pkg