From ef9425971e042680337120e5efaa628470ad68c4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 7 Dec 2007 15:55:22 +0100 Subject: * apt-pkg/acquire-item.{cc,h}: - make the authentication download code more robust against servers/proxies with broken If-Range implementations --- apt-pkg/acquire-item.cc | 21 +++++++++++++++------ apt-pkg/acquire-item.h | 4 ++++ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index c8ac84f56..7cae6c8b7 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -770,16 +770,19 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner, Desc.Owner = this; Desc.ShortDesc = ShortDesc; Desc.URI = URI; - string Final = _config->FindDir("Dir::State::lists"); Final += URItoFileName(RealURI); struct stat Buf; if (stat(Final.c_str(),&Buf) == 0) { - // File was already in place. It needs to be re-verified - // because Release might have changed, so Move it into partial - Rename(Final,DestFile); + // File was already in place. It needs to be re-downloaded/verified + // because Release might have changed, we do give it a differnt + // name than DestFile because otherwise the http method will + // send If-Range requests and there are too many broken servers + // out there that do not understand them + LastGoodSig = DestFile+".reverify"; + Rename(Final,LastGoodSig); } QueueURI(Desc); @@ -791,7 +794,7 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner, string pkgAcqMetaSig::Custom600Headers() { struct stat Buf; - if (stat(DestFile.c_str(),&Buf) != 0) + if (stat(LastGoodSig.c_str(),&Buf) != 0) return "\nIndex-File: true"; return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); @@ -821,6 +824,12 @@ void pkgAcqMetaSig::Done(string Message,unsigned long Size,string MD5, Complete = true; + // put the last known good file back on i-m-s hit (it will + // be re-verified again) + // Else do nothing, we have the new file in DestFile then + if(StringToBool(LookupTag(Message,"IMS-Hit"),false) == true) + Rename(LastGoodSig, DestFile); + // queue a pkgAcqMetaIndex to be verified against the sig we just retrieved new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc, DestFile, IndexTargets, MetaIndexParser); @@ -837,7 +846,7 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf) Item::Failed(Message,Cnf); // move the sigfile back on transient network failures if(FileExists(DestFile)) - Rename(DestFile,Final); + Rename(LastGoodSig,Final); // set the status back to , Item::Failed likes to reset it Status = pkgAcquire::Item::StatTransientNetworkError; diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index edd910230..a48f7f7e5 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -609,6 +609,10 @@ struct IndexTarget class pkgAcqMetaSig : public pkgAcquire::Item { protected: + /** \brief The last good signature file */ + string LastGoodSig; + + /** \brief The fetch request that is currently being processed. */ pkgAcquire::ItemDesc Desc; -- cgit v1.2.3-70-g09d2 From f6c702eba601aa3ecf253d1a4d9119949a0a2cf9 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Sat, 8 Dec 2007 12:15:21 -0200 Subject: * Applied patch from Alexander Winston to use 'min' as symbol for minute, closes: #219034. --- apt-pkg/contrib/strutl.cc | 6 +++--- debian/changelog | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 006452af4..a04c266ba 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -331,19 +331,19 @@ string TimeToStr(unsigned long Sec) { if (Sec > 60*60*24) { - sprintf(S,"%lid %lih%lim%lis",Sec/60/60/24,(Sec/60/60) % 24,(Sec/60) % 60,Sec % 60); + sprintf(S,"%lid %lih%limin%lis",Sec/60/60/24,(Sec/60/60) % 24,(Sec/60) % 60,Sec % 60); break; } if (Sec > 60*60) { - sprintf(S,"%lih%lim%lis",Sec/60/60,(Sec/60) % 60,Sec % 60); + sprintf(S,"%lih%limin%lis",Sec/60/60,(Sec/60) % 60,Sec % 60); break; } if (Sec > 60) { - sprintf(S,"%lim%lis",Sec/60,Sec % 60); + sprintf(S,"%limin%lis",Sec/60,Sec % 60); break; } diff --git a/debian/changelog b/debian/changelog index 4db756063..1429623a0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,10 +12,12 @@ apt (0.7.10) UNRELEASED; urgency=low with newest dpkg-shlibdeps changing the packaging building order and a patch from Robert Millan to fix parallel building, closes: #452862. + * Applied patch from Alexander Winston + to use 'min' as symbol for minute, closes: #219034. [ Program translations ] - Basque updated. Closes: #453088 - + [ Michael Vogt ] * debian/rules - fix https install location @@ -23,7 +25,7 @@ apt (0.7.10) UNRELEASED; urgency=low - print warning if the cache can not be locked (closes: #454561), thanks to Bastian Kleineidam - -- Michael Vogt Thu, 06 Dec 2007 14:38:31 +0100 + -- Otavio Salvador Sat, 08 Dec 2007 12:13:58 -0200 apt (0.7.9) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From da543ed87d3f8b8a0030a211452c9bddfc066f0b Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Sun, 16 Dec 2007 18:35:58 -0200 Subject: * Applied patch from Peter Eisentraut to fix a grammatical error ("manual installed" -> "manually installed"), closes: #438136. * --- apt-pkg/algorithms.cc | 4 ++-- cmdline/apt-get.cc | 2 +- debian/changelog | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 62727a852..158f9c258 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1261,8 +1261,8 @@ void pkgProblemResolver::InstallProtect() Cache.MarkDelete(I); else { - // preserver the information if the package was auto - // or manual installed + // preserve the information whether the package was auto + // or manually installed bool autoInst = (Cache[I].Flags & pkgCache::Flag::Auto); Cache.MarkInstall(I, false, 0, !autoInst); } diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 3bcacb293..486e995cc 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1719,7 +1719,7 @@ bool DoInstall(CommandLine &CmdL) (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 manually installed.\n"), Pkg.Name()); Cache->MarkAuto(Pkg,false); AutoMarkChanged++; diff --git a/debian/changelog b/debian/changelog index 8e3f9ab38..4c56aa901 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,9 @@ apt (0.7.10) UNRELEASED; urgency=low work properly in initramfs, closes: #448316. * Applied patch from Robert Millan to make apt-key and apt-get to ignore time conflicts, closes: #451328. + * Applied patch from Peter Eisentraut to fix a + grammatical error ("manual installed" -> "manually installed"), + closes: #438136. [ Program translations ] - Basque updated. Closes: #453088 @@ -43,7 +46,10 @@ apt (0.7.10) UNRELEASED; urgency=low * ftparchive/multicompress.cc: - support lzma output - -- Otavio Salvador Sun, 16 Dec 2007 18:23:52 -0200 + [ Otavio Salvador ] + * + + -- Otavio Salvador Sun, 16 Dec 2007 18:34:40 -0200 apt (0.7.9) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From db2cca1129fa2d88eae80e1c4a17e263236a95a3 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Sun, 16 Dec 2007 18:53:32 -0200 Subject: * apt-pkg/contrib/configuration.cc: - if RootDir is set, then FindFile and FindDir will return paths relative to the directory stored in RootDir, closes: #456457. --- apt-pkg/contrib/configuration.cc | 7 ++++++- debian/changelog | 5 +++++ doc/apt.conf.5.xml | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 3109fd7a5..e8301d918 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -173,6 +173,11 @@ string Configuration::Find(const char *Name,const char *Default) const */ string Configuration::FindFile(const char *Name,const char *Default) const { + const Item *RootItem = Lookup("RootDir"); + std::string rootDir = (RootItem == 0) ? "" : RootItem->Value; + if(rootDir.size() > 0 && rootDir[rootDir.size() - 1] != '/') + rootDir.push_back('/'); + const Item *Itm = Lookup(Name); if (Itm == 0 || Itm->Value.empty() == true) { @@ -204,7 +209,7 @@ string Configuration::FindFile(const char *Name,const char *Default) const Itm = Itm->Parent; } - return val; + return rootDir + val; } /*}}}*/ // Configuration::FindDir - Find a directory name /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 9ae68c770..d8ce744d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -47,6 +47,11 @@ apt (0.7.10) UNRELEASED; urgency=low - support lzma data members * ftparchive/multicompress.cc: - support lzma output + + [ Daniel Burrows ] + * apt-pkg/contrib/configuration.cc: + - if RootDir is set, then FindFile and FindDir will return paths + relative to the directory stored in RootDir, closes: #456457. -- Otavio Salvador Sun, 16 Dec 2007 18:46:29 -0200 diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index 43f33681f..5bc6c55db 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -295,6 +295,19 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";}; dpkg, apt-get dpkg-source dpkg-buildpackage and apt-cache specify the location of the respective programs. + + + The configuration item RootDir has a special + meaning. If set, all paths in Dir:: will be + relative to RootDir, even paths that + are specified absolutely. So, for instance, if + RootDir is set to + /tmp/staging and + Dir::State::status is set to + /var/lib/dpkg/status, then the status file + will be looked up in + /tmp/staging/var/lib/dpkg/status. + APT in DSelect -- cgit v1.2.3-70-g09d2 From aff87a762f86ed47f2b81ccbac23faa5d9fddcdb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 17 Dec 2007 20:49:50 +0100 Subject: apt-pkg/deb/dpkgpm.cc: fix types --- apt-pkg/deb/dpkgpm.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index d796146fa..11bf827d7 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -342,8 +342,8 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) */ void pkgDPkgPM::DoStdin(int master) { - char input_buf[256] = {0,}; - int len = read(0, input_buf, sizeof(input_buf)); + unsigned char input_buf[256] = {0,}; + ssize_t len = read(0, input_buf, sizeof(input_buf)); if (len) write(master, input_buf, len); else @@ -357,9 +357,9 @@ void pkgDPkgPM::DoStdin(int master) */ void pkgDPkgPM::DoTerminalPty(int master) { - char term_buf[1024] = {0,}; + unsigned char term_buf[1024] = {0,0, }; - int len=read(master, term_buf, sizeof(term_buf)); + ssize_t len=read(master, term_buf, sizeof(term_buf)); if(len == -1 && errno == EIO) { // this happens when the child is about to exit, we -- cgit v1.2.3-70-g09d2