From f6ffe501d432d1299808ae307936877cf2c5f8ce Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 15 Mar 2014 17:59:47 +0100 Subject: Fix handling of autoclosing for compressed files (Closes: #741685) AutoClose is both an argument in OpenDescriptor() and an enum. In commit 84baaae93badc2da7c1f4f356456762895cef278 code using the AutoClose parameter was moved to OpenDescriptorInternal(). In that function, AutoClose meant the enum value, so the check was always false. --- apt-pkg/contrib/fileutl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 1eabf37f4..ba79720d8 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1191,7 +1191,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C d->openmode = Mode; d->compressor = compressor; #if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA - if (AutoClose == false && compress_open != NULL) + if ((Flags & AutoClose) != AutoClose && compress_open != NULL) { // Need to duplicate fd here or gz/bz2 close for cleanup will close the fd as well int const internFd = dup(iFd); -- cgit v1.2.3-70-g09d2 From c4b113e650dbdbb4c5c9c6f36437c94db6b214d9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 11:04:26 +0100 Subject: continue reading in xz even if it outputs nothing It can happen that content in our buffer is not enough to produce a meaningful output in which case no output is created by liblzma, but still reports that everything is okay and we should go on. The code assumes it has reached the end through if it encounters a null read, so this commit makes it so that it looks like this read was interrupted just like the lowlevel read() on uncompressed files could. It subsequently fixes the issue with that as well as until now our loop would still break even if we wanted it to continue on. (This bug triggers our usual "Hash sum mismatch" error) Reported-By: Stefan Lippers-Hollmann --- apt-pkg/contrib/fileutl.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index ba79720d8..69406a9bf 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1430,7 +1430,15 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) errno = 0; } else + { Res = Size - d->lzma->stream.avail_out; + if (Res == 0) + { + // lzma run was okay, but produced no output… + Res = -1; + errno = EINTR; + } + } } #endif else @@ -1439,7 +1447,12 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) if (Res < 0) { if (errno == EINTR) + { + // trick the while-loop into running again + Res = 1; + errno = 0; continue; + } if (false) /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB -- cgit v1.2.3-70-g09d2 From 63ff42089863cda53aee240ea0124106e8b4d983 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 15:54:15 +0100 Subject: enable fvisibility=hidden for our private library While it is a huge undertaking to enable it for our public libraries as basically everything we exported so far could be seen as public interface our private library is new and under our full control, so we can do whatever we like with it. The benefits are not that big in return of course, but it reduces the size a bit, so thats great nontheless. Git-Dch: ignore --- apt-pkg/contrib/macros.h | 4 ++++ apt-private/acqprogress.h | 9 +++++---- apt-private/makefile | 1 + apt-private/private-cachefile.h | 7 ++++--- apt-private/private-cmndline.h | 3 ++- apt-private/private-download.h | 6 ++++-- apt-private/private-install.h | 8 +++++--- apt-private/private-list.h | 4 +++- apt-private/private-main.h | 4 +++- apt-private/private-moo.h | 2 +- apt-private/private-output.h | 21 ++++++++++++--------- apt-private/private-search.h | 4 +++- apt-private/private-show.h | 4 +++- apt-private/private-sources.h | 4 +++- apt-private/private-update.h | 4 +++- apt-private/private-upgrade.h | 6 ++++-- apt-private/private-utils.h | 8 +++++--- 17 files changed, 65 insertions(+), 34 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index d97053553..2d6448e5e 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -94,8 +94,12 @@ #if APT_GCC_VERSION >= 0x0400 #define APT_SENTINEL __attribute__((sentinel)) + #define APT_PUBLIC __attribute__ ((visibility ("default"))) + #define APT_HIDDEN __attribute__ ((visibility ("hidden"))) #else #define APT_SENTINEL + #define APT_PUBLIC + #define APT_HIDDEN #endif // cold functions are unlikely() to be called diff --git a/apt-private/acqprogress.h b/apt-private/acqprogress.h index e12dafe50..71a10d78a 100644 --- a/apt-private/acqprogress.h +++ b/apt-private/acqprogress.h @@ -10,18 +10,19 @@ #define ACQPROGRESS_H #include +#include #include -class AcqTextStatus : public pkgAcquireStatus +class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus { unsigned int &ScreenWidth; char BlankLine[1024]; unsigned long ID; unsigned long Quiet; - + public: - + virtual bool MediaChange(std::string Media,std::string Drive); virtual void IMSHit(pkgAcquire::ItemDesc &Itm); virtual void Fetch(pkgAcquire::ItemDesc &Itm); @@ -29,7 +30,7 @@ class AcqTextStatus : public pkgAcquireStatus virtual void Fail(pkgAcquire::ItemDesc &Itm); virtual void Start(); virtual void Stop(); - + bool Pulse(pkgAcquire *Owner); AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet); diff --git a/apt-private/makefile b/apt-private/makefile index 728890b9b..09736c6d3 100644 --- a/apt-private/makefile +++ b/apt-private/makefile @@ -16,6 +16,7 @@ LIBRARY=apt-private MAJOR=0.0 MINOR=0 SLIBS=$(PTHREADLIB) -lapt-pkg +CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main utils sources SOURCE += $(foreach private, $(PRIVATES), private-$(private).cc) diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 67c5e8cdc..dce7e0a3a 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -5,16 +5,17 @@ #include #include #include +#include // class CacheFile - Cover class for some dependency cache functions /*{{{*/ // --------------------------------------------------------------------- /* */ -class CacheFile : public pkgCacheFile +class APT_PUBLIC CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b) APT_PURE; - + APT_HIDDEN static int NameComp(const void *a,const void *b) APT_PURE; + public: pkgCache::Package **List; diff --git a/apt-private/private-cmndline.h b/apt-private/private-cmndline.h index 76045ffe7..d0af16782 100644 --- a/apt-private/private-cmndline.h +++ b/apt-private/private-cmndline.h @@ -2,9 +2,10 @@ #define APT_PRIVATE_CMNDLINE_H #include +#include #include -std::vector getCommandArgs(char const * const Program, char const * const Cmd); +APT_PUBLIC std::vector getCommandArgs(char const * const Program, char const * const Cmd); #endif diff --git a/apt-private/private-download.h b/apt-private/private-download.h index 1447845ed..a108aa531 100644 --- a/apt-private/private-download.h +++ b/apt-private/private-download.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_DOWNLOAD_H #define APT_PRIVATE_DOWNLOAD_H +#include + class pkgAcquire; -bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); -bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); +APT_PUBLIC bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); +APT_PUBLIC bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); #endif diff --git a/apt-private/private-install.h b/apt-private/private-install.h index 79769d470..5e18560c5 100644 --- a/apt-private/private-install.h +++ b/apt-private/private-install.h @@ -9,6 +9,9 @@ #include #include #include +#include + +#include #include #include @@ -17,7 +20,6 @@ #include #include -#include "private-output.h" #include @@ -26,13 +28,13 @@ class CommandLine; #define RAMFS_MAGIC 0x858458f6 -bool DoInstall(CommandLine &Cmd); +APT_PUBLIC bool DoInstall(CommandLine &Cmd); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, std::map &verset); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache); -bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, +APT_PUBLIC bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, bool Safety = true); diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 749744dd1..461f527cb 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_LIST_H #define APT_PRIVATE_LIST_H +#include + class CommandLine; -bool List(CommandLine &Cmd); +APT_PUBLIC bool List(CommandLine &Cmd); #endif diff --git a/apt-private/private-main.h b/apt-private/private-main.h index 257c51a0b..23d4aca68 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_MAIN_H #define APT_PRIVATE_MAIN_H +#include + class CommandLine; -void CheckSimulateMode(CommandLine &CmdL); +APT_PUBLIC void CheckSimulateMode(CommandLine &CmdL); #endif diff --git a/apt-private/private-moo.h b/apt-private/private-moo.h index 7bfc5c1fc..b8e1cfed6 100644 --- a/apt-private/private-moo.h +++ b/apt-private/private-moo.h @@ -3,7 +3,7 @@ class CommandLine; -bool DoMoo(CommandLine &CmdL); +APT_PUBLIC bool DoMoo(CommandLine &CmdL); bool DoMoo1(CommandLine &CmdL); bool DoMoo2(CommandLine &CmdL); bool DoMoo3(CommandLine &CmdL); diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 81643f90a..9633d0c37 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -2,6 +2,7 @@ #define APT_PRIVATE_OUTPUT_H #include +#include #include #include @@ -13,22 +14,24 @@ class pkgDepCache; class pkgRecords; -extern std::ostream c0out; -extern std::ostream c1out; -extern std::ostream c2out; -extern std::ofstream devnull; -extern unsigned int ScreenWidth; +APT_PUBLIC extern std::ostream c0out; +APT_PUBLIC extern std::ostream c1out; +APT_PUBLIC extern std::ostream c2out; +APT_PUBLIC extern std::ofstream devnull; +APT_PUBLIC extern unsigned int ScreenWidth; -bool InitOutput(); -void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, +APT_PUBLIC bool InitOutput(); + +void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::VerIterator V, std::ostream &out, bool include_summary=true); // helper to describe global state -bool ShowList(std::ostream &out, std::string Title, std::string List, +APT_PUBLIC void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); + +APT_PUBLIC bool ShowList(std::ostream &out, std::string Title, std::string List, std::string VersionsList); -void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); void ShowNew(std::ostream &out,CacheFile &Cache); void ShowDel(std::ostream &out,CacheFile &Cache); void ShowKept(std::ostream &out,CacheFile &Cache); diff --git a/apt-private/private-search.h b/apt-private/private-search.h index 539915f1f..d4786233a 100644 --- a/apt-private/private-search.h +++ b/apt-private/private-search.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_SEARCH_H #define APT_PRIVATE_SEARCH_H +#include + class CommandLine; -bool FullTextSearch(CommandLine &CmdL); +APT_PUBLIC bool FullTextSearch(CommandLine &CmdL); #endif diff --git a/apt-private/private-show.h b/apt-private/private-show.h index a15367e28..359aeeb28 100644 --- a/apt-private/private-show.h +++ b/apt-private/private-show.h @@ -1,12 +1,14 @@ #ifndef APT_PRIVATE_SHOW_H #define APT_PRIVATE_SHOW_H +#include + class CommandLine; namespace APT { namespace Cmd { - bool ShowPackage(CommandLine &CmdL); + APT_PUBLIC bool ShowPackage(CommandLine &CmdL); } } #endif diff --git a/apt-private/private-sources.h b/apt-private/private-sources.h index 4c58af180..0c421902e 100644 --- a/apt-private/private-sources.h +++ b/apt-private/private-sources.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_SOURCES_H #define APT_PRIVATE_SOURCES_H +#include + class CommandLine; -bool EditSources(CommandLine &CmdL); +APT_PUBLIC bool EditSources(CommandLine &CmdL); #endif diff --git a/apt-private/private-update.h b/apt-private/private-update.h index d3d0b7af9..e584f70cf 100644 --- a/apt-private/private-update.h +++ b/apt-private/private-update.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_UPDATE_H #define APT_PRIVATE_UPDATE_H +#include + class CommandLine; -bool DoUpdate(CommandLine &CmdL); +APT_PUBLIC bool DoUpdate(CommandLine &CmdL); #endif diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h index 64c4c0874..16bb93c9b 100644 --- a/apt-private/private-upgrade.h +++ b/apt-private/private-upgrade.h @@ -1,10 +1,12 @@ #ifndef APTPRIVATE_PRIVATE_UPGRADE_H #define APTPRIVATE_PRIVATE_UPGRADE_H +#include + class CommandLine; -bool DoDistUpgrade(CommandLine &CmdL); -bool DoUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoDistUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoUpgrade(CommandLine &CmdL); bool DoUpgradeNoNewPackages(CommandLine &CmdL); bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); diff --git a/apt-private/private-utils.h b/apt-private/private-utils.h index 4bb535e86..432699787 100644 --- a/apt-private/private-utils.h +++ b/apt-private/private-utils.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_UTILS_H #define APT_PRIVATE_UTILS_H -#include +#include -void DisplayFileInPager(std::string filename); -void EditFileInSensibleEditor(std::string filename); +#include + +APT_PUBLIC void DisplayFileInPager(std::string filename); +APT_PUBLIC void EditFileInSensibleEditor(std::string filename); #endif -- cgit v1.2.3-70-g09d2 From ce62f1def6565375ce9c56eb1237ccdc0ca138ba Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 16:26:01 +0100 Subject: mark optional (private) symbols as hidden This methods should not be used by anyone expect the library itself as they are helpers for the specific class and therefore perfect candidates for hidding. Git-Dch: Ignore --- apt-pkg/acquire-method.h | 4 ++- apt-pkg/cdrom.h | 4 ++- apt-pkg/contrib/fileutl.h | 6 ++--- apt-pkg/deb/deblistparser.h | 3 ++- apt-pkg/edsp.h | 11 ++++---- apt-pkg/pkgcachegen.h | 18 ++++++------- apt-pkg/tagfile.h | 8 +++--- debian/libapt-pkg4.12.symbols | 59 ++++++++++++++----------------------------- 8 files changed, 50 insertions(+), 63 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index f0f2a537a..221ccf273 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -20,6 +20,8 @@ #ifndef PKGLIB_ACQUIRE_METHOD_H #define PKGLIB_ACQUIRE_METHOD_H +#include + #include #include @@ -107,7 +109,7 @@ class pkgAcqMethod virtual ~pkgAcqMethod() {}; private: - void Dequeue(); + APT_HIDDEN void Dequeue(); }; /** @} */ diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h index 0ed4a6a73..0f2c2cd02 100644 --- a/apt-pkg/cdrom.h +++ b/apt-pkg/cdrom.h @@ -1,6 +1,8 @@ #ifndef PKGLIB_CDROM_H #define PKGLIB_CDROM_H +#include + #include #include @@ -73,7 +75,7 @@ class pkgCdrom /*{{{*/ bool Add(pkgCdromStatus *log); private: - bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM, + APT_HIDDEN bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM, std::string &ident, pkgCdromStatus * const log, bool const interactive); }; /*}}}*/ diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 278a25742..f25ed3622 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -150,11 +150,11 @@ class FileFd private: FileFdPrivate* d; - bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor); + APT_HIDDEN bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor); // private helpers to set Fail flag and call _error->Error - bool FileFdErrno(const char* Function, const char* Description,...) APT_PRINTF(3) APT_COLD; - bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; + APT_HIDDEN bool FileFdErrno(const char* Function, const char* Description,...) APT_PRINTF(3) APT_COLD; + APT_HIDDEN bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; }; bool RunScripts(const char *Cnf); diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 286244cc9..baace79fe 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -102,7 +103,7 @@ class debListParser : public pkgCacheGenerator::ListParser virtual ~debListParser() {}; private: - unsigned char ParseMultiArch(bool const showErrors); + APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors); }; #endif diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h index ae20ed7db..f3092d3c6 100644 --- a/apt-pkg/edsp.h +++ b/apt-pkg/edsp.h @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -32,15 +33,15 @@ class EDSP /*{{{*/ static const char * const PrioMap[]; static const char * const DepMap[]; - bool static ReadLine(int const input, std::string &line); - bool static StringToBool(char const *answer, bool const defValue); + APT_HIDDEN bool static ReadLine(int const input, std::string &line); + APT_HIDDEN bool static StringToBool(char const *answer, bool const defValue); - void static WriteScenarioVersion(pkgDepCache &Cache, FILE* output, + APT_HIDDEN void static WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver); - void static WriteScenarioDependency(FILE* output, + APT_HIDDEN void static WriteScenarioDependency(FILE* output, pkgCache::VerIterator const &Ver); - void static WriteScenarioLimitedDependency(FILE* output, + APT_HIDDEN void static WriteScenarioLimitedDependency(FILE* output, pkgCache::VerIterator const &Ver, APT::PackageSet const &pkgset); public: diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 5994dab9f..1e1a71026 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -38,10 +38,10 @@ class pkgCacheGenerator /*{{{*/ private: pkgCache::StringItem *UniqHash[26]; - map_ptrloc WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; - map_ptrloc WriteStringInMap(const char *String); - map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len); - map_ptrloc AllocateInMap(const unsigned long &size); + APT_HIDDEN map_ptrloc WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; + APT_HIDDEN map_ptrloc WriteStringInMap(const char *String); + APT_HIDDEN map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len); + APT_HIDDEN map_ptrloc AllocateInMap(const unsigned long &size); public: @@ -117,14 +117,14 @@ class pkgCacheGenerator /*{{{*/ ~pkgCacheGenerator(); private: - bool MergeListGroup(ListParser &List, std::string const &GrpName); - bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg); - bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg, + APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName); + APT_HIDDEN bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg); + APT_HIDDEN bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg, std::string const &Version, pkgCache::VerIterator* &OutVer); - bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator &P, + APT_HIDDEN bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator &P, pkgCache::VerIterator &V); - bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D); + APT_HIDDEN bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D); }; /*}}}*/ // This is the abstract package list parser class. /*{{{*/ diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 2f600d397..d5b62e76d 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -20,6 +20,8 @@ #ifndef PKGLIB_TAGFILE_H #define PKGLIB_TAGFILE_H +#include + #include #include @@ -93,9 +95,9 @@ class pkgTagFile { pkgTagFilePrivate *d; - bool Fill(); - bool Resize(); - bool Resize(unsigned long long const newSize); + APT_HIDDEN bool Fill(); + APT_HIDDEN bool Resize(); + APT_HIDDEN bool Resize(unsigned long long const newSize); public: diff --git a/debian/libapt-pkg4.12.symbols b/debian/libapt-pkg4.12.symbols index c1747bc9e..b6c2f75b0 100644 --- a/debian/libapt-pkg4.12.symbols +++ b/debian/libapt-pkg4.12.symbols @@ -184,9 +184,7 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgRecords::Parser::~Parser()@Base" 0.8.0 (c++)"pkgRecords::pkgRecords(pkgCache&)@Base" 0.8.0 (c++)"pkgRecords::~pkgRecords()@Base" 0.8.0 - (c++)"pkgTagFile::Fill()@Base" 0.8.0 (c++)"pkgTagFile::Step(pkgTagSection&)@Base" 0.8.0 - (c++)"pkgTagFile::Resize()@Base" 0.8.0 (c++)"pkgTagFile::~pkgTagFile()@Base" 0.8.0 (c++)"CdromDevice::~CdromDevice()@Base" 0.8.0 (c++)"CommandLine::DispatchArg(CommandLine::Dispatch*, bool)@Base" 0.8.0 @@ -517,11 +515,8 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgCacheGenerator::SelectFile(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, pkgIndexFile const&, unsigned long)@Base" 0.8.0 (c++)"pkgCacheGenerator::FinishCache(OpProgress*)@Base" 0.8.0 (c++)"pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator&, pkgCacheGenerator::ListParser&)@Base" 0.8.0 - (c++)"pkgCacheGenerator::AllocateInMap(unsigned long const&)@Base" 0.8.0 (c++)"pkgCacheGenerator::MakeStatusCache(pkgSourceList&, OpProgress*, MMap**, bool)@Base" 0.8.0 (c++)"pkgCacheGenerator::WriteUniqString(char const*, unsigned int)@Base" 0.8.0 - (c++)"pkgCacheGenerator::WriteStringInMap(char const*)@Base" 0.8.0 - (c++)"pkgCacheGenerator::WriteStringInMap(char const*, unsigned long const&)@Base" 0.8.0 (c++)"pkgCacheGenerator::CreateDynamicMMap(FileFd*, unsigned long)@Base" 0.8.0 (c++)"pkgCacheGenerator::MergeFileProvides(pkgCacheGenerator::ListParser&)@Base" 0.8.0 (c++)"pkgCacheGenerator::MakeOnlyStatusCache(OpProgress*, DynamicMMap**)@Base" 0.8.0 @@ -1126,24 +1121,24 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (arch=sh4|c++)"pkgAcqMethod::PrintStatus(char const*, char const*, __builtin_va_list&) const@Base" 0.8.15~exp1 (arch=alpha|c++)"pkgAcqMethod::PrintStatus(char const*, char const*, __va_list_tag&) const@Base" 0.8.15~exp1 ### architecture specific: va_list & size_t - (arch=i386 hurd-i386 kfreebsd-i386|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned int&)@Base" 0.8.11.4 - (arch=armel armhf|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, std::__va_list&, unsigned int&)@Base" 0.8.11.4 - (arch=alpha|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag&, unsigned long&)@Base" 0.8.11.4 - (arch=powerpc powerpcspe x32|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned int&)@Base" 0.8.11.4 - (arch=amd64 kfreebsd-amd64 s390 s390x|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned long&)@Base" 0.8.11.4 - (arch=hppa mips mipsel sparc|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned int&)@Base" 0.8.11.4 - (arch=ia64 sparc64|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned long&)@Base" 0.8.11.4 - (arch=sh4|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __builtin_va_list&, unsigned int&)@Base" 0.8.11.4 - (arch=ppc64|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned long&)@Base" 0.8.11.4 - (arch=i386 hurd-i386 kfreebsd-i386|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned int&)@Base" 0.8.11.4 - (arch=armel armhf|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, std::__va_list&, int, unsigned int&)@Base" 0.8.11.4 - (arch=alpha|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag&, int, unsigned long&)@Base" 0.8.11.4 - (arch=powerpc powerpcspe x32|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned int&)@Base" 0.8.11.4 - (arch=amd64 kfreebsd-amd64 s390 s390x|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned long&)@Base" 0.8.11.4 - (arch=hppa mips mipsel sparc|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned int&)@Base" 0.8.11.4 - (arch=ia64 sparc64|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned long&)@Base" 0.8.11.4 1 - (arch=sh4|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __builtin_va_list&, int, unsigned int&)@Base" 0.8.11.4 - (arch=ppc64|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned long&)@Base" 0.8.11.4 + (arch=i386 hurd-i386 kfreebsd-i386|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned int&)@Base" 0.8.11.4 + (arch=armel armhf|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, std::__va_list&, unsigned int&)@Base" 0.8.11.4 + (arch=alpha|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag&, unsigned long&)@Base" 0.8.11.4 + (arch=powerpc powerpcspe x32|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned int&)@Base" 0.8.11.4 + (arch=amd64 kfreebsd-amd64 s390 s390x|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned long&)@Base" 0.8.11.4 + (arch=hppa mips mipsel sparc|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned int&)@Base" 0.8.11.4 + (arch=ia64 sparc64|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned long&)@Base" 0.8.11.4 + (arch=sh4|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __builtin_va_list&, unsigned int&)@Base" 0.8.11.4 + (arch=ppc64|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned long&)@Base" 0.8.11.4 + (arch=i386 hurd-i386 kfreebsd-i386|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned int&)@Base" 0.8.11.4 + (arch=armel armhf|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, std::__va_list&, int, unsigned int&)@Base" 0.8.11.4 + (arch=alpha|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag&, int, unsigned long&)@Base" 0.8.11.4 + (arch=powerpc powerpcspe x32|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned int&)@Base" 0.8.11.4 + (arch=amd64 kfreebsd-amd64 s390 s390x|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned long&)@Base" 0.8.11.4 + (arch=hppa mips mipsel sparc|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned int&)@Base" 0.8.11.4 + (arch=ia64 sparc64|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned long&)@Base" 0.8.11.4 1 + (arch=sh4|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __builtin_va_list&, int, unsigned int&)@Base" 0.8.11.4 + (arch=ppc64|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned long&)@Base" 0.8.11.4 ### architecture specific: size_t (arch=i386 armel armhf hppa hurd-i386 kfreebsd-i386 mips mipsel powerpc powerpcspe sh4 sparc x32|c++)"_strtabexpand(char*, unsigned int)@Base" 0.8.0 (arch=alpha amd64 ia64 kfreebsd-amd64 s390 s390x sparc64 ppc64|c++)"_strtabexpand(char*, unsigned long)@Base" 0.8.0 @@ -1196,7 +1191,7 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"APT::Configuration::getCompressorExtensions()@Base" 0.8.12 (c++)"APT::Configuration::setDefaultConfigurationForCompressors()@Base" 0.8.12 (c++)"pkgAcqMetaClearSig::Custom600Headers()@Base" 0.8.13 - (c++|optional=private)"debListParser::NewProvidesAllArch(pkgCache::VerIterator&, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&)@Base" 0.8.13.2 + (c++)"debListParser::NewProvidesAllArch(pkgCache::VerIterator&, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&)@Base" 0.8.13.2 (c++)"pkgDepCache::IsModeChangeOk(pkgDepCache::ModeList, pkgCache::PkgIterator const&, unsigned long, bool)@Base" 0.8.13.2 (c++)"pkgCache::DepIterator::IsNegative() const@Base" 0.8.15~exp1 (c++)"Configuration::CndSet(char const*, int)@Base" 0.8.15.3 @@ -1237,18 +1232,14 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"EDSP::ReadRequest(int, std::list, std::allocator >, std::allocator, std::allocator > > >&, std::list, std::allocator >, std::allocator, std::allocator > > >&, bool&, bool&, bool&)@Base" 0.8.16~exp2 (c++)"EDSP::ApplyRequest(std::list, std::allocator >, std::allocator, std::allocator > > > const&, std::list, std::allocator >, std::allocator, std::allocator > > > const&, pkgDepCache&)@Base" 0.8.16~exp2 (c++)"EDSP::ReadResponse(int, pkgDepCache&, OpProgress*)@Base" 0.8.16~exp2 - (c++)"EDSP::StringToBool(char const*, bool)@Base" 0.8.16~exp2 (c++)"EDSP::WriteRequest(pkgDepCache&, _IO_FILE*, bool, bool, bool, OpProgress*)@Base" 0.8.16~exp2 (c++)"EDSP::ExecuteSolver(char const*, int*, int*)@Base" 0.8.16~exp2 (c++)"EDSP::WriteProgress(unsigned short, char const*, _IO_FILE*)@Base" 0.8.16~exp2 (c++)"EDSP::WriteScenario(pkgDepCache&, _IO_FILE*, OpProgress*)@Base" 0.8.16~exp2 (c++)"EDSP::WriteSolution(pkgDepCache&, _IO_FILE*)@Base" 0.8.16~exp2 (c++)"EDSP::ResolveExternal(char const*, pkgDepCache&, bool, bool, bool, OpProgress*)@Base" 0.8.16~exp2 - (c++)"EDSP::WriteScenarioVersion(pkgDepCache&, _IO_FILE*, pkgCache::PkgIterator const&, pkgCache::VerIterator const&)@Base" 0.8.16~exp2 - (c++)"EDSP::WriteScenarioDependency(pkgDepCache&, _IO_FILE*, pkgCache::PkgIterator const&, pkgCache::VerIterator const&)@Base" 0.8.16~exp2 (c++)"EDSP::DepMap@Base" 0.8.16~exp2 (c++)"EDSP::PrioMap@Base" 0.8.16~exp2 - (c++)"EDSP::ReadLine(int, std::basic_string, std::allocator >&)@Base" 0.8.16~exp2 (c++)"pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const&)@Base" 0.8.16~exp6 (c++)"pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const&)@Base" 0.8.16~exp6 (c++)"typeinfo for edspIFType@Base" 0.8.16~exp2 @@ -1385,7 +1376,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"SummationImplementation::AddFD(FileFd&, unsigned long long)@Base" 0.8.16~exp9 (c++)"Hashes::AddFD(FileFd&, unsigned long long, bool, bool, bool, bool)@Base" 0.8.16~exp9 (c++|optional=deprecated,previous-inline)"FileFd::gzFd()@Base" 0.8.0 - (c++|optional=private)"FileFd::OpenInternDescriptor(unsigned int, APT::Configuration::Compressor const&)@Base" 0.8.16~exp9 ### CacheSet rework: making them real containers breaks bigtime the API (for the CacheSetHelper) (c++)"APT::PackageContainer, std::allocator > >::const_iterator::getPkg() const@Base" 0.8.16~exp9 (c++)"APT::PackageContainer, std::allocator > >::getConstructor() const@Base" 0.8.16~exp9 @@ -1425,7 +1415,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"APT::VersionContainerInterface::getInstalledVer(pkgCacheFile&, pkgCache::PkgIterator const&, APT::CacheSetHelper&)@Base" 0.8.16~exp9 (c++)"APT::VersionContainerInterface::FromModifierCommandLine(unsigned short&, APT::VersionContainerInterface*, pkgCacheFile&, char const*, std::list > const&, APT::CacheSetHelper&)@Base" 0.8.16~exp9 (c++)"EDSP::WriteLimitedScenario(pkgDepCache&, _IO_FILE*, APT::PackageContainer, std::allocator > > const&, OpProgress*)@Base" 0.8.16~exp9 - (c++)"EDSP::WriteScenarioLimitedDependency(pkgDepCache&, _IO_FILE*, pkgCache::PkgIterator const&, pkgCache::VerIterator const&, APT::PackageContainer, std::allocator > > const&)@Base" 0.8.16~exp9 (c++)"typeinfo for APT::PackageContainer, std::allocator > >::const_iterator@Base" 0.8.16~exp9 (c++)"typeinfo for APT::PackageContainer, std::allocator > >@Base" 0.8.16~exp9 (c++)"typeinfo for APT::PackageContainer > >::const_iterator@Base" 0.8.16~exp9 @@ -1537,11 +1526,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgCache::DepIterator::IsIgnorable(pkgCache::PkgIterator const&) const@Base" 0.8.16~exp10 (c++)"pkgCache::DepIterator::IsIgnorable(pkgCache::PrvIterator const&) const@Base" 0.8.16~exp10 (c++)"FileFd::Write(int, void const*, unsigned long long)@Base" 0.8.16~exp14 - (c++|optional=private)"pkgCacheGenerator::MergeListGroup(pkgCacheGenerator::ListParser&, std::basic_string, std::allocator > const&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::MergeListPackage(pkgCacheGenerator::ListParser&, pkgCache::PkgIterator&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::MergeListVersion(pkgCacheGenerator::ListParser&, pkgCache::PkgIterator&, std::basic_string, std::allocator > const&, pkgCache::VerIterator*&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::AddImplicitDepends(pkgCache::GrpIterator&, pkgCache::PkgIterator&, pkgCache::VerIterator&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::AddImplicitDepends(pkgCache::VerIterator&, pkgCache::PkgIterator&)@Base" 0.8.16~exp7 (c++)"pkgTagSection::Exists(char const*)@Base" 0.9.7.9~exp1 (c++)"_strrstrip(char*)@Base" 0.9.7.9~exp2 (c++)"SplitClearSignedFile(std::basic_string, std::allocator > const&, FileFd*, std::vector, std::allocator >, std::allocator, std::allocator > > >*, FileFd*)@Base" 0.9.7.9~exp2 @@ -1550,7 +1534,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"SigVerify::RunGPGV(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, int const&)@Base" 0.9.7.9~exp2 (c++)"Configuration::Dump(std::basic_ostream >&, char const*, char const*, bool)@Base" 0.9.3 (c++)"AcquireUpdate(pkgAcquire&, int, bool, bool)@Base" 0.9.3 - (c++|optional=private)"pkgAcqMethod::Dequeue()@Base" 0.9.4 (c++)"pkgCache::DepIterator::IsMultiArchImplicit() const@Base" 0.9.6 (c++)"pkgCache::PrvIterator::IsMultiArchImplicit() const@Base" 0.9.6 (c++)"APT::PackageContainerInterface::FromGroup(APT::PackageContainerInterface*, pkgCacheFile&, std::basic_string, std::allocator >, APT::CacheSetHelper&)@Base" 0.9.7 @@ -1565,8 +1548,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgCache::DepIterator::IsSatisfied(pkgCache::VerIterator const&) const@Base" 0.9.8 (c++)"pkgCacheGenerator::NewDepends(pkgCache::PkgIterator&, pkgCache::VerIterator&, unsigned int, unsigned int const&, unsigned int const&, unsigned int*&)@Base" 0.9.8 (c++)"pkgCacheGenerator::NewVersion(pkgCache::VerIterator&, std::basic_string, std::allocator > const&, unsigned int, unsigned long, unsigned long)@Base" 0.9.8 - (c++)"FileFd::FileFdErrno(char const*, char const*, ...)@Base" 0.9.9 - (c++)"FileFd::FileFdError(char const*, ...)@Base" 0.9.9 (c++)"operator<<(std::basic_ostream >&, GlobalError::Item)@Base" 0.9.9 (c++)"pkgDepCache::IsDeleteOkProtectInstallRequests(pkgCache::PkgIterator const&, bool, unsigned long, bool)@Base" 0.9.9.1 (c++)"pkgDepCache::IsInstallOkMultiArchSameVersionSynced(pkgCache::PkgIterator const&, bool, unsigned long, bool)@Base" 0.9.9.1 @@ -1579,7 +1560,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"APT::CacheFilter::PackageNameMatchesFnmatch::operator()(pkgCache::GrpIterator const&)@Base" 0.9.11 (c++)"APT::CacheFilter::PackageNameMatchesFnmatch::operator()(pkgCache::PkgIterator const&)@Base" 0.9.11 (c++)"APT::PackageContainerInterface::FromFnmatch(APT::PackageContainerInterface*, pkgCacheFile&, std::basic_string, std::allocator >, APT::CacheSetHelper&)@Base" 0.9.11 - (c++|optional=private)"pkgTagFile::Resize(unsigned long long)@Base" 0.9.11 (c++)"pkgTagSection::pkgTagSection()@Base" 0.9.11 (c++)"strv_length(char const**)@Base" 0.9.11 (c++)"StringSplit(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, unsigned int)@Base" 0.9.11.3 @@ -1591,7 +1571,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"HashString::GetHashForFile(std::basic_string, std::allocator >) const@Base" 0.9.13.1 (c++)"indexRecords::GetSuite() const@Base" 0.9.13.2 (c++)"GetTempDir()@Base" 0.9.14.2 - (c++|optional=private)"pkgCdrom::MountAndIdentCDROM(Configuration&, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, pkgCdromStatus*)@Base" 0.9.15.2 ### demangle strangeness - buildd report it as MISSING and as new… (c++)"pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire*, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::vector > const*, indexRecords*)@Base" 0.8.0 ### gcc-4.6 artefacts -- cgit v1.2.3-70-g09d2 From d151adbf2cc4d23c240c6c4fcfbfda439a98c36f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 22 Mar 2014 21:35:57 +0100 Subject: ensure proper teardown in dpkg error cases We have to properly close our pseudo terminals even in error cases before we call post-invoke scripts. This is done now by breaking from the dpkg calling loop instead of copying the handling, which did it in the wrong order before. This also ensures that our state file is written in error cases to record autobit and co as this was forgotten before. Closes: 738969 --- apt-pkg/deb/dpkgpm.cc | 24 ++-- .../test-apt-progress-fd-error-postinst | 22 ---- test/integration/test-failing-maintainer-scripts | 132 +++++++++++++++++++++ 3 files changed, 139 insertions(+), 39 deletions(-) delete mode 100755 test/integration/test-apt-progress-fd-error-postinst create mode 100755 test/integration/test-failing-maintainer-scripts (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 9fee7c923..5a5fff13b 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1530,28 +1530,18 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress) // here but keep the loop going and just report it as a error // for later bool const stopOnError = _config->FindB("Dpkg::StopOnError",true); - - if(stopOnError) - RunScripts("DPkg::Post-Invoke"); - if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) + if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) strprintf(d->dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]); else if (WIFEXITED(Status) != 0) strprintf(d->dpkg_error, "Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status)); - else + else strprintf(d->dpkg_error, "Sub-process %s exited unexpectedly",Args[0]); + _error->Error("%s", d->dpkg_error.c_str()); - if(d->dpkg_error.size() > 0) - _error->Error("%s", d->dpkg_error.c_str()); - - if(stopOnError) - { - CloseLog(); - StopPtyMagic(); - d->progress->Stop(); - return false; - } - } + if(stopOnError) + break; + } } // dpkg is done at this point d->progress->Stop(); @@ -1582,7 +1572,7 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress) } Cache.writeStateFile(NULL); - return true; + return d->dpkg_error.empty(); } void SigINT(int /*sig*/) { diff --git a/test/integration/test-apt-progress-fd-error-postinst b/test/integration/test-apt-progress-fd-error-postinst deleted file mode 100755 index 0b6e70212..000000000 --- a/test/integration/test-apt-progress-fd-error-postinst +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -configarchitecture 'amd64' 'i386' - -mkdir -p DEBIAN/ -echo "#!/bin/sh\nexit 1" > DEBIAN/postinst -chmod 755 DEBIAN/postinst - -buildsimplenativepackage 'postinst-error' 'amd64,i386' '0.8.15' 'stable' '' 'pkg with posinst error' '' '' './DEBIAN' - -setupaptarchive - -exec 3> apt-progress.log -testfailure aptget install postinst-error -y -o APT::Status-Fd=3 -msgtest "Ensure correct error message for postinst error" -grep -q "pmerror:postinst-error :80:subprocess installed post-installation script returned error exit status 2" apt-progress.log && msgpass || msgfail - diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts new file mode 100755 index 000000000..cb82ebc7a --- /dev/null +++ b/test/integration/test-failing-maintainer-scripts @@ -0,0 +1,132 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'native' + +# create a bunch of failures +createfailure() { + setupsimplenativepackage "failure-$1" 'native' '1.0' 'unstable' 'Depends: dependee' + BUILDDIR="incoming/failure-$1-1.0" + echo '#!/bin/sh +exit 29' > ${BUILDDIR}/debian/$1 + buildpackage "$BUILDDIR" 'unstable' 'main' 'native' + rm -rf "$BUILDDIR" +} + +buildsimplenativepackage 'dependee' 'native' '1.0' 'unstable' +createfailure 'preinst' +createfailure 'postinst' +createfailure 'prerm' +createfailure 'postrm' + +setupaptarchive + +# create a library to noop chroot() and rewrite maintainer script executions +# via execvp() as used by dpkg as we don't want our rootdir to be a fullblown +# chroot directory dpkg could chroot into to execute the maintainer scripts +cat << EOF > noopchroot.c +#define _GNU_SOURCE +#include +#include +#include +#include + +static char * chrootdir = NULL; + +int chroot(const char *path) { + printf("WARNING: CHROOTing to %s was ignored!\n", path); + free(chrootdir); + chrootdir = strdup(path); + return 0; +} +int execvp(const char *file, char *const argv[]) { + static int (*func_execvp) (const char *, char * const []) = NULL; + if (func_execvp == NULL) + func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); + if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) + return func_execvp(file, argv); + printf("REWRITE execvp call %s into %s\n", file, chrootdir); + char newfile[strlen(chrootdir) + strlen(file)]; + strcpy(newfile, chrootdir); + strcat(newfile, file); + return func_execvp(newfile, argv); +} +EOF +testsuccess gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl + +mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" +DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" +echo "#!/bin/sh +if [ -n \"\$LD_PRELOAD\" ]; then + export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\" +else + export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\" +fi +dpkg \"\$@\"" > $DPKG +chmod +x $DPKG +sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf + +# setup some pre- and post- invokes to check the output isn't garbled later +APTHOOK="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apthook" +echo '#!/bin/sh +echo "$1: START" +echo "$1: MaiN" +echo "$1: ENd"' > $APTHOOK +chmod +x $APTHOOK +echo "DPKG::Pre-Invoke:: \"${APTHOOK} PRE\"; +DPKG::Post-Invoke:: \"${APTHOOK} POST\";" > rootdir/etc/apt/apt.conf.d/99apthooks + +testmyfailure() { + local PROGRESS='rootdir/tmp/progress.log' + exec 3> $PROGRESS + testfailure "$@" -o APT::Status-Fd=3 + msgtest 'Test for failure message of maintainerscript in' 'console log' + local TEST='rootdir/tmp/testfailure.output' + if grep -q 'exit status 29$' "$TEST"; then + msgpass + else + cat $TEST + msgfail + fi + msgtest 'Test for proper execution of invoke scripts in' 'console log' + if grep -q '^PRE: START$' $TEST && + grep -q '^PRE: MaiN$' $TEST && + grep -q '^PRE: ENd$' $TEST && + grep -q '^POST: START$' $TEST && + grep -q '^POST: MaiN$' $TEST && + grep -q '^POST: ENd$' $TEST; then + msgpass + else + cat $TEST + msgfail + fi + msgtest 'Test for failure message of maintainerscript in' 'progress log' + if grep -q '^pmerror:.\+exit status 29$' "$PROGRESS"; then + msgpass + else + cat $PROGRESS + msgfail + fi + testmarkedauto 'dependee' +} + +cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status.backup +testmyfailure aptget install failure-preinst -y +cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status +testmyfailure aptget install failure-postinst -y +cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status +testsuccess aptget install failure-prerm -y +testdpkginstalled failure-prerm +testmyfailure aptget purge failure-prerm -y +cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status +testsuccess aptget install failure-postrm -y +testdpkginstalled failure-postrm +testmyfailure aptget purge failure-postrm -y + +# FIXME: test with output going to a PTY as it usually does +#cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status +#aptget install failure-preinst -y -- cgit v1.2.3-70-g09d2 From be7ce6f1d067fa62b01685e48094f3f73c95189f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 11 Mar 2014 15:32:40 +0100 Subject: do IsInstallOk call in MarkInstall unconditionally Hooked checks could be influenced by AutoInst as a lot can happen between a call without and one with this bit set. The real cache-hit check is above this call already. Individual hooked checks can then inspect the state if they want to cache. Calling them multiple times shouldn't be a problem either way. --- apt-pkg/depcache.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index e2c412757..5fa88a5d2 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1059,10 +1059,9 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, return true; } - // check if we are allowed to install the package (if we haven't already) - if (P.Mode != ModeInstall || P.InstallVer != P.CandidateVer) - if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false) - return false; + // check if we are allowed to install the package + if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false) + return false; ActionGroup group(*this); P.iFlags &= ~AutoKept; @@ -1308,6 +1307,11 @@ bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg, if (FromUser == true) // as always: user is always right return true; + // if we have checked before and it was okay, it will still be okay + if (PkgState[Pkg->ID].Mode == ModeInstall && + PkgState[Pkg->ID].InstallVer == PkgState[Pkg->ID].CandidateVer) + return true; + // ignore packages with none-M-A:same candidates VerIterator const CandVer = PkgState[Pkg->ID].CandidateVerIter(*this); if (unlikely(CandVer.end() == true) || CandVer == Pkg.CurrentVer() || -- cgit v1.2.3-70-g09d2 From 21b3eac8f9ab8e12b43fa8998a5aa5465f29adc5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 11 Mar 2014 10:31:44 +0100 Subject: discard candidates via IsInstallOk to allow override In commit 446551c8 I changed MarkInstall to discard the candidate if the candidate can't satisfy the dependency. This breaks interactive solvers like aptitude which can change the candidate on-the-fly later. In commit df77d8a5 I introduced this 'early' loop-breaking to begin with which can't be that helpful for interactive solvers as well, but makes perfect sense for non-interactives to stop them from exploring trees which can't be satisfied, but it isn't perfect as ideally we would check this before auto-installing the first dependency. This commit therefore moves the loop into its own IsInstallOk hook so that frontends can override this check if they want to and in exchange removes the loop-breaking from MarkInstall itself and does it before any dependency is installed. Closes: 740750 --- apt-pkg/depcache.cc | 78 ++++++++++++++++------ apt-pkg/depcache.h | 2 + .../test-bug-735967-lib32-to-i386-unavailable | 3 + 3 files changed, 63 insertions(+), 20 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 5fa88a5d2..19a6e0d7e 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1122,32 +1122,22 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, continue; /* Check if this dep should be consider for install. If it is a user - defined important dep and we are installed a new package then + defined important dep and we are installed a new package then it will be installed. Otherwise we only check for important - deps that have changed from the installed version - */ + deps that have changed from the installed version */ if (IsImportantDep(Start) == false) continue; - /* If we are in an or group locate the first or that can - succeed. We have already cached this.. */ + /* If we are in an or group locate the first or that can + succeed. We have already cached this… */ for (; Ors > 1 && (DepState[Start->ID] & DepCVer) != DepCVer; --Ors) ++Start; + + /* unsatisfiable dependency: IsInstallOkDependenciesSatisfiableByCandidates + would have prevented us to get here if not overridden, so just skip + over the problem here as the frontend will know what it is doing */ if (Ors == 1 && (DepState[Start->ID] &DepCVer) != DepCVer && Start.IsNegative() == false) - { - if(DebugAutoInstall == true) - std::clog << OutputInDepth(Depth) << Start << " can't be satisfied!" << std::endl; - if (Start.IsCritical() == false) - continue; - // if the dependency was critical, we have absolutely no chance to install it, - // so if it wasn't installed remove it again. If it was, discard the candidate - // as the problemresolver will trip over it otherwise trying to install it (#735967) - if (Pkg->CurrentVer == 0) - MarkDelete(Pkg,false,Depth + 1, false); - else - SetCandidateVersion(Pkg.CurrentVer()); - return false; - } + continue; /* Check if any ImportantDep() (but not Critical) were added * since we installed the package. Also check for deps that @@ -1299,7 +1289,8 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, bool pkgDepCache::IsInstallOk(PkgIterator const &Pkg,bool AutoInst, unsigned long Depth, bool FromUser) { - return IsInstallOkMultiArchSameVersionSynced(Pkg,AutoInst, Depth, FromUser); + return IsInstallOkMultiArchSameVersionSynced(Pkg,AutoInst, Depth, FromUser) && + IsInstallOkDependenciesSatisfiableByCandidates(Pkg,AutoInst, Depth, FromUser); } bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg, bool const /*AutoInst*/, unsigned long const Depth, bool const FromUser) @@ -1342,6 +1333,53 @@ bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg, return false; } + return true; +} +bool pkgDepCache::IsInstallOkDependenciesSatisfiableByCandidates(PkgIterator const &Pkg, + bool const AutoInst, unsigned long const Depth, bool const /*FromUser*/) +{ + if (AutoInst == false) + return true; + + VerIterator const CandVer = PkgState[Pkg->ID].CandidateVerIter(*this); + if (unlikely(CandVer.end() == true) || CandVer == Pkg.CurrentVer()) + return true; + + for (DepIterator Dep = CandVer.DependsList(); Dep.end() != true;) + { + // Grok or groups + DepIterator Start = Dep; + bool Result = true; + unsigned Ors = 0; + for (bool LastOR = true; Dep.end() == false && LastOR == true; ++Dep, ++Ors) + { + LastOR = (Dep->CompareOp & Dep::Or) == Dep::Or; + + if ((DepState[Dep->ID] & DepInstall) == DepInstall) + Result = false; + } + + if (Start.IsCritical() == false || Start.IsNegative() == true || Result == false) + continue; + + /* If we are in an or group locate the first or that can succeed. + We have already cached this… */ + for (; Ors > 1 && (DepState[Start->ID] & DepCVer) != DepCVer; --Ors) + ++Start; + + if (Ors == 1 && (DepState[Start->ID] &DepCVer) != DepCVer) + { + if (DebugAutoInstall == true) + std::clog << OutputInDepth(Depth) << Start << " can't be satisfied!" << std::endl; + + // the dependency is critical, but can't be installed, so discard the candidate + // as the problemresolver will trip over it otherwise trying to install it (#735967) + if (Pkg->CurrentVer != 0) + SetCandidateVersion(Pkg.CurrentVer()); + return false; + } + } + return true; } /*}}}*/ diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index bde648c65..bec651279 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -506,6 +506,8 @@ class pkgDepCache : protected pkgCache::Namespace // methods call by IsInstallOk bool IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg, bool const AutoInst, unsigned long const Depth, bool const FromUser); + bool IsInstallOkDependenciesSatisfiableByCandidates(PkgIterator const &Pkg, + bool const AutoInst, unsigned long const Depth, bool const FromUser); // methods call by IsDeleteOk bool IsDeleteOkProtectInstallRequests(PkgIterator const &Pkg, diff --git a/test/integration/test-bug-735967-lib32-to-i386-unavailable b/test/integration/test-bug-735967-lib32-to-i386-unavailable index 4dbe1d25d..e9f3bf96d 100755 --- a/test/integration/test-bug-735967-lib32-to-i386-unavailable +++ b/test/integration/test-bug-735967-lib32-to-i386-unavailable @@ -12,6 +12,9 @@ insertpackage 'unstable' 'libnss-mdns' 'amd64,i386' '0.10-6' 'Multi-Arch: same Breaks: lib32nss-mdns (<< 0.10-6)' insertpackage 'unstable' 'libnss-mdns-i386' 'i386' '0.10-6' 'Multi-Arch: foreign Depends: libnss-mdns' +# introduce some dummies so that there are versions, but none works +insertpackage 'unstable' 'libnss-mdns-i386' 'amd64' '0.1-6' +insertpackage 'experimental' 'libnss-mdns-amd64' 'i386,amd64' '0.10-6' 'Provides: libnss-mdns-i386' insertpackage 'unstable' 'foo' 'amd64' '1' 'Depends: libfoo' insertpackage 'unstable' 'libfoo' 'amd64' '1' 'Depends: libfoo-bin' -- cgit v1.2.3-70-g09d2