diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:38 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:38 +0000 |
commit | 67ff87bf72a9f6315020c0cd74632631c834ce1b (patch) | |
tree | 277f5310d4a3312748ea874a1977f8c4c1629974 | |
parent | 7ef724464cfe431862e0731327a3a131505fa38d (diff) | |
download | apt-67ff87bf72a9f6315020c0cd74632631c834ce1b.tar.gz |
More Fixes
Author: jgg
Date: 2000-01-14 06:26:36 GMT
More Fixes
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 46 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 11 | ||||
-rw-r--r-- | buildlib/program.mak | 6 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 6 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | doc/apt-cache.8.yo | 2 | ||||
-rw-r--r-- | test/makefile | 6 |
7 files changed, 72 insertions, 11 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 6b22cfe03..9899694c6 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -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()); diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 404ef652a..c3cddd615 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -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) diff --git a/buildlib/program.mak b/buildlib/program.mak index fe0d30de3..98bea9aa5 100644 --- a/buildlib/program.mak +++ b/buildlib/program.mak @@ -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 $@ diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 231717d4c..92efd1b1e 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -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"); diff --git a/debian/changelog b/debian/changelog index d9f6cb267..13a7ef1cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/apt-cache.8.yo b/doc/apt-cache.8.yo index cf0a11691..18327a222 100644 --- a/doc/apt-cache.8.yo +++ b/doc/apt-cache.8.yo @@ -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. diff --git a/test/makefile b/test/makefile index 466c073c7..787933101 100644 --- a/test/makefile +++ b/test/makefile @@ -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 |