From b40394c0ff509954c37254b0993a985ea3ff1467 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Aug 2013 09:13:27 +0200 Subject: memset() pkgTagSections data to make coverity happy --- apt-pkg/tagfile.cc | 10 ++++++++++ apt-pkg/tagfile.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 1c79ee74f..83c1a9a55 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -218,6 +218,16 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset) return true; } /*}}}*/ +// pkgTagSection::pkgTagSection - Constructor /*{{{*/ +// --------------------------------------------------------------------- +/* */ +pkgTagSection::pkgTagSection() + : Section(0), TagCount(0), Stop(0), d(NULL) +{ + memset(&Indexes, 0, sizeof(Indexes)); + memset(&AlphaIndexes, 0, sizeof(AlphaIndexes)); +} + /*}}}*/ // TagSection::Scan - Scan for the end of the header information /*{{{*/ // --------------------------------------------------------------------- /* This looks for the first double new line in the data stream. diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 126f4219d..7b496ffd8 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -84,7 +84,7 @@ class pkgTagSection Stop = this->Stop; }; - pkgTagSection() : Section(0), TagCount(0), Stop(0), d(NULL) {}; + pkgTagSection(); virtual ~pkgTagSection() {}; }; -- cgit v1.2.3 From 70e0c1683e7021a0682b0808b329a3cced3920ac Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 12 Aug 2013 17:24:15 +0200 Subject: some more coverity fixes --- apt-pkg/acquire-item.cc | 2 ++ apt-pkg/contrib/cmndline.cc | 1 + apt-pkg/contrib/strutl.cc | 2 ++ 3 files changed, 5 insertions(+) diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 7bcdf285b..f70cabeff 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -984,6 +984,8 @@ void pkgAcqIndex::Done(string Message,unsigned long long Size,string Hash, DestFile += ".decomp"; Desc.URI = decompProg + ":" + FileName; QueueURI(Desc); + + // FIXME: this points to a c++ string that goes out of scope Mode = decompProg.c_str(); } /*}}}*/ diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index 75d02cad4..d77ef4540 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -361,6 +361,7 @@ bool CommandLine::DispatchArg(Dispatch *Map,bool NoMatch) void CommandLine::SaveInConfig(unsigned int const &argc, char const * const * const argv) { char cmdline[100 + argc * 50]; + memset(cmdline, 0, sizeof(cmdline)); unsigned int length = 0; bool lastWasOption = false; bool closeQuote = false; diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index df02c3499..b70a62a47 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -943,6 +943,8 @@ bool StrToTime(const string &Val,time_t &Result) Tm.tm_isdst = 0; if (Month[0] != 0) Tm.tm_mon = MonthConv(Month); + else + Tm.tm_mon = 0; // we don't have a month, so pick something Tm.tm_year -= 1900; // Convert to local time and then to GMT -- cgit v1.2.3 From 3d4f7190d3349e1515c8f4e41b639d14fa72eb13 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 16 Aug 2013 12:44:00 +0200 Subject: Add test for bug 507998 --- .../test-bug-507998-dist-upgrade-recommends | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 test/integration/test-bug-507998-dist-upgrade-recommends diff --git a/test/integration/test-bug-507998-dist-upgrade-recommends b/test/integration/test-bug-507998-dist-upgrade-recommends new file mode 100755 index 000000000..513421a94 --- /dev/null +++ b/test/integration/test-bug-507998-dist-upgrade-recommends @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'tshark' 'amd64' '1.0.4-1' 'Depends: wireshark-common' +insertinstalledpackage 'wireshark-common' 'amd64' '1.0.4-1' 'Recommends: wireshark (>= 1.0.4-1) | tshark (>= 1.0.4-1)' +insertpackage 'unstable' 'tshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)' +insertpackage 'unstable' 'wireshark-common' 'amd64' '1.2.1-2' 'Recommends: wireshark (>= 1.2.1-2) | tshark (>= 1.2.1-2)' +insertpackage 'unstable' 'wireshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + tshark wireshark-common +2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst wireshark-common [1.0.4-1] (1.2.1-2 unstable [amd64]) +Inst tshark [1.0.4-1] (1.2.1-2 unstable [amd64]) +Conf wireshark-common (1.2.1-2 unstable [amd64]) +Conf tshark (1.2.1-2 unstable [amd64])' aptget dist-upgrade -s -- cgit v1.2.3 From 8f3aa4bd4f8a1ddc4395dab5a1e2382eed75660c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 22 Aug 2013 16:36:31 +0200 Subject: add a breaks libapt-inst for FileFd changes in 0.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partial upgrades… The fix for 704608 assumes that bf35c19b817cc1474b3deabce0b0953c248bad42 was applied to libapt-inst which isn't the case for partial upgrades of course, so break it to ensure that it is the case. Closes: 720449 --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index ca18ff01f..f2532312f 100644 --- a/debian/control +++ b/debian/control @@ -41,7 +41,7 @@ Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} -Breaks: apt (<< 0.9.4~) +Breaks: apt (<< 0.9.4~), libapt-inst1.5 (<< 0.9.9~) Section: libs Description: package management runtime library This library provides the common functionality for searching and -- cgit v1.2.3 From 5add00693a41234b218512f1f8b3e46b44f5f8d3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 22 Aug 2013 16:46:43 +0200 Subject: add versions to manpages-it Replaces+Breaks In the meantime the package was updated to remove the old APT manpages from this package, so we can now add a Breaks and version it, too. The intial Replaces was added in: b57220d815aedbc023847d0885e08c6ed50e629a --- debian/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index f2532312f..3c5d14fe8 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,8 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=apt/apt.git Package: apt Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, debian-archive-keyring, gnupg -Replaces: manpages-pl (<< 20060617-3~), manpages-it +Replaces: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~) +Breaks: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~) Conflicts: python-apt (<< 0.7.93.2~) Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, xz-utils, python-apt Description: commandline package manager -- cgit v1.2.3 From 7e02baf61fa07a83d6dd5622d135765c47f1b5dc Mon Sep 17 00:00:00 2001 From: Angel Guzman Maeso Date: Thu, 22 Aug 2013 16:54:20 +0200 Subject: fix compiler warning about sign-compare This fix avoids the warning "comparison between signed and unsigned integer expressions [-Wsign-compare]". The index for the loop needs to be unsigned for compare with globbuf.gl_pathc structure member. --- apt-pkg/contrib/fileutl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index dca468c63..47a91c294 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1777,7 +1777,8 @@ std::vector Glob(std::string const &pattern, int flags) { std::vector result; glob_t globbuf; - int glob_res, i; + int glob_res; + unsigned int i; glob_res = glob(pattern.c_str(), flags, NULL, &globbuf); -- cgit v1.2.3 From ec4835a14aae3d4995894c44ec4c4801bac0235d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Guzm=C3=A1n=20Maeso?= Date: Wed, 21 Aug 2013 19:38:35 +0200 Subject: apt-pkg:contrib Avoid compiler warning about sign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fix avoid the warning "comparison between signed and unsigned integer expressions [-Wsign-compare]"· The index for the loop needs to be unsigned for compare with globbuf.gl_pathc structure member --- apt-pkg/contrib/fileutl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index dca468c63..47a91c294 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1777,7 +1777,8 @@ std::vector Glob(std::string const &pattern, int flags) { std::vector result; glob_t globbuf; - int glob_res, i; + int glob_res; + unsigned int i; glob_res = glob(pattern.c_str(), flags, NULL, &globbuf); -- cgit v1.2.3 From 2510eea4a0922b7b6da8099deb70ca87851633ce Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Aug 2013 22:30:20 +0200 Subject: do chdir("/") after chroot() --- apt-pkg/aptconfiguration.cc | 2 +- apt-pkg/tagfile.cc | 2 +- cmdline/apt-mark.cc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index e32e553a4..4f9b84e00 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -392,7 +392,7 @@ std::vector const Configuration::getArchitectures(bool const &Cache dup2(nullfd, STDIN_FILENO); dup2(external[1], STDOUT_FILENO); dup2(nullfd, STDERR_FILENO); - if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0) + if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0 && chdir("/") != 0) _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --print-foreign-architectures", chrootDir.c_str()); execvp(Args[0], (char**) &Args[0]); _error->WarningE("getArchitecture", "Can't detect foreign architectures supported by dpkg!"); diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 868adf3d2..b91e868e2 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -237,7 +237,7 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset) // --------------------------------------------------------------------- /* */ pkgTagSection::pkgTagSection() - : Section(0), TagCount(0), Stop(0), d(NULL) + : Section(0), TagCount(0), d(NULL), Stop(0) { memset(&Indexes, 0, sizeof(Indexes)); memset(&AlphaIndexes, 0, sizeof(AlphaIndexes)); diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index eb3410be1..ebb1f9892 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -209,7 +209,7 @@ bool DoHold(CommandLine &CmdL) dup2(nullfd, STDIN_FILENO); dup2(nullfd, STDOUT_FILENO); dup2(nullfd, STDERR_FILENO); - if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0) + if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0 && chdir("/") != 0) _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --assert-multi-arch", chrootDir.c_str()); execvp(Args[0], (char**) &Args[0]); _error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!"); @@ -279,7 +279,7 @@ bool DoHold(CommandLine &CmdL) { close(external[1]); std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory"); - if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0) + if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0 && chdir("/") != 0) _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --set-selections", chrootDir.c_str()); int const nullfd = open("/dev/null", O_RDONLY); dup2(external[0], STDIN_FILENO); -- cgit v1.2.3