From 3c8cda8b05d6eeaef76c7ccc673fe378b0c74f37 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Oct 2008 18:14:29 +0100 Subject: fix various -Wall warnings --- apt-pkg/acquire.cc | 3 ++- apt-pkg/contrib/cdromutl.cc | 3 ++- apt-pkg/contrib/mmap.cc | 5 +++-- apt-pkg/deb/dpkgpm.cc | 4 ++-- apt-pkg/depcache.cc | 2 +- apt-pkg/indexcopy.cc | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 80c2fee0f..38944bbac 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -444,8 +444,9 @@ bool pkgAcquire::Clean(string Dir) unlink(Dir->d_name); }; - chdir(StartDir.c_str()); closedir(D); + if (chdir(StartDir.c_str()) != 0) + return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str()); return true; } /*}}}*/ diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 6f00e1451..b6524a178 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -176,7 +176,8 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version) Hash.Add(Dir->d_name); }; - chdir(StartDir.c_str()); + if (chdir(StartDir.c_str()) != 0) + return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str()); closedir(D); // Some stats from the fsys diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index abcae46fe..eed438250 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -192,7 +192,8 @@ DynamicMMap::~DynamicMMap() unsigned long EndOfFile = iSize; iSize = WorkSpace; Close(false); - ftruncate(Fd->Fd(),EndOfFile); + if(ftruncate(Fd->Fd(),EndOfFile) < 0) + _error->Errno("ftruncate", _("Failed to truncate file")); } /*}}}*/ // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space /*{{{*/ @@ -209,7 +210,7 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln) // Just in case error check if (Result + Size > WorkSpace) { - _error->Error("Dynamic MMap ran out of room"); + _error->Error(_("Dynamic MMap ran out of room")); return 0; } diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 4fad0fd52..85cf4e119 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -531,7 +531,7 @@ bool pkgDPkgPM::OpenLog() struct tm *tmp = localtime(&t); strftime(outstr, sizeof(outstr), "%F %T", tmp); fprintf(term_out, "\nLog started: "); - fprintf(term_out, outstr); + fprintf(term_out, "%s", outstr); fprintf(term_out, "\n"); } return true; @@ -546,7 +546,7 @@ bool pkgDPkgPM::CloseLog() struct tm *tmp = localtime(&t); strftime(outstr, sizeof(outstr), "%F %T", tmp); fprintf(term_out, "Log ended: "); - fprintf(term_out, outstr); + fprintf(term_out, "%s", outstr); fprintf(term_out, "\n"); fclose(term_out); } diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 859e64ea1..2411bfe89 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -269,7 +269,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) ostr.str(string("")); ostr << "Package: " << pkg.Name() << "\nAuto-Installed: 1\n\n"; - fprintf(OutFile,ostr.str().c_str()); + fprintf(OutFile,"%s",ostr.str().c_str()); fprintf(OutFile,"\n"); } } diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index b30777d8d..9e5c03e0b 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -639,7 +639,7 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector &SigList, // Open the Release file and add it to the MetaIndex if(!MetaIndex->Load(*I+"Release")) { - _error->Error(MetaIndex->ErrorText.c_str()); + _error->Error("%s",MetaIndex->ErrorText.c_str()); return false; } -- cgit v1.2.3-70-g09d2 From 589898ae1e46dc56bc037f502e1c405a3e06ed70 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 29 Oct 2008 09:27:11 +0100 Subject: apt-pkg/acquire-item.cc: fixed my incorrect use of flExtension --- apt-pkg/acquire-item.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 679f9cee7..cf835f5d5 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -711,13 +711,13 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, else Local = true; - string compExt = flExtension(URI(Desc.URI).Path); + string compExt = flExtension(flNotDir(URI(Desc.URI).Path)); const char *decompProg; if(compExt == "bz2") decompProg = "bzip2"; - else if(compExt == ".gz") + else if(compExt == "gz") decompProg = "gzip"; - else if(compExt == "") + else if(compExt == "Packages" || compExt == "Sources") decompProg = "copy"; else { _error->Error("Unsupported extension: %s", compExt.c_str()); -- cgit v1.2.3-70-g09d2 From 708ead3a44ac2f5ea625343c5d1b3404cca8a481 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 29 Oct 2008 09:31:53 +0100 Subject: apt-pkg/acquire-item.cc: do not hardcode "Packages" or "Sources" in the (generic) acquire-item.cc code --- apt-pkg/acquire-item.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index cf835f5d5..ae8ff2205 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -717,7 +717,8 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, decompProg = "bzip2"; else if(compExt == "gz") decompProg = "gzip"; - else if(compExt == "Packages" || compExt == "Sources") + // flExtensions returns the full name if no extension is found + else if(compExt == flNotDir(URI(Desc.URI).Path)) decompProg = "copy"; else { _error->Error("Unsupported extension: %s", compExt.c_str()); -- cgit v1.2.3-70-g09d2 From 1c8ab7200ec4527cd38d0b4d0ef847452f011915 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 29 Oct 2008 18:58:48 +0100 Subject: add fixme for the future flJustExtension --- apt-pkg/acquire-item.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index ae8ff2205..09ea5da02 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -718,6 +718,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, else if(compExt == "gz") decompProg = "gzip"; // flExtensions returns the full name if no extension is found + // this is why we have this complicated compare operation here + // FIMXE: add a new flJustExtension() that return "" if no + // extension is found and use that above so that it can + // be tested against "" else if(compExt == flNotDir(URI(Desc.URI).Path)) decompProg = "copy"; else { -- cgit v1.2.3-70-g09d2 From 6e7f872dfdf7de0108b07e3c8f1ccda57734e6f8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 12 Nov 2008 16:24:26 +0100 Subject: fix SIGHUP handling (closes: #463030) --- apt-pkg/deb/dpkgpm.cc | 5 +++++ debian/changelog | 3 +++ 2 files changed, 8 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 85cf4e119..5359f81ef 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -773,6 +773,9 @@ bool pkgDPkgPM::Go(int OutStatusFd) sighandler_t old_SIGQUIT = signal(SIGQUIT,SIG_IGN); sighandler_t old_SIGINT = signal(SIGINT,SIG_IGN); + // ignore SIGHUP as well (debian #463030) + sighandler_t old_SIGHUP = signal(SIGHUP,SIG_IGN); + struct termios tt; struct termios tt_out; struct winsize win; @@ -881,6 +884,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) // Restore sig int/quit signal(SIGQUIT,old_SIGQUIT); signal(SIGINT,old_SIGINT); + signal(SIGINT,old_SIGHUP); return _error->Errno("waitpid","Couldn't wait for subprocess"); } @@ -920,6 +924,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) // Restore sig int/quit signal(SIGQUIT,old_SIGQUIT); signal(SIGINT,old_SIGINT); + signal(SIGINT,old_SIGHUP); if(master >= 0) { diff --git a/debian/changelog b/debian/changelog index e7309d577..27f78e958 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,9 @@ apt (0.7.19) unstable; urgency=low is a request to install only one package and it is not installable. (Closes: #419521) + [ Michael Vogt ] + - fix SIGHUP handling (closes: #463030) + -- Eugene V. Lyubimkin Sat, 08 Nov 2008 12:40:19 +0200 apt (0.7.18) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From 4e648e0bc72d2513965dc17ee7980754036305bb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 12 Nov 2008 20:36:41 +0100 Subject: apt-pkg/deb/dpkgpm.cc: fix typo (thanks to jackyf) --- 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 5359f81ef..9ad367e67 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -924,7 +924,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) // Restore sig int/quit signal(SIGQUIT,old_SIGQUIT); signal(SIGINT,old_SIGINT); - signal(SIGINT,old_SIGHUP); + signal(SIGHUP,old_SIGHUP); if(master >= 0) { -- cgit v1.2.3-70-g09d2 From 1a853738a54dbab6e82a23a8cc6c6d6f3aeeae12 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 12 Nov 2008 21:18:34 +0100 Subject: merge from the mvo branch --- 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 9ad367e67..40aafafa4 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -884,7 +884,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) // Restore sig int/quit signal(SIGQUIT,old_SIGQUIT); signal(SIGINT,old_SIGINT); - signal(SIGINT,old_SIGHUP); + signal(SIGHUP,old_SIGHUP); return _error->Errno("waitpid","Couldn't wait for subprocess"); } -- cgit v1.2.3-70-g09d2 From 9f8432087b2b00747292fd2ea4c2df3ea7517eab Mon Sep 17 00:00:00 2001 From: "Eugene V. Lyubimkin" Date: Wed, 26 Nov 2008 22:26:32 +0200 Subject: Added instruction how to work around MMap error in MMap error message. --- apt-pkg/contrib/mmap.cc | 6 ++++-- debian/changelog | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index eed438250..04a45811b 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -210,7 +210,8 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln) // Just in case error check if (Result + Size > WorkSpace) { - _error->Error(_("Dynamic MMap ran out of room")); + _error->Error(_("Dynamic MMap ran out of room. Please increase the size " + "of APT::Cache-Limit. Current value: %lu. (man 5 apt.conf)"), WorkSpace); return 0; } @@ -272,7 +273,8 @@ unsigned long DynamicMMap::WriteString(const char *String, // Just in case error check if (Result + Len > WorkSpace) { - _error->Error("Dynamic MMap ran out of room"); + _error->Error(_("Dynamic MMap ran out of room. Please increase the size " + "of APT::Cache-Limit. Current value: %lu. (man 5 apt.conf)"), WorkSpace); return 0; } diff --git a/debian/changelog b/debian/changelog index b196b013e..d1ccf8b8f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ apt (0.7.20~exp2) unstable; urgency=low * doc/examples/sources.list: - Removed obsolete commented non-us deb-src entry, replaced it with 'deb-src security.debian.org' one. (Closes: #411298) + * apt-pkg/contrib/mmap.cc: + - Added instruction how to work around MMap error in MMap error message. + (Closes: #385674, 436028) -- Eugene V. Lyubimkin Wed, 26 Nov 2008 22:06:21 +0200 -- cgit v1.2.3-70-g09d2