From 2e1715eabc8fabdcf3c3a4fe139412e2a2ffb8e4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Sep 2007 14:57:35 +0200 Subject: * write start/end log tags --- apt-pkg/deb/dpkgpm.cc | 80 ++++++++++++++++++++++++++++++++++----------------- apt-pkg/deb/dpkgpm.h | 4 +++ 2 files changed, 57 insertions(+), 27 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index bb7e4b40a..2b32fbe66 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -495,6 +495,46 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd) } /*}}}*/ +bool pkgDPkgPM::OpenLog() +{ + string logdir = _config->FindDir("Dir::Log"); + if(not FileExists(logdir)) + return _error->Error(_("Directory '%s' missing"), logdir.c_str()); + string logfile_name = flCombine(logdir, + _config->Find("Dir::Log::Terminal")); + if (!logfile_name.empty()) + { + term_out = fopen(logfile_name.c_str(),"a"); + chmod(logfile_name.c_str(), 0600); + // output current time + char outstr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(outstr, sizeof(outstr), "%F %T", tmp); + fprintf(term_out, "\nLog started: "); + fprintf(term_out, outstr); + fprintf(term_out, "\n"); + } + return true; +} + +bool pkgDPkgPM::CloseLog() +{ + if(term_out) + { + char outstr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(outstr, sizeof(outstr), "%F %T", tmp); + fprintf(term_out, "\nLog ended: "); + fprintf(term_out, outstr); + fprintf(term_out, "\n"); + fclose(term_out); + } + term_out = NULL; + return true; +} + // DPkgPM::Go - Run the sequence /*{{{*/ // --------------------------------------------------------------------- @@ -563,24 +603,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) } // create log - string logdir = _config->FindDir("Dir::Log"); - if(not FileExists(logdir)) - return _error->Error(_("Directory '%s' missing"), logdir.c_str()); - string logfile_name = flCombine(logdir, - _config->Find("Dir::Log::Terminal")); - if (!logfile_name.empty()) - { - term_out = fopen(logfile_name.c_str(),"a"); - chmod(logfile_name.c_str(), 0600); - // output current time - char outstr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); - strftime(outstr, sizeof(outstr), "%F %T", tmp); - fprintf(term_out, "\nLog started: "); - fprintf(term_out, outstr); - fprintf(term_out, "\n"); - } + OpenLog(); // this loop is runs once per operation for (vector::iterator I = List.begin(); I != List.end();) @@ -810,11 +833,16 @@ bool pkgDPkgPM::Go(int OutStatusFd) tv.tv_sec = 1; tv.tv_usec = 0; select_ret = select(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv); - if (select_ret < 0) { - std::cerr << "Error in select()" << std::endl; - continue; - } else if (select_ret == 0) - continue; + if (select_ret == 0) + continue; + else if (select_ret < 0 && errno == EINTR) + continue; + else if (select_ret < 0) + { + perror("select() returned error"); + continue; + } + if(master >= 0 && FD_ISSET(master, &rfds)) DoTerminalPty(master); @@ -852,14 +880,12 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(stopOnError) { - if(term_out) - fclose(term_out); + CloseLog(); return false; } } } - if(term_out) - fclose(term_out); + CloseLog(); if (RunScripts("DPkg::Post-Invoke") == false) return false; diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 448091626..b7f45b978 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -66,6 +66,10 @@ class pkgDPkgPM : public pkgPackageManager bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); + // dpkg log + bool OpenLog(); + bool CloseLog(); + // input processing void DoStdin(int master); void DoTerminalPty(int master); -- cgit v1.2.3-70-g09d2 From 8398ac36e49bd1b863549753166d77de1efb3a23 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Sep 2007 15:09:56 +0200 Subject: apt-pkg/deb/dpkgpm.cc: - remove leading "\n" --- apt-pkg/deb/dpkgpm.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 2b32fbe66..f83214344 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -526,7 +526,7 @@ bool pkgDPkgPM::CloseLog() time_t t = time(NULL); struct tm *tmp = localtime(&t); strftime(outstr, sizeof(outstr), "%F %T", tmp); - fprintf(term_out, "\nLog ended: "); + fprintf(term_out, "Log ended: "); fprintf(term_out, outstr); fprintf(term_out, "\n"); fclose(term_out); -- cgit v1.2.3-70-g09d2 From e9fce64bd454e68641a265d384669217f2bc0558 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Sep 2007 19:23:55 +0200 Subject: * apt-pkg/acquire-item.cc: - fix crash in diff acquire code * apt-pkg/contrib/mmap.cc: - don't fail if msync() returns > 0 --- apt-pkg/acquire-item.cc | 2 +- apt-pkg/contrib/mmap.cc | 4 ++-- debian/changelog | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 32798335c..c38a50194 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -345,7 +345,7 @@ void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash, */ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - HashString ExpectedMD5, + HashString ExpecteHash, vector diffs) : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), available_patches(diffs) diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 7f814c2d2..abcae46fe 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -117,7 +117,7 @@ bool MMap::Sync() #ifdef _POSIX_SYNCHRONIZED_IO if ((Flags & ReadOnly) != ReadOnly) - if (msync((char *)Base,iSize,MS_SYNC) != 0) + if (msync((char *)Base,iSize,MS_SYNC) < 0) return _error->Errno("msync","Unable to write mmap"); #endif return true; @@ -134,7 +134,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) #ifdef _POSIX_SYNCHRONIZED_IO unsigned long PSize = sysconf(_SC_PAGESIZE); if ((Flags & ReadOnly) != ReadOnly) - if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0) + if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0) return _error->Errno("msync","Unable to write mmap"); #endif return true; diff --git a/debian/changelog b/debian/changelog index a271c6a6c..e1d166fdf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,8 @@ apt (0.7.7) UNRELEASED; urgency=low * cmdline/apt-get.cc: - do not change the auto-installed information if a package is reinstalled + * apt-pkg/acquire-item.cc: + - fix crash in diff acquire code * cmdline/apt-mark: - Fix chmoding after have renamed the extended-states file (LP: #140019) (thanks to Laurent Bigonville) @@ -41,6 +43,10 @@ apt (0.7.7) UNRELEASED; urgency=low [ Ian Jackson ] * dpkg-triggers: Deal properly with new package states. + [ Colin Watson ] + * apt-pkg/contrib/mmap.cc: + - don't fail if msync() returns > 0 + -- Michael Vogt Thu, 02 Aug 2007 11:55:54 +0200 apt (0.7.6) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From 59d5cc74ef7c6ca820ed9d26a4d829b891214edf Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Sep 2007 20:38:14 +0200 Subject: * apt-pkg/acquire-item.cc: - fix typo --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index c38a50194..a6d01e3bb 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -345,7 +345,7 @@ void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash, */ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - HashString ExpecteHash, + HashString ExpectedHash, vector diffs) : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), available_patches(diffs) -- cgit v1.2.3-70-g09d2 From bc36c37bdbcdda5fe4f641abbc5514d5f5c5e2a4 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 2 Oct 2007 09:19:20 -0300 Subject: * Fix compilation warnings: - apt-pkg/indexfile.cc: conversion from string constant to 'char*'; --- apt-pkg/indexfile.cc | 4 ++-- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc index cf238eb4a..b38596143 100644 --- a/apt-pkg/indexfile.cc +++ b/apt-pkg/indexfile.cc @@ -113,8 +113,8 @@ string pkgIndexFile::LanguageCode() // we have a mapping of the language codes that contains all the language // codes that need the country code as well // (like pt_BR, pt_PT, sv_SE, zh_*, en_*) - char *need_full_langcode[] = { "pt","sv","zh","en", NULL }; - for(char **s = need_full_langcode;*s != NULL; s++) + const char *need_full_langcode[] = { "pt","sv","zh","en", NULL }; + for(const char **s = need_full_langcode;*s != NULL; s++) if(lang.find(*s) == 0) return lang.substr(0,5); diff --git a/debian/changelog b/debian/changelog index bd8562f9c..85a07a94d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -56,6 +56,8 @@ apt (0.7.7) UNRELEASED; urgency=low Ryan Murray for the patch (closes: #437150) * Add support to apt-key to export keys to stdout. Thanks to "Dwayne C. Litzenberger" for the patch (closes: #441942) + * Fix compilation warnings: + - apt-pkg/indexfile.cc: conversion from string constant to 'char*'; [ Ian Jackson ] * dpkg-triggers: Deal properly with new package states. -- cgit v1.2.3-70-g09d2 From 1450dbaaadb7f863c8d1191a10ef542b2809db03 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 2 Oct 2007 09:21:58 -0300 Subject: - apt-pkg/acquire-item.cc: likewise; --- apt-pkg/acquire-item.cc | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index a6d01e3bb..9c51184e6 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -704,7 +704,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, Local = true; string compExt = Desc.URI.substr(Desc.URI.size()-3); - char *decompProg; + const char *decompProg; if(compExt == "bz2") decompProg = "bzip2"; else if(compExt == ".gz") diff --git a/debian/changelog b/debian/changelog index 85a07a94d..08a60585c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -58,6 +58,7 @@ apt (0.7.7) UNRELEASED; urgency=low C. Litzenberger" for the patch (closes: #441942) * Fix compilation warnings: - apt-pkg/indexfile.cc: conversion from string constant to 'char*'; + - apt-pkg/acquire-item.cc: likewise; [ Ian Jackson ] * dpkg-triggers: Deal properly with new package states. -- cgit v1.2.3-70-g09d2 From 9504f6f95ba38205551275f94069799ce8683657 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 2 Oct 2007 09:25:37 -0300 Subject: - apt-pkg/cdrom.cc: '%lu' expects 'long unsigned int', but argument has type 'size_t'; --- apt-pkg/cdrom.cc | 4 ++-- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 96106c7a9..b8f94e5b0 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -668,8 +668,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) DropRepeats(TransList,""); if(log) { msg.str(""); - ioprintf(msg, _("Found %lu package indexes, %lu source indexes, " - "%lu translation indexes and %lu signatures\n"), + ioprintf(msg, _("Found %u package indexes, %u source indexes, " + "%u translation indexes and %u signatures\n"), List.size(), SourceList.size(), TransList.size(), SigList.size()); log->Update(msg.str(), STEP_SCAN); diff --git a/debian/changelog b/debian/changelog index 08a60585c..61bb75129 100644 --- a/debian/changelog +++ b/debian/changelog @@ -59,6 +59,8 @@ apt (0.7.7) UNRELEASED; urgency=low * Fix compilation warnings: - apt-pkg/indexfile.cc: conversion from string constant to 'char*'; - apt-pkg/acquire-item.cc: likewise; + - apt-pkg/cdrom.cc: '%lu' expects 'long unsigned int', but argument + has type 'size_t'; [ Ian Jackson ] * dpkg-triggers: Deal properly with new package states. -- cgit v1.2.3-70-g09d2 From 71afbdb50df4058a56ed567f03c9a82f5f9d130e Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 2 Oct 2007 09:33:32 -0300 Subject: - apt-pkg/deb/dpkgpm.cc: initialization order and conversion from string constant to 'char*'; --- apt-pkg/deb/dpkgpm.cc | 6 +++--- debian/changelog | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index b92d0118c..92f96620f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -44,8 +44,8 @@ using namespace std; // --------------------------------------------------------------------- /* */ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) - : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesDone(0), - PackagesTotal(0), term_out(NULL) + : pkgPackageManager(Cache), dpkgbuf_pos(0), + term_out(NULL), PackagesDone(0), PackagesTotal(0) { } /*}}}*/ @@ -770,7 +770,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) /* No Job Control Stop Env is a magic dpkg var that prevents it from using sigstop */ - putenv("DPKG_NO_TSTP=yes"); + putenv((char *)"DPKG_NO_TSTP=yes"); execvp(Args[0],(char **)Args); cerr << "Could not exec dpkg!" << endl; _exit(100); diff --git a/debian/changelog b/debian/changelog index 61bb75129..592fbe14d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -61,6 +61,8 @@ apt (0.7.7) UNRELEASED; urgency=low - apt-pkg/acquire-item.cc: likewise; - apt-pkg/cdrom.cc: '%lu' expects 'long unsigned int', but argument has type 'size_t'; + - apt-pkg/deb/dpkgpm.cc: initialization order and conversion from + string constant to 'char*'; [ Ian Jackson ] * dpkg-triggers: Deal properly with new package states. -- cgit v1.2.3-70-g09d2 From a491fe600cdcf28ee9515d4fde02345be93a0f9c Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 2 Oct 2007 09:46:44 -0300 Subject: - apt-pkg/deb/debmetaindex.cc: comparison with string literal results in unspecified behaviour; --- apt-pkg/deb/debmetaindex.cc | 2 +- debian/changelog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 94995798f..9ac659f78 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -224,7 +224,7 @@ class debSLTypeDebian : public pkgSourceList::Type // This check insures that there will be only one Release file // queued for all the Packages files and Sources files it // corresponds to. - if ((*I)->GetType() == "deb") + if (strcmp((*I)->GetType(), "deb") == 0) { debReleaseIndex *Deb = (debReleaseIndex *) (*I); // This check insures that there will be only one Release file diff --git a/debian/changelog b/debian/changelog index ad887b29e..7687fce5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -66,6 +66,8 @@ apt (0.7.7) UNRELEASED; urgency=low - methods/gpgv.cc: conversion from string constant to 'char*'; - methods/ftp.cc: likewise; - cmdline/apt-extracttemplates.cc: likewise; + - apt-pkg/deb/debmetaindex.cc: comparison with string literal results + in unspecified behaviour; [ Ian Jackson ] * dpkg-triggers: Deal properly with new package states. -- cgit v1.2.3-70-g09d2 From 717847f20a7c090674dc03b75764de7670a58ac5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 5 Oct 2007 06:30:53 +0200 Subject: apt-pkg/acquire-item.cc: - do not unlink() on normal i-m-s hit, this fixes the problem that local repository files got a i-m-s hit too and got removed test/pre-upload-check.py - add test for local Packages.gz file removal - add test for leftover files in partial/ --- apt-pkg/acquire-item.cc | 3 --- test/pre-upload-check.py | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 9c51184e6..c8ac84f56 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -693,10 +693,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, // The files timestamp matches if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true) - { - unlink(FileName.c_str()); return; - } if (FileName == DestFile) Erase = true; diff --git a/test/pre-upload-check.py b/test/pre-upload-check.py index 2199c598a..373683360 100755 --- a/test/pre-upload-check.py +++ b/test/pre-upload-check.py @@ -72,7 +72,6 @@ class testAuthentication(unittest.TestCase): call([self.apt,"update", "-o","Dir::Etc::sourcelist=./%s" % f]+apt_args, stdout=stdout, stderr=stderr) - # then get the pkg cmd = ["install", "-y", "-d", "--reinstall", "%s=%s" % (self.pkg, self.pkgver), "-o","Dir::state::Status=./fake-status"] @@ -92,7 +91,9 @@ class testAuthentication(unittest.TestCase): stdout=stdout, stderr=stderr) self.assert_(res == expected_res, "test '%s' failed (got %s expected %s" % (f,res,expected_res)) - + if expected_res == 0: + self.assert_(len(glob.glob("/var/lib/apt/lists/partial/*")) == 0, + "partial/ dir has leftover files: %s" % glob.glob("/var/lib/apt/lists/partial/*")) class testLocalRepositories(unittest.TestCase): @@ -119,6 +120,22 @@ class testLocalRepositories(unittest.TestCase): self.assert_(os.path.exists(os.path.join(self.repo,"Packages.gz")), "Packages.gz vanished from local repo") + def testLocalRepo2(self): + repo = os.path.abspath(os.path.join(os.getcwd(), self.repo_dir+"2")) + sources = os.path.join(self.repo, "sources.list") + s = open(sources,"w") + s.write("deb file://%s/ /\n" % repo) + s.close() + + # two times to get at least one i-m-s hit + for i in range(2): + self.assert_(os.path.exists(sources)) + cmd = [self.apt,"update","-o", "Dir::Etc::sourcelist=%s" % sources]+apt_args + res = call(cmd, stdout=stdout, stderr=stderr) + self.assertEqual(res, 0, "local repo2 test failed") + self.assert_(os.path.exists(os.path.join(repo,"Packages.gz")), + "Packages.gz vanished from local repo") + def testInstallFromLocalRepo(self): apt = [self.apt,"-o", "Dir::Etc::sourcelist=%s"% self.sources]+apt_args cmd = apt+["update"] -- cgit v1.2.3-70-g09d2 From 6edbc051f4cc97ec24b0b95791aa3cdc2ade3aae Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 15 Oct 2007 17:42:41 +0200 Subject: * apt-pkg/depcache.cc: - set "APT::Install-Recommends" to true by default (OMG!) --- apt-pkg/init.cc | 2 +- debian/changelog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 676b66d38..2b412e16b 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -35,7 +35,7 @@ bool pkgInitConfig(Configuration &Cnf) // General APT things Cnf.Set("APT::Architecture", COMMON_ARCH); Cnf.Set("APT::Build-Essential::", "build-essential"); - Cnf.Set("APT::Install-Recommends", false); + Cnf.Set("APT::Install-Recommends", true); Cnf.Set("APT::Install-Suggests", false); Cnf.Set("Dir","/"); diff --git a/debian/changelog b/debian/changelog index b8f1bb251..98b57eb45 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,8 @@ apt (0.7.7) UNRELEASED; urgency=low * cmdline/apt-mark: - Fix chmoding after have renamed the extended-states file (LP: #140019) (thanks to Laurent Bigonville) + * apt-pkg/depcache.cc: + - set "APT::Install-Recommends" to true by default (OMG!) [ Program translations ] - French updated -- cgit v1.2.3-70-g09d2 From 477b5d6cacb53e868ec182330ffdcc3678a98560 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 15 Oct 2007 21:23:04 +0200 Subject: apt-pkg/deb/dpkgpm.cc: - fix resource leak --- apt-pkg/deb/dpkgpm.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 92f96620f..3235b0b06 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -841,8 +841,11 @@ bool pkgDPkgPM::Go(int OutStatusFd) signal(SIGQUIT,old_SIGQUIT); signal(SIGINT,old_SIGINT); - if(master >= 0 && slave >= 0) + if(master >= 0) + { tcsetattr(0, TCSAFLUSH, &tt); + close(master); + } // Check for an error code. if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0) -- cgit v1.2.3-70-g09d2 From 7052511ef60897a02c00da43a309465380f93603 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 20 Oct 2007 07:52:26 +0200 Subject: apt-pkg/deb/dpkgpm.cc: - use pselect() instead of select() - on EIO error on pty master read, usleep(0.5s) to give up timeslice so that the child can properly exit --- apt-pkg/deb/dpkgpm.cc | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 3235b0b06..8e1d7c85a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -357,7 +357,15 @@ void pkgDPkgPM::DoTerminalPty(int master) char term_buf[1024] = {0,}; int len=read(master, term_buf, sizeof(term_buf)); - if(len <= 0) + if(len == -1 && errno == EIO) + { + // this happens when the child is about to exit, we + // give it time to actually exit, otherwise we run + // into a race + usleep(500000); + return; + } + if(len <= 0) return; write(1, term_buf, len); if(term_out) @@ -793,7 +801,12 @@ bool pkgDPkgPM::Go(int OutStatusFd) // setups fds fd_set rfds; - struct timeval tv; + struct timespec tv; + sigset_t sigmask; + sigset_t original_sigmask; + sigemptyset(&sigmask); + sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask); + int select_ret; while ((res=waitpid(Child,&Status, WNOHANG)) != Child) { if(res < 0) { @@ -816,8 +829,9 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(master >= 0) FD_SET(master, &rfds); tv.tv_sec = 1; - tv.tv_usec = 0; - select_ret = select(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv); + tv.tv_nsec = 0; + select_ret = pselect(max(master, _dpkgin)+1, &rfds, NULL, NULL, + &tv, &original_sigmask); if (select_ret == 0) continue; else if (select_ret < 0 && errno == EINTR) -- cgit v1.2.3-70-g09d2 From c5597900026cf124654b808c800c4731a2eb655c Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Thu, 25 Oct 2007 09:25:02 -0200 Subject: * Applied patch from Daniel Leidert to fix APT::Acquire::Translation "none" support, closes: #437523. --- apt-pkg/init.cc | 8 ++++---- debian/changelog | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 2b412e16b..338bef66c 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -72,7 +72,10 @@ bool pkgInitConfig(Configuration &Cnf) // State Cnf.Set("Dir::Log","var/log/apt"); Cnf.Set("Dir::Log::Terminal","term.log"); - + + // Translation + Cnf.Set("APT::Acquire::Translation", "environment"); + bool Res = true; // Read an alternate config file @@ -104,9 +107,6 @@ bool pkgInitConfig(Configuration &Cnf) } #endif - // Translation - Cnf.Set("APT::Acquire::Translation", "environment"); - return true; } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index 22e966f0f..df7b029d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.8) UNRELEASED; urgency=low + + * Applied patch from Daniel Leidert to fix + APT::Acquire::Translation "none" support, closes: #437523. + + -- Otavio Salvador Thu, 25 Oct 2007 09:24:56 -0200 + apt (0.7.7) UNRELEASED; urgency=low [ Michael Vogt ] -- cgit v1.2.3-70-g09d2 From f27b4a70b2cfe4d49806080937d15fb415d4d18b Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Thu, 25 Oct 2007 09:58:11 -0200 Subject: * Applied patch from Daniel Burrows to add support for the Homepage field, closes: #447970. --- apt-pkg/deb/debrecords.cc | 8 ++++++++ apt-pkg/deb/debrecords.h | 1 + apt-pkg/pkgrecords.h | 1 + debian/changelog | 2 ++ 4 files changed, 12 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 3d3d7de0a..8ed0bb7eb 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -51,6 +51,14 @@ string debRecordParser::Name() return Section.FindS("Package"); } /*}}}*/ +// RecordParser::Homepage - Return the package homepage /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string debRecordParser::Homepage() +{ + return Section.FindS("Homepage"); +} + /*}}}*/ // RecordParser::MD5Hash - Return the archive hash /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index ab244b6dd..6f358abfa 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -44,6 +44,7 @@ class debRecordParser : public pkgRecords::Parser virtual string ShortDesc(); virtual string LongDesc(); virtual string Name(); + virtual string Homepage(); virtual void GetRec(const char *&Start,const char *&Stop); diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index f3bf7b6a1..17f3b1569 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -66,6 +66,7 @@ class pkgRecords::Parser virtual string ShortDesc() {return string();}; virtual string LongDesc() {return string();}; virtual string Name() {return string();}; + virtual string Homepage() {return string();} // The record in binary form virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;}; diff --git a/debian/changelog b/debian/changelog index 77e4f685a..3675cd143 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ apt (0.7.8) UNRELEASED; urgency=low * Applied patch from Daniel Leidert to fix APT::Acquire::Translation "none" support, closes: #437523. + * Applied patch from Daniel Burrows to add support + for the Homepage field, closes: #447970. -- Otavio Salvador Thu, 25 Oct 2007 09:24:56 -0200 -- cgit v1.2.3-70-g09d2 From f6fa4a10db080c33df1361f092f3e0ddb33ac3b9 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Thu, 25 Oct 2007 10:03:35 -0200 Subject: Changed ABI --- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- methods/makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 23e951eff..6d8693be9 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 4 -#define APT_PKG_MINOR 5 +#define APT_PKG_MINOR 6 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index b327dbf64..1b78c94f6 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -13,7 +13,7 @@ include ../buildlib/defaults.mak # methods/makefile - FIXME LIBRARY=apt-pkg LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) -MAJOR=4.5 +MAJOR=4.6 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/methods/makefile b/methods/makefile index e47539dbb..5794c84e7 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 4.5 +LIB_APT_PKG_MAJOR = 4.6 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3-70-g09d2 From 36fb926eada14ae6d3cb7f7658d95fb8c8013812 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 26 Oct 2007 18:08:18 -0200 Subject: * Applied patch from Frans Pop to fix a trailing space after cd label, closes: #448187. --- apt-pkg/cdrom.cc | 4 ++-- debian/changelog | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index b8f94e5b0..afb067559 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -560,8 +560,8 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) } if(log) { msg.str(""); - ioprintf(msg, _("Stored label: %s \n"), - Database.Find("CD::"+ident).c_str()); + ioprintf(msg, _("Stored label: %s\n"), + Database.Find("CD::"+ident).c_str()); log->Update(msg.str()); } return true; diff --git a/debian/changelog b/debian/changelog index f29fc1b20..e0a6a7736 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,10 @@ apt (0.7.8) UNRELEASED; urgency=low APT::Acquire::Translation "none" support, closes: #437523. * Applied patch from Daniel Burrows to add support for the Homepage field (ABI break), closes: #447970. + * Applied patch from Frans Pop to fix a trailing + space after cd label, closes: #448187. - -- Otavio Salvador Thu, 25 Oct 2007 13:47:00 -0200 + -- Otavio Salvador Fri, 26 Oct 2007 18:07:06 -0200 apt (0.7.7) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From 919e5852f297045cdb409143df663ad630b123e8 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Mon, 29 Oct 2007 16:52:30 -0200 Subject: * Applied patch from Brian M. Carlson to add backward support for arches that lacks pselect support, closes: #448406. --- apt-pkg/deb/dpkgpm.cc | 24 ++++++++++++++++++++++++ debian/changelog | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index ce4d4b44b..e3fe8d845 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -543,6 +543,27 @@ bool pkgDPkgPM::CloseLog() return true; } +/*{{{*/ +// This implements a racy version of pselect for those architectures +// that don't have a working implementation. +// FIXME: Probably can be removed on Lenny+1 +static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, const struct timespec *timeout, + const sigset_t *sigmask) +{ + sigset_t origmask; + struct timeval tv; + int retval; + + tv.tv_sec = timeout->tv.tv_sec; + tv.tv_usec = timeout->tv.tv_nsec/1000; + + sigprocmask(SIG_SETMASK, &sigmask, &origmask); + retval = select(nfds, readfds, writefds, exceptfds, &tv); + sigprocmask(SIG_SETMASK, &origmask, 0); + return retval; +} +/*}}}*/ // DPkgPM::Go - Run the sequence /*{{{*/ // --------------------------------------------------------------------- @@ -855,6 +876,9 @@ bool pkgDPkgPM::Go(int OutStatusFd) tv.tv_nsec = 0; select_ret = pselect(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv, &original_sigmask); + if (select_ret < 0 && (errno == EINVAL || errno == ENOSYS)) + select_ret = racy_pselect(max(master, _dpkgin)+1, &rfds, NULL, + NULL, &tv, &original_sigmask); if (select_ret == 0) continue; else if (select_ret < 0 && errno == EINTR) diff --git a/debian/changelog b/debian/changelog index cd14b0caf..36c7aa2c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,8 +12,11 @@ apt (0.7.9) UNRELEASED; urgency=low [ Otavio Salvador ] * Fix configure script to check for CURL library and headers presense. + * Applied patch from Brian M. Carlson + to add backward support for arches that lacks pselect support, + closes: #448406. - -- Otavio Salvador Mon, 29 Oct 2007 10:15:52 -0200 + -- Otavio Salvador Mon, 29 Oct 2007 15:53:32 -0200 apt (0.7.8) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From 1fcbe14d0cc5bf9892b0176993a884acffbd6ed7 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Mon, 29 Oct 2007 18:29:39 -0200 Subject: * Umount CD-ROM when calling apt-cdrom ident, except when called with -m, closes: #448521. --- apt-pkg/cdrom.cc | 7 +++++++ debian/changelog | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index afb067559..0cbdc178f 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -564,6 +564,13 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) Database.Find("CD::"+ident).c_str()); log->Update(msg.str()); } + + // Unmount and finish + if (_config->FindB("APT::CDROM::NoMount",false) == false) { + log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST); + UnmountCdrom(CDROM); + } + return true; } diff --git a/debian/changelog b/debian/changelog index 36c7aa2c2..70cfd48aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,8 +15,10 @@ apt (0.7.9) UNRELEASED; urgency=low * Applied patch from Brian M. Carlson to add backward support for arches that lacks pselect support, closes: #448406. + * Umount CD-ROM when calling apt-cdrom ident, except when called with + -m, closes: #448521. - -- Otavio Salvador Mon, 29 Oct 2007 15:53:32 -0200 + -- Otavio Salvador Mon, 29 Oct 2007 18:26:27 -0200 apt (0.7.8) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From f6b37f38731a06309dc761ffe0fdef094fdf50ca Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Wed, 31 Oct 2007 13:36:54 -0200 Subject: Minor fixes on racy_pselect --- apt-pkg/deb/dpkgpm.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index e3fe8d845..5a7711a90 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -555,10 +555,10 @@ static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds, struct timeval tv; int retval; - tv.tv_sec = timeout->tv.tv_sec; - tv.tv_usec = timeout->tv.tv_nsec/1000; + tv.tv_sec = timeout->tv_sec; + tv.tv_usec = timeout->tv_nsec/1000; - sigprocmask(SIG_SETMASK, &sigmask, &origmask); + sigprocmask(SIG_SETMASK, sigmask, &origmask); retval = select(nfds, readfds, writefds, exceptfds, &tv); sigprocmask(SIG_SETMASK, &origmask, 0); return retval; -- cgit v1.2.3-70-g09d2 From 9983591d172ba5ded02b4e697e655429546e4966 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Mon, 26 Nov 2007 15:44:46 -0200 Subject: * Applied patch from Aurelien Jarno to avoid CPU getting crazy when /dev/null is redirected to stdin (which breaks buildds), closes: #452858. --- apt-pkg/deb/dpkgpm.cc | 10 ++++++++-- apt-pkg/deb/dpkgpm.h | 2 ++ debian/changelog | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 5a7711a90..d796146fa 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -344,7 +344,10 @@ void pkgDPkgPM::DoStdin(int master) { char input_buf[256] = {0,}; int len = read(0, input_buf, sizeof(input_buf)); - write(master, input_buf, len); + if (len) + write(master, input_buf, len); + else + stdin_is_dev_null = true; } /*}}}*/ // DPkgPM::DoTerminalPty - Read the terminal pty and write log /*{{{*/ @@ -639,6 +642,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) } } + stdin_is_dev_null = false; + // create log OpenLog(); @@ -868,7 +873,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) // wait for input or output here FD_ZERO(&rfds); - FD_SET(0, &rfds); + if (!stdin_is_dev_null) + FD_SET(0, &rfds); FD_SET(_dpkgin, &rfds); if(master >= 0) FD_SET(master, &rfds); diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index b7f45b978..81a888f05 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -23,6 +23,8 @@ class pkgDPkgPM : public pkgPackageManager { private: + bool stdin_is_dev_null; + // the buffer we use for the dpkg status-fd reading char dpkgbuf[1024]; int dpkgbuf_pos; diff --git a/debian/changelog b/debian/changelog index ad860dbad..f5f9659ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,11 @@ apt (0.7.10) UNRELEASED; urgency=low apt-mark, closes: #430207. * Applied patch from Andrei Popescu to add a note about some frontends in apt.8 manpage, closes: #438545. + * Applied patch from Aurelien Jarno to avoid CPU + getting crazy when /dev/null is redirected to stdin (which breaks + buildds), closes: #452858. - -- Otavio Salvador Mon, 19 Nov 2007 17:52:34 -0200 + -- Otavio Salvador Mon, 26 Nov 2007 15:42:43 -0200 apt (0.7.9) unstable; urgency=low -- cgit v1.2.3-70-g09d2