diff options
author | Michael Vogt <mvo@debian.org> | 2014-01-28 16:43:49 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-01-28 16:43:49 +0100 |
commit | acead5b93cf49ab33cba4be2ea8e1b253ed0f2bf (patch) | |
tree | 7c8631716d2182c7891533a0e4ce3b6962595f17 | |
parent | f4a631adf2f14c99d61ecb7f61cb1b3625c1cde4 (diff) | |
parent | bae81c1307e956aa8928c9d6a77830fb733cd61f (diff) |
Merge branch 'debian/sid' into ubuntu/master
38 files changed, 482 insertions, 428 deletions
diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc index 65d1aa188..b62bdcae1 100644 --- a/apt-inst/dirstream.cc +++ b/apt-inst/dirstream.cc @@ -20,7 +20,6 @@ #include <sys/stat.h> #include <sys/types.h> #include <errno.h> -#include <utime.h> #include <unistd.h> #include <apti18n.h> /*}}}*/ @@ -93,19 +92,18 @@ bool pkgDirStream::FinishedFile(Item &Itm,int Fd) { if (Fd < 0) return true; - - if (close(Fd) != 0) - return _error->Errno("close",_("Failed to close file %s"),Itm.Name); /* Set the modification times. The only way it can fail is if someone has futzed with our file, which is intolerable :> */ - struct utimbuf Time; - Time.actime = Itm.MTime; - Time.modtime = Itm.MTime; - if (utime(Itm.Name,&Time) != 0) - _error->Errno("utime",_("Failed to close file %s"),Itm.Name); - - return true; + struct timespec times[2]; + times[0].tv_sec = times[1].tv_sec = Itm.MTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + if (futimens(Fd, times) != 0) + _error->Errno("futimens", "Failed to set modification time for %s",Itm.Name); + + if (close(Fd) != 0) + return _error->Errno("close",_("Failed to close file %s"),Itm.Name); + return true; } /*}}}*/ // DirStream::Fail - Failed processing a file /*{{{*/ diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 115d11616..1ebcf97bc 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -141,7 +141,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, // so they will be all included in the Cache. std::vector<string> builtin; DIR *D = opendir(_config->FindDir("Dir::State::lists").c_str()); - if (D != 0) { + if (D != NULL) { builtin.push_back("none"); for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) { string const name = SubstVar(Ent->d_name, "%5f", "_"); @@ -166,8 +166,8 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, continue; builtin.push_back(c); } + closedir(D); } - closedir(D); // FIXME: Remove support for the old APT::Acquire::Translation // it was undocumented and so it should be not very widthly used diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index 0147f7e86..29281aab9 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -73,6 +73,8 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci, const char *start, *end; parser.GetRec(start,end); unsigned int const length = end - start; + if (unlikely(length == 0)) + continue; char buf[length]; strncpy(buf, start, length); buf[length-1] = '\0'; diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index ffb8b4b53..37155b688 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -319,7 +319,7 @@ bool CreateDirectory(string const &Parent, string const &Path) return false; // we are not going to create directories "into the blue" - if (Path.find(Parent, 0) != 0) + if (Path.compare(0, Parent.length(), Parent) != 0) return false; vector<string> const dirs = VectorizeString(Path.substr(Parent.size()), '/'); diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc index f57a72d86..9de227062 100644 --- a/apt-pkg/contrib/gpgv.cc +++ b/apt-pkg/contrib/gpgv.cc @@ -103,12 +103,12 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG, } } + enum { DETACHED, CLEARSIGNED } releaseSignature = (FileGPG != File) ? DETACHED : CLEARSIGNED; std::vector<std::string> dataHeader; char * sig = NULL; char * data = NULL; - // file with detached signature - if (FileGPG != File) + if (releaseSignature == DETACHED) { Args.push_back(FileGPG.c_str()); Args.push_back(File.c_str()); @@ -181,7 +181,7 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG, putenv((char *)"LC_MESSAGES="); } - if (FileGPG != File) + if (releaseSignature == DETACHED) { execvp(gpgvpath.c_str(), (char **) &Args[0]); ioprintf(std::cerr, "Couldn't execute %s to check %s", Args[0], File.c_str()); @@ -260,8 +260,7 @@ bool SplitClearSignedFile(std::string const &InFile, FileFd * const ContentFile, char *buf = NULL; size_t buf_size = 0; - ssize_t line_len = 0; - while ((line_len = getline(&buf, &buf_size, in)) != -1) + while (getline(&buf, &buf_size, in) != -1) { _strrstrip(buf); if (found_message_start == false) @@ -355,7 +354,7 @@ bool OpenMaybeClearSignedFile(std::string const &ClearSignedFileName, FileFd &Me return _error->Error("Couldn't open temporary file to work with %s", ClearSignedFileName.c_str()); _error->PushToStack(); - bool const splitDone = SplitClearSignedFile(ClearSignedFileName.c_str(), &MessageFile, NULL, NULL); + bool const splitDone = SplitClearSignedFile(ClearSignedFileName, &MessageFile, NULL, NULL); bool const errorDone = _error->PendingError(); _error->MergeWithStack(); if (splitDone == false) diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index b4c768db9..890573d9c 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -129,13 +129,12 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5, bool const addSHA1, bool const addSHA256, bool const addSHA512) { unsigned char Buf[64*64]; - ssize_t Res = 0; - int ToEOF = (Size == 0); + bool const ToEOF = (Size == 0); while (Size != 0 || ToEOF) { unsigned long long n = sizeof(Buf); if (!ToEOF) n = std::min(Size, n); - Res = read(Fd,Buf,n); + ssize_t const Res = read(Fd,Buf,n); if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read return false; if (ToEOF && Res == 0) // EOF diff --git a/apt-pkg/contrib/hashsum.cc b/apt-pkg/contrib/hashsum.cc index 289e43aa4..d02177724 100644 --- a/apt-pkg/contrib/hashsum.cc +++ b/apt-pkg/contrib/hashsum.cc @@ -9,13 +9,12 @@ /* */ bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) { unsigned char Buf[64 * 64]; - ssize_t Res = 0; - int ToEOF = (Size == 0); + bool const ToEOF = (Size == 0); while (Size != 0 || ToEOF) { unsigned long long n = sizeof(Buf); if (!ToEOF) n = std::min(Size, n); - Res = read(Fd, Buf, n); + ssize_t const Res = read(Fd, Buf, n); if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read return false; if (ToEOF && Res == 0) // EOF @@ -27,7 +26,7 @@ bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) { } bool SummationImplementation::AddFD(FileFd &Fd, unsigned long long Size) { unsigned char Buf[64 * 64]; - bool ToEOF = (Size == 0); + bool const ToEOF = (Size == 0); while (Size != 0 || ToEOF) { unsigned long long n = sizeof(Buf); diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index a176da636..51e8eb30f 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -352,6 +352,12 @@ unsigned long DynamicMMap::RawAllocate(unsigned long long Size,unsigned long Aln size in the file. */ unsigned long DynamicMMap::Allocate(unsigned long ItemSize) { + if (unlikely(ItemSize == 0)) + { + _error->Fatal("Can't allocate an item of size zero"); + return 0; + } + // Look for a matching pool entry Pool *I; Pool *Empty = 0; @@ -412,7 +418,7 @@ unsigned long DynamicMMap::WriteString(const char *String, unsigned long const Result = RawAllocate(Len+1,0); - if (Result == 0 && _error->PendingError()) + if (Base == NULL || (Result == 0 && _error->PendingError())) return 0; memcpy((char *)Base + Result,String,Len); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index a72745774..25a1e6055 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -567,7 +567,6 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line) std::string prefix = APT::String::Strip(list[0]); std::string pkgname; std::string action; - ostringstream status; // "processing" has the form "processing: action: pkg or trigger" // with action = ["install", "configure", "remove", "purge", "disappear", @@ -1661,7 +1660,7 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) io_errors.push_back(string("failed in write on buffer copy for %s")); io_errors.push_back(string("short read on buffer copy for %s")); - for (vector<string>::iterator I = io_errors.begin(); I != io_errors.end(); I++) + for (vector<string>::iterator I = io_errors.begin(); I != io_errors.end(); ++I) { vector<string> list = VectorizeString(dgettext("dpkg", (*I).c_str()), '%'); if (list.size() > 1) { @@ -1776,13 +1775,11 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) string histfile_name = _config->FindFile("Dir::Log::History"); if (!histfile_name.empty()) { - FILE *log = NULL; - char buf[1024]; - fprintf(report, "DpkgHistoryLog:\n"); - log = fopen(histfile_name.c_str(),"r"); + FILE* log = fopen(histfile_name.c_str(),"r"); if(log != NULL) { + char buf[1024]; while( fgets(buf, sizeof(buf), log) != NULL) fprintf(report, " %s", buf); fclose(log); diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index fe065da4f..a3a4cc0e1 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -242,7 +242,7 @@ PackageManagerFancy::~PackageManagerFancy() void PackageManagerFancy::staticSIGWINCH(int signum) { std::vector<PackageManagerFancy *>::const_iterator I; - for(I = instances.begin(); I != instances.end(); I++) + for(I = instances.begin(); I != instances.end(); ++I) (*I)->HandleSIGWINCH(signum); } diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index fbb66d204..44a766c84 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -61,7 +61,7 @@ class PackageNameMatcher : public Matcher /*{{{*/ public: PackageNameMatcher(const char **patterns) { - for(int i=0; patterns[i] != NULL; i++) + for(int i=0; patterns[i] != NULL; ++i) { std::string pattern = patterns[i]; #ifdef PACKAGE_MATCHER_ABI_COMPAT @@ -79,12 +79,12 @@ class PackageNameMatcher : public Matcher /*{{{*/ } virtual ~PackageNameMatcher() { - for(J=filters.begin(); J != filters.end(); J++) + for(J=filters.begin(); J != filters.end(); ++J) delete *J; } virtual bool operator () (const pkgCache::PkgIterator &P) { - for(J=filters.begin(); J != filters.end(); J++) + for(J=filters.begin(); J != filters.end(); ++J) { APT::CacheFilter::PackageMatcher *cachefilter = *J; if((*cachefilter)(P)) @@ -105,7 +105,7 @@ void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ bool include_summary=true) { for (pkgCache::VerIterator Ver = P.VersionList(); - Ver.end() == false; Ver++) + Ver.end() == false; ++Ver) { ListSingleVersion(CacheFile, records, Ver, outs, include_summary); outs << "\n"; @@ -146,7 +146,7 @@ bool List(CommandLine &Cmd) Cache->Head().PackageCount, _("Listing")); GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress); - for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); V++) + for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); ++V) { std::stringstream outs; if(_config->FindB("APT::Cmd::All-Versions", false) == true) @@ -163,7 +163,7 @@ bool List(CommandLine &Cmd) // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status) // output the sorted map - for (K = output_map.begin(); K != output_map.end(); K++) + for (K = output_map.begin(); K != output_map.end(); ++K) std::cout << (*K).second << std::endl; diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc index 9d7f36138..0b1a929b0 100644 --- a/apt-private/private-search.cc +++ b/apt-private/private-search.cc @@ -61,18 +61,18 @@ bool FullTextSearch(CommandLine &CmdL) /*{{{*/ progress.OverallProgress(50, 100, 50, _("Full Text Search")); progress.SubProgress(bag.size()); int Done = 0; - for ( ;V != bag.end(); V++) + for ( ;V != bag.end(); ++V) { if (Done%500 == 0) progress.Progress(Done); - Done++; + ++Done; int i; pkgCache::DescIterator Desc = V.TranslatedDescription(); pkgRecords::Parser &parser = records.Lookup(Desc.FileList()); bool all_found = true; - for(i=0; patterns[i] != NULL; i++) + for(i=0; patterns[i] != NULL; ++i) { // FIXME: use regexp instead of simple find() const char *pattern = patterns[i]; @@ -93,7 +93,7 @@ bool FullTextSearch(CommandLine &CmdL) /*{{{*/ // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status) // output the sorted map - for (K = output_map.begin(); K != output_map.end(); K++) + for (K = output_map.begin(); K != output_map.end(); ++K) std::cout << (*K).second << std::endl; return true; diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index 463e4b4b4..0ced500db 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -5,22 +5,23 @@ unset GREP_OPTIONS GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring" -# gpg needs a trustdb to function, but it can't be invalid (not even empty) -# so we create a temporary directory to store our fresh readable trustdb in -TRUSTDBDIR="$(mktemp -d)" -CURRENTTRAP="${CURRENTTRAP} rm -rf '${TRUSTDBDIR}';" +# gpg needs (in different versions more or less) files to function correctly, +# so we give it its own homedir and generate some valid content for it +GPGHOMEDIR="$(mktemp -d)" +CURRENTTRAP="${CURRENTTRAP} rm -rf '${GPGHOMEDIR}';" trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM -chmod 700 "$TRUSTDBDIR" -# We also don't use a secret keyring, of course, but gpg panics and +chmod 700 "$GPGHOMEDIR" +# We don't use a secret keyring, of course, but gpg panics and # implodes if there isn't one available - and writeable for imports -SECRETKEYRING="${TRUSTDBDIR}/secring.gpg" +SECRETKEYRING="${GPGHOMEDIR}/secring.gpg" touch $SECRETKEYRING -GPG_CMD="$GPG_CMD --secret-keyring $SECRETKEYRING" -GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg" - -# now create the trustdb with an (empty) dummy keyring -$GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING -# and make sure that gpg isn't trying to update the file +GPG_CMD="$GPG_CMD --homedir $GPGHOMEDIR" +# create the trustdb with an (empty) dummy keyring +# older gpgs required it, newer gpgs even warn that it isn't needed, +# but require it nontheless for some commands, so we just play safe +# here for the foreseeable future and create a dummy one +$GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING >/dev/null 2>&1 +# tell gpg that it shouldn't try to maintain a trustdb file GPG_CMD="$GPG_CMD --no-auto-check-trustdb --trust-model always" GPG="$GPG_CMD" diff --git a/debian/control b/debian/control index f0d4bab95..527a8d65f 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 8.1.3~), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~), zlib1g-dev, libbz2-dev, xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2), autotools-dev, autoconf, automake -Build-Depends-Indep: doxygen, debiandoc-sgml +Build-Depends-Indep: doxygen, debiandoc-sgml, graphviz Build-Conflicts: autoconf2.13, automake1.4 Vcs-Git: git://anonscm.debian.org/apt/apt.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=apt/apt.git diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index a0087cd2c..9ebbd9673 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -880,7 +880,7 @@ HTML_OUTPUT = html # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. -HTML_FILE_EXTENSION = .html +HTML_FILE_EXTENSION = .xhtml # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a @@ -1715,7 +1715,7 @@ DOT_NUM_THREADS = 0 # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. -DOT_FONTNAME = FreeSans +DOT_FONTNAME = # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. @@ -1815,7 +1815,7 @@ DIRECTORY_GRAPH = YES # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). -DOT_IMAGE_FORMAT = png +DOT_IMAGE_FORMAT = svg # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. @@ -1824,7 +1824,7 @@ DOT_IMAGE_FORMAT = png # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. -INTERACTIVE_SVG = NO +INTERACTIVE_SVG = YES # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. diff --git a/doc/po/de.po b/doc/po/de.po index 3c9799fe1..883aa49a8 100644 --- a/doc/po/de.po +++ b/doc/po/de.po @@ -1,14 +1,14 @@ # Translation of apt-doc to German # Copyright (C) 1997, 1998, 1999 Jason Gunthorpe and others. # This file is distributed under the same license as the apt-doc package. -# Chris Leick <c.leick@vollbio.de>, 2009-2012. +# Chris Leick <c.leick@vollbio.de>, 2009-2014. # msgid "" msgstr "" -"Project-Id-Version: apt-doc 0.9.7\n" +"Project-Id-Version: apt-doc 0.9.14.2\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2014-01-25 22:21+0100\n" -"PO-Revision-Date: 2012-06-25 22:49+0100\n" +"POT-Creation-Date: 2014-01-24 12:29+0100\n" +"PO-Revision-Date: 2014-01-26 15:26+0100\n" "Last-Translator: Chris Leick <c.leick@vollbio.de>\n" "Language-Team: German <debian-l10n-german@lists.debian.org>\n" "Language: de\n" @@ -1334,6 +1334,14 @@ msgid "" "will never remove packages, only allow adding new ones. Configuration Item: " "<literal>APT::Get::Upgrade-Allow-New</literal>." msgstr "" +"erlaubt das Installieren neuer Pakete, wenn es zusammen mit " +"<literal>upgrade</literal> benutzt wird. Dies ist nützlich, falls das " +"Aktualisieren eines installierten Pakets zur Installation neue " +"Abhängigkeiten hat. Anstatt das Paket zurückzuhalten, wird <literal>upgrade</" +"literal> ein Upgrade des Pakets durchführen und die neuen Abhängigkeiten " +"installieren. Beachten Sie, dass <literal>upgrade</literal> mit dieser " +"Option niemals Pakete entfernen, sondern nur das Hinzufügen neuer gestatten " +"wird.Konfigurationselement: <literal>APT::Get::Upgrade-Allow-New</literal>." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt-get.8.xml:407 @@ -1553,6 +1561,7 @@ msgstr "" "fragen. Dies ist für Werkzeuge wie pbuilder nützlich. Konfigurationselement: " "<literal>APT::Get::AllowUnauthenticated</literal>." +# FIXME s/Item/Items/ #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt-get.8.xml:527 msgid "" @@ -1562,6 +1571,12 @@ msgid "" "Item: <literal>DpkgPM::Progress</literal> and <literal>Dpkg::Progress-Fancy</" "literal>." msgstr "" +"zeigt benutzerfreundliche Fortschrittsinformationen im Terminalfenster, wenn " +"Pakete installiert beziehungsweise entfernt werden oder ein Upgrade " +"durchgeführt wird. Informationen über eine maschinell auswertbare Version " +"dieser Daten finden Sie in README.progress-reporting im Apt-doc-Verzeichnis. " +"Konfigurationselemente: <literal>DpkgPM::Progress</literal> und " +"<literal>Dpkg::Progress-Fancy</literal>." #. type: Content of: <refentry><refsect1><title> #: apt-get.8.xml:540 apt-cache.8.xml:345 apt-key.8.xml:176 apt-mark.8.xml:127 @@ -2900,20 +2915,14 @@ msgstr "" #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt-cdrom.8.xml:87 -#, fuzzy -#| msgid "" -#| "Mount point; specify the location to mount the CD-ROM. This mount point " -#| "must be listed in <filename>/etc/fstab</filename> and properly " -#| "configured. Configuration Item: <literal>Acquire::cdrom::mount</literal>." msgid "" "Do not try to auto-detect the CD-ROM path. Usually combined with the " "<option>--cdrom</option> option. Configuration Item: <literal>Acquire::" "cdrom::AutoDetect</literal>." msgstr "" -"Einhängepunkt; gibt den Ort an, an dem die CD-ROM eingehängt wird. Dieser " -"Einhängepunkt muss in <filename>/etc/fstab</filename> eingetragen und " -"angemessen konfiguriert sein. Konfigurationselement: <literal>Acquire::" -"cdrom::mount</literal>." +"versucht nicht, den CD-ROM-Pfad automatisch zu bestimmen. Dies wird " +"üblicherweise mit der Option <option>--cdrom</option> kombiniert. " +"Konfigurationselement: <literal>Acquire::cdrom::AutoDetect</literal>." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt-cdrom.8.xml:95 @@ -3894,13 +3903,6 @@ msgstr "" #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:391 -#, fuzzy -#| msgid "" -#| "The used bandwidth can be limited with <literal>Acquire::http::Dl-Limit</" -#| "literal> which accepts integer values in kilobytes. The default value is " -#| "0 which deactivates the limit and tries to use all available bandwidth " -#| "(note that this option implicitly disables downloading from multiple " -#| "servers at the same time.)" msgid "" "The used bandwidth can be limited with <literal>Acquire::http::Dl-Limit</" "literal> which accepts integer values in kilobytes per second. The default " @@ -3909,11 +3911,11 @@ msgid "" "multiple servers at the same time." msgstr "" "Die benutzte Bandbreite kann durch <literal>Acquire::http::Dl-Limit</" -"literal> eingeschränkt werden, was Ganzzahlwerte in Kilobyte akzeptiert. Der " -"Vorgabewert ist 0, was die Beschränkung ausschaltet und versucht, sämtliche " -"verfügbare Bandbreite zu benutzen. (Beachten Sie, dass diese Optionen " -"implizit das Herunterladen von mehreren Servern zur gleichen Zeit " -"deaktiviert.)" +"literal> eingeschränkt werden, was Ganzzahlwerte in Kilobyte pro Sekunde " +"akzeptiert. Der Vorgabewert ist 0, was die Beschränkung ausschaltet und " +"versucht, sämtliche verfügbare Bandbreite zu benutzen. Beachten Sie, dass " +"diese Optionen implizit das Herunterladen von mehreren Servern zur gleichen " +"Zeit deaktiviert." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:398 @@ -3940,6 +3942,15 @@ msgid "" "takes precedence over the legacy option name <literal>ProxyAutoDetect</" "literal>." msgstr "" +"<literal>Acquire::http::Proxy-Auto-Detect</literal> kann benutzt werden, um " +"einen externen Befehl zum Auffinden des HTTP-Proxys anzugeben, der benutzt " +"werden soll. APT erwartet den Befehl zum Ausgeben auf der Standardausgabe " +"imStil <literal>http://proxy:port/</literal>. Dies wird das typische " +"<literal>Acquire::http::Proxy</literal> außer Kraft setzen, aber keine " +"spezielle per <literal>Acquire::http::Proxy::$HOST</literal> gesetzte Proxy-" +"Rechnerkonfiguration. Eine Beispielimplementierung, die Avahi benutzt, " +"finden Sie im Paket &squid-deb-proxy-client;. Diese Option hat Vorrang vor " +"dem veralteten Optionsnamen <literal>ProxyAutoDetect</literal>." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:420 @@ -4330,12 +4341,12 @@ msgstr "" #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:576 msgid "When downloading, force to use only the IPv4 protocol." -msgstr "" +msgstr "Beim Herunterladen wird die Verwendung des IPv4-Protokolls erzwungen." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:582 msgid "When downloading, force to use only the IPv6 protocol." -msgstr "" +msgstr "Beim Herunterladen wird die Verwendung des IPv6-Protokolls erzwungen." #. type: Content of: <refentry><refsect1><title> #: apt.conf.5.xml:589 @@ -4575,13 +4586,6 @@ msgstr "" #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:703 -#, fuzzy -#| msgid "" -#| "This is a list of shell commands to run before invoking &dpkg;. Like " -#| "<literal>options</literal> this must be specified in list notation. The " -#| "commands are invoked in order using <filename>/bin/sh</filename>; should " -#| "any fail APT will abort. APT will pass the filenames of all .deb files it " -#| "is going to install to the commands, one per line on standard input." msgid "" "This is a list of shell commands to run before invoking &dpkg;. Like " "<literal>options</literal> this must be specified in list notation. The " @@ -4595,17 +4599,12 @@ msgstr "" "Listenschreibweise angegeben werden. Die Befehle werden der Reihenfolge nach " "mit <filename>/bin/sh</filename> aufgerufen, sollte einer fehlschlagen, wird " "APT abgebrochen. APT wird den Befehlen die Dateinamen aller .deb-Dateien, " -"die es installieren wird, auf der Standardeingabe übergeben, einen pro Zeile." +"die es installieren wird, einen pro Zeile, an den angeforderten " +"standardmäßig auf die Standardeingabe verweisenden Dateideskriptor, " +"übergeben." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:710 -#, fuzzy -#| msgid "" -#| "Version 2 of this protocol dumps more information, including the protocol " -#| "version, the APT configuration space and the packages, files and versions " -#| "being changed. Version 2 is enabled by setting <literal>DPkg::Tools::" -#| "options::cmd::Version</literal> to 2. <literal>cmd</literal> is a command " -#| "given to <literal>Pre-Install-Pkgs</literal>." msgid "" "Version 2 of this protocol dumps more information, including the protocol " "version, the APT configuration space and the packages, files and versions " @@ -4614,10 +4613,8 @@ msgid "" msgstr "" "Version 2 dieses Protokolls gibt mehr Informationen aus, einschließlich der " "Protokollversion, dem APT-Konfigurationsraum und den Paketen, Dateien und " -"den Versionen, die geändert werden. Version 2 wird durch Setzen von " -"<literal>DPkg::Tools::options::cmd::Version</literal> auf 2 eingeschaltet. " -"<literal>cmd</literal> ist ein Befehl, der an <literal>Pre-Install-Pkgs</" -"literal> gegeben wird." +"den Versionen, die geändert werden. Version 3 fügt jeder ausgegebenen " +"Version die Architektur und den <literal>MultiArch</literal>-Schalter hinzu." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:715 @@ -4629,6 +4626,13 @@ msgid "" "the requested version it will send the information in the highest version it " "has support for instead." msgstr "" +"Die Protokollversion, die für den Befehl <literal><replaceable>Befehl</" +"replaceable></literal> benutzt werden soll, kann durch entsprechendes Setzen " +"von <literal>DPkg::Tools::options::<replaceable>Befehl</replaceable>::" +"Version</literal> ausgewählt werden, Voreinstellung ist Version 1. Falls APT " +"die angefragte Version nicht unterstützt, wird es stattdessen die " +"Informationen in der höchsten Version senden, für die es Unterstützung " +"bietet." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:722 @@ -4640,6 +4644,13 @@ msgid "" "looking for the environment variable <envar>APT_HOOK_INFO_FD</envar> which " "contains the number of the used file descriptor as a confirmation." msgstr "" +"Der Dateideskriptor, der zum Senden der Informationen benutzt wird, kann mit " +"<literal>DPkg::Tools::options::<replaceable>Befehl</replaceable>::InfoFD</" +"literal> abgefragt werden. Er ist standardmäßig <literal>0</literal> für die " +"Standardeingabe und seit Version 0.9.11 verfügbar. Unterstützung für die " +"Option können Sie finden, indem Sie in die Umgebungsvariable " +"<envar>APT_HOOK_INFO_FD</envar> schauen. Sie enthält die Nummer des " +"verwendeten Dateideskriptors als eine Bestätigung." #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para> #: apt.conf.5.xml:732 @@ -6707,10 +6718,9 @@ msgstr "" #. type: Content of: <refentry><refsect1><literallayout> #: sources.list.5.xml:82 -#, fuzzy, no-wrap -#| msgid "deb [ options ] uri distribution [component1] [component2] [...]" +#, no-wrap msgid "deb [ options ] uri suite [component1] [component2] [...]" -msgstr "deb [ Optionen ] URI Distribution [Komponente1] [Komponente2] […]" +msgstr "deb [ Optionen ] URI Suite [Komponente1] [Komponente2] […]" #. type: Content of: <refentry><refsect1><para><literallayout> #: sources.list.5.xml:86 @@ -6734,6 +6744,23 @@ msgid "" " [option1]: [option1-value]\n" " " msgstr "" +" Types: deb deb-src\n" +" URIs: http://example.com\n" +" Suites: stable testing\n" +" Sections: Komponente1 Komponente2\n" +" Description: short\n" +" long long long\n" +" [Option1]: [Option1-Wert]\n" +"\n" +" Types: deb\n" +" URIs: http://another.example.com\n" +" Suites: experimental\n" +" Sections: Komponente1 Komponente2\n" +" Enabled: no\n" +" Description: short\n" +" long long long\n" +" [Option1]: [Option1-Wert]\n" +" " #. type: Content of: <refentry><refsect1><para> #: sources.list.5.xml:84 @@ -6741,19 +6768,11 @@ msgid "" "Alternatively a rfc822 style format is also supported: <placeholder type=" "\"literallayout\" id=\"0\"/>" msgstr "" +"Alternativ wird auch ein Format im Stil von RFC822 unterstützt: <placeholder " +"type=\"literallayout\" id=\"0\"/>" #. type: Content of: <refentry><refsect1><para> #: sources.list.5.xml:105 -#, fuzzy -#| msgid "" -#| "The URI for the <literal>deb</literal> type must specify the base of the " -#| "Debian distribution, from which APT will find the information it needs. " -#| "<literal>distribution</literal> can specify an exact path, in which case " -#| "the components must be omitted and <literal>distribution</literal> must " -#| "end with a slash (<literal>/</literal>). This is useful for the case when " -#| "only a particular sub-section of the archive denoted by the URI is of " -#| "interest. If <literal>distribution</literal> does not specify an exact " -#| "path, at least one <literal>component</literal> must be present." msgid "" "The URI for the <literal>deb</literal> type must specify the base of the " "Debian distribution, from which APT will find the information it needs. " @@ -6766,25 +6785,15 @@ msgid "" msgstr "" "Die URI für den <literal>deb</literal>-Typ muss die Basis der Debian-" "Distribution angeben, wo APT die Informationen findet, die es benötigt. " -"<literal>Distribution</literal> kann einen genauen Pfad angeben. In diesem " -"Fall müssen die Komponenten weggelassen werden und <literal>Distribution</" -"literal> muss mit einem Schrägstrich (<literal>/</literal>) enden. Dies ist " -"nützlich, wenn nur ein bestimmter Unterabschnitt des von der URI angegebenen " -"Archivs von Interesse ist. Wenn <literal>Distribution</literal> keinen " -"genauen Pfad angibt, muss mindestens eine <literal>Komponente</literal> " -"angegeben sein." +"<literal>Suite</literal> kann einen genauen Pfad angeben. In diesem Fall " +"müssen die Komponenten weggelassen werden und <literal>Suite</literal> muss " +"mit einem Schrägstrich (<literal>/</literal>) enden. Dies ist nützlich, wenn " +"nur ein bestimmter Unterabschnitt des von der URI angegebenen Archivs von " +"Interesse ist. Wenn <literal>Suite</literal> keinen genauen Pfad angibt, muss " +"mindestens eine <literal>Komponente</literal> angegeben sein." #. type: Content of: <refentry><refsect1><para> #: sources.list.5.xml:114 -#, fuzzy -#| msgid "" -#| "<literal>distribution</literal> may also contain a variable, <literal>" -#| "$(ARCH)</literal> which expands to the Debian architecture (such as " -#| "<literal>amd64</literal> or <literal>armel</literal>) used on the system. " -#| "This permits architecture-independent <filename>sources.list</filename> " -#| "files to be used. In general this is only of interest when specifying an " -#| "exact path, <literal>APT</literal> will automatically generate a URI with " -#| "the current architecture otherwise." msgid "" "<literal>suite</literal> may also contain a variable, <literal>$(ARCH)</" "literal> which expands to the Debian architecture (such as <literal>amd64</" @@ -6794,8 +6803,8 @@ msgid "" "<literal>APT</literal> will automatically generate a URI with the current " "architecture otherwise." msgstr "" -"<literal>distribution</literal> könnte außerdem eine Variable, <literal>" -"$(ARCH)</literal>, enthalten, die zur Debian-Architektur (wie " +"<literal>Suite</literal> könnte außerdem eine Variable, " +"<literal>$(ARCH)</literal>, enthalten, die zur Debian-Architektur (wie " "<literal>amd64</literal> oder <literal>armel</literal>) expandiert wird, die " "auf dem System benutzt wird. Dies erlaubt es, architekturunabhängige " "<filename>sources.list</filename>-Dateien zu benutzen. Im Allgemeinen ist " @@ -6805,19 +6814,6 @@ msgstr "" #. type: Content of: <refentry><refsect1><para> #: sources.list.5.xml:122 -#, fuzzy -#| msgid "" -#| "Since only one distribution can be specified per line it may be necessary " -#| "to have multiple lines for the same URI, if a subset of all available " -#| "distributions or components at that location is desired. APT will sort " -#| "the URI list after it has generated a complete set internally, and will " -#| "collapse multiple references to the same Internet host, for instance, " -#| "into a single connection, so that it does not inefficiently establish an " -#| "FTP connection, close it, do something else, and then re-establish a " -#| "connection to that same host. This feature is useful for accessing busy " -#| "FTP sites with limits on the number of simultaneous anonymous users. APT " -#| "also parallelizes connections to different hosts to more effectively deal " -#| "with sites with low bandwidth." msgid "" "In the traditional style sources.list format since only one distribution can " "be specified per line it may be necessary to have multiple lines for the " @@ -6831,18 +6827,19 @@ msgid "" "users. APT also parallelizes connections to different hosts to more " "effectively deal with sites with low bandwidth." msgstr "" -"Da pro Zeile nur eine Distribution angegeben werden kann, könnte es nötig " -"sein, mehrere Zeilen für die gleiche URI zu haben, falls eine Untermenge " -"aller verfügbarer Distributionen oder Komponenten von diesem Ort gewünscht " -"wird. APT wird die URI-Liste sortieren, nachdem es intern eine komplette " -"Zusammenstellung generiert hat und es wird mehrere Bezüge zum gleichen " -"Internet-Rechner zusammenfassen, zum Beispiel zu einer einzigen Verbindung, " -"so dass es nicht ineffizient FTP-Verbindungen herstellt, sie schließt, sonst " -"etwas tut und dann erneut eine Verbindung zum gleichen Rechner herstellt. " -"Diese Funktion ist nützlich für den Zugriff auf ausgelastete FTP-Sites mit " -"Begrenzungen der Anzahl gleichzeitiger anonymer Anwender. APT parallelisiert " -"außerdem Verbindungen zu verschiedenen Rechnern, um effektiver mit Orten " -"niedriger Bandbreite hauszuhalten." +"In der Sources.list im herkömmlichen Formatstil könnte es nötig sein, da pro " +"Zeile nur eine Distribution angegeben werden kann, mehrere Zeilen für die " +"gleiche URI zu haben, falls eine Untermenge aller verfügbarer Distributionen " +"oder Komponenten von diesem Ort gewünscht wird. APT wird die URI-Liste " +"sortieren, nachdem es intern eine komplette Zusammenstellung generiert hat " +"und es wird mehrere Bezüge zum gleichen Internet-Rechner zusammenfassen, zum " +"Beispiel zu einer einzigen Verbindung, so dass es nicht ineffizient " +"FTP-Verbindungen herstellt, sie schließt, sonst etwas tut und dann erneut " +"eine Verbindung zum gleichen Rechner herstellt. Diese Funktion ist nützlich " +"für den Zugriff auf ausgelastete FTP-Sites mit Begrenzungen der Anzahl " +"gleichzeitiger anonymer Anwender. APT parallelisiert außerdem Verbindungen zu " +"verschiedenen Rechnern, um effektiver mit Orten niedriger Bandbreite " +"hauszuhalten." #. type: Content of: <refentry><refsect1><para> #: sources.list.5.xml:136 @@ -6879,26 +6876,19 @@ msgstr "" "heruntergeladen." #. type: Content of: <refentry><refsect1><para><itemizedlist><listitem><para> -#: sources.list.5.xml:146 -#, fuzzy -#| msgid "" -#| "<literal>arch=<replaceable>arch1</replaceable>,<replaceable>arch2</" -#| "replaceable>,…</literal> can be used to specify for which architectures " -#| "information should be downloaded. If this option is not set all " -#| "architectures defined by the <literal>APT::Architectures</literal> option " -#| "will be downloaded." +#: sources.list.5.xml:124 msgid "" "<literal>arch+=<replaceable>arch1</replaceable>,<replaceable>arch2</" "replaceable>,…</literal> and <literal>arch-=<replaceable>arch1</replaceable>," "<replaceable>arch2</replaceable>,…</literal> which can be used to add/remove " "architectures from the set which will be downloaded." msgstr "" -"<literal>arch=<replaceable>Architektur1</replaceable>," -"<replaceable>Architektur2</replaceable>, …</literal> kann benutzt werden, um " -"anzugeben, für welche Architekturen Paketinformationen heruntergeladen " -"werden sollen. Falls diese Option nicht gesetzt ist, werden alle durch die " -"Option <literal>APT::Architectures</literal> definierten Architekturen " -"heruntergeladen." +"<literal>arch+=<replaceable>Architektur1</replaceable>," +"<replaceable>Architektur2</replaceable>, …</literal> und <literal>arch-" +"=<replaceable>Architektur1</replaceable>,<replaceable>Architektur2</" +"replaceable>, …</literal>, die benutzt werden können, um der " +"Zusammenstellung, die heruntergeladen werden soll, Architekturen " +"hinzuzufügen oder zu entfernen." #. type: Content of: <refentry><refsect1><para><itemizedlist><listitem><para> #: sources.list.5.xml:149 @@ -8749,18 +8739,9 @@ msgstr "" #. type: <p></p> #: guide.sgml:163 -#, fuzzy -#| msgid "" -#| "<prgn>apt-get</prgn> has several command line options that are detailed " -#| "in its man page, <manref section=\"8\" name=\"apt-get\">. The most useful " -#| "option is <tt>-d</tt> which does not install the fetched files. If the " -#| "system has to download a large number of package it would be undesired to " -#| "start installing them in case something goes wrong. When <tt>-d</tt> is " -#| "used the downloaded archives can be installed by simply running the " -#| "command that caused them to be downloaded again without <tt>-d</tt>." msgid "" "<prgn>apt-get</prgn> has several command line options that are detailed in " -"its man page, <manref name=\"apt-get\" section=\"8\">. The most useful " +"its man page, <manref section=\"8\" name=\"apt-get\">. The most useful " "option is <tt>-d</tt> which does not install the fetched files. If the " "system has to download a large number of package it would be undesired to " "start installing them in case something goes wrong. When <tt>-d</tt> is used " diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc index 015c790e0..80fe6e17e 100644 --- a/ftparchive/contents.cc +++ b/ftparchive/contents.cc @@ -233,7 +233,7 @@ void GenContents::Add(const char *Dir,const char *Package) // The final component if it does not have a trailing / if (I - Start >= 1) - Root = Grab(Root,Start,Package); + Grab(Root,Start,Package); } /*}}}*/ // GenContents::WriteSpace - Write a given number of white space chars /*{{{*/ diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index 1fea589e2..265fb1a80 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -21,9 +21,9 @@ #include <apt-pkg/error.h> #include <apt-pkg/md5.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> -#include <utime.h> #include <unistd.h> #include <iostream> @@ -234,14 +234,12 @@ bool MultiCompress::Finalize(unsigned long long &OutSize) else { // Update the mtime if necessary - if (UpdateMTime > 0 && + if (UpdateMTime > 0 && (Now - St.st_mtime > (signed)UpdateMTime || St.st_mtime > Now)) { - struct utimbuf Buf; - Buf.actime = Buf.modtime = Now; - utime(I->Output.c_str(),&Buf); + utimensat(AT_FDCWD, I->Output.c_str(), NULL, AT_SYMLINK_NOFOLLOW); Changed = true; - } + } } // Force the file permissions diff --git a/ftparchive/override.cc b/ftparchive/override.cc index 4db6e8e7a..beedf5d73 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -52,45 +52,41 @@ bool Override::ReadOverride(string const &File,bool const &Source) if (*Pkg == 0) continue; +#define APT_FIND_NEXT_FIELD \ + for (End++; isspace(*End) != 0 && *End != 0; ++End) \ + /* skip spaces */ ; \ + Start = End; \ + for (; isspace(*End) == 0 && *End != 0; ++End) \ + /* find end of word */ ; + +#define APT_WARNING_MALFORMED_LINE(FIELD) \ + if (*End == 0) \ + { \ + _error->Warning(_("Malformed override %s line %llu (%s)"),File.c_str(), \ + Counter, FIELD ); \ + continue; \ + } \ + *End = 0; + // Find the package and zero.. - char *Start = Pkg; + char *Start; char *End = Pkg; for (; isspace(*End) == 0 && *End != 0; End++); - if (*End == 0) - { - _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(), - Counter); - continue; - } - *End = 0; + APT_WARNING_MALFORMED_LINE("pkgname"); + + APT_FIND_NEXT_FIELD; // Find the priority if (Source == false) { - for (End++; isspace(*End) != 0 && *End != 0; End++); - Start = End; - for (; isspace(*End) == 0 && *End != 0; End++); - if (*End == 0) - { - _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(), - Counter); - continue; - } - *End = 0; + APT_WARNING_MALFORMED_LINE("priority"); Itm.Priority = Start; + + APT_FIND_NEXT_FIELD; } - + // Find the Section - for (End++; isspace(*End) != 0 && *End != 0; End++); - Start = End; - for (; isspace(*End) == 0 && *End != 0; End++); - if (*End == 0) - { - _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(), - Counter); - continue; - } - *End = 0; + APT_WARNING_MALFORMED_LINE("section"); Itm.FieldOverride["Section"] = Start; // Source override files only have the two columns @@ -99,7 +95,7 @@ bool Override::ReadOverride(string const &File,bool const &Source) Mapping[Pkg] = Itm; continue; } - + // Find the => for (End++; isspace(*End) != 0 && *End != 0; End++); if (*End != 0) diff --git a/methods/connect.cc b/methods/connect.cc index fc7a72ee9..d9c9a1dd4 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -142,9 +142,9 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, // Convert the port name/number char ServStr[300]; if (Port != 0) - snprintf(ServStr,sizeof(ServStr),"%u",Port); + snprintf(ServStr,sizeof(ServStr),"%i", Port); else - snprintf(ServStr,sizeof(ServStr),"%s",Service); + snprintf(ServStr,sizeof(ServStr),"%s", Service); /* We used a cached address record.. Yes this is against the spec but the way we have setup our rotating dns suggests that this is more @@ -190,7 +190,7 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, { if (DefPort != 0) { - snprintf(ServStr,sizeof(ServStr),"%u",DefPort); + snprintf(ServStr, sizeof(ServStr), "%i", DefPort); DefPort = 0; continue; } diff --git a/methods/copy.cc b/methods/copy.cc index e81d0022b..744cc2b51 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -18,7 +18,6 @@ #include <apt-pkg/hashes.h> #include <sys/stat.h> -#include <utime.h> #include <unistd.h> #include <apti18n.h> /*}}}*/ @@ -71,18 +70,19 @@ bool CopyMethod::Fetch(FetchItem *Itm) } From.Close(); - To.Close(); - + // Transfer the modification times - struct utimbuf TimeBuf; - TimeBuf.actime = Buf.st_atime; - TimeBuf.modtime = Buf.st_mtime; - if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0) + struct timespec times[2]; + times[0].tv_sec = Buf.st_atime; + times[1].tv_sec = Buf.st_mtime; + times[0].tv_nsec = times[1].tv_nsec = 0; + if (futimens(To.Fd(), times) != 0) { To.OpFail(); - return _error->Errno("utime",_("Failed to set modification time")); + return _error->Errno("futimens",_("Failed to set modification time")); } - + To.Close(); + Hashes Hash; FileFd Fd(Res.Filename, FileFd::ReadOnly); Hash.AddFD(Fd); diff --git a/methods/ftp.cc b/methods/ftp.cc index 979adca62..2d05364d5 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -26,7 +26,6 @@ #include <sys/stat.h> #include <sys/time.h> -#include <utime.h> #include <unistd.h> #include <signal.h> #include <stdio.h> @@ -953,14 +952,16 @@ void FtpMethod::SigTerm(int) { if (FailFd == -1) _exit(100); - close(FailFd); - + // Timestamp - struct utimbuf UBuf; - UBuf.actime = FailTime; - UBuf.modtime = FailTime; - utime(FailFile.c_str(),&UBuf); - + struct timespec times[2]; + times[0].tv_sec = FailTime; + times[1].tv_sec = FailTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(FailFd, times); + + close(FailFd); + _exit(100); } /*}}}*/ @@ -1059,13 +1060,14 @@ bool FtpMethod::Fetch(FetchItem *Itm) if (Server->Get(File,Fd,Res.ResumePoint,Hash,Missing) == false) { Fd.Close(); - + // Timestamp - struct utimbuf UBuf; - UBuf.actime = FailTime; - UBuf.modtime = FailTime; - utime(FailFile.c_str(),&UBuf); - + struct timespec times[2]; + times[0].tv_sec = FailTime; + times[1].tv_sec = FailTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(FailFd, times); + // If the file is missing we hard fail and delete the destfile // otherwise transient fail if (Missing == true) { @@ -1077,20 +1079,21 @@ bool FtpMethod::Fetch(FetchItem *Itm) } Res.Size = Fd.Size(); + + // Timestamp + struct timespec times[2]; + times[0].tv_sec = FailTime; + times[1].tv_sec = FailTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(Fd.Fd(), times); + FailFd = -1; } - + Res.LastModified = FailTime; Res.TakeHashes(Hash); - - // Timestamp - struct utimbuf UBuf; - UBuf.actime = FailTime; - UBuf.modtime = FailTime; - utime(Queue->DestFile.c_str(),&UBuf); - FailFd = -1; URIDone(Res); - + return true; } /*}}}*/ diff --git a/methods/gzip.cc b/methods/gzip.cc index 48c8e9892..f1edb353b 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -19,7 +19,6 @@ #include <sys/stat.h> #include <unistd.h> -#include <utime.h> #include <stdio.h> #include <errno.h> #include <apti18n.h> @@ -94,32 +93,35 @@ bool GzipMethod::Fetch(FetchItem *Itm) } From.Close(); - To.Close(); - + if (Failed == true) return false; - + // Transfer the modification times struct stat Buf; if (stat(Path.c_str(),&Buf) != 0) return _error->Errno("stat",_("Failed to stat")); - struct utimbuf TimeBuf; - TimeBuf.actime = Buf.st_atime; - TimeBuf.modtime = Buf.st_mtime; - if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0) - return _error->Errno("utime",_("Failed to set modification time")); + struct timespec times[2]; + times[0].tv_sec = Buf.st_atime; + times[1].tv_sec = Buf.st_mtime; + times[0].tv_nsec = times[1].tv_nsec = 0; + if (futimens(To.Fd(), times) != 0) + { + To.OpFail(); + return _error->Errno("futimens",_("Failed to set modification time")); + } + Res.Size = To.FileSize(); + To.Close(); if (stat(Itm->DestFile.c_str(),&Buf) != 0) return _error->Errno("stat",_("Failed to stat")); - + // Return a Done response Res.LastModified = Buf.st_mtime; - Res.Size = Buf.st_size; Res.TakeHashes(Hash); URIDone(Res); - return true; } /*}}}*/ diff --git a/methods/http.cc b/methods/http.cc index b22b61efc..e1390afcb 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -97,8 +97,6 @@ void CircleBuf::Reset() is non-blocking.. */ bool CircleBuf::Read(int Fd) { - unsigned long long BwReadMax; - while (1) { // Woops, buffer is full @@ -106,7 +104,7 @@ bool CircleBuf::Read(int Fd) return true; // what's left to read in this tick - BwReadMax = CircleBuf::BwReadLimit/BW_HZ; + unsigned long long const BwReadMax = CircleBuf::BwReadLimit/BW_HZ; if(CircleBuf::BwReadLimit) { struct timeval now; diff --git a/methods/https.cc b/methods/https.cc index 2a562434b..e16e36339 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -21,7 +21,6 @@ #include <sys/stat.h> #include <sys/time.h> -#include <utime.h> #include <unistd.h> #include <signal.h> #include <stdio.h> @@ -405,10 +404,11 @@ bool HttpsMethod::Fetch(FetchItem *Itm) curl_easy_getinfo(curl, CURLINFO_FILETIME, &Res.LastModified); if (Res.LastModified != -1) { - struct utimbuf UBuf; - UBuf.actime = Res.LastModified; - UBuf.modtime = Res.LastModified; - utime(File->Name().c_str(),&UBuf); + struct timespec times[2]; + times[0].tv_sec = Res.LastModified; + times[1].tv_sec = Res.LastModified; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(File->Fd(), times); } else Res.LastModified = resultStat.st_mtime; diff --git a/methods/https.h b/methods/https.h index 8632d6d02..89a89d19c 100644 --- a/methods/https.h +++ b/methods/https.h @@ -65,7 +65,7 @@ class HttpsMethod : public pkgAcqMethod public: FileFd *File; - HttpsMethod() : pkgAcqMethod("1.2",Pipeline | SendConfig) + HttpsMethod() : pkgAcqMethod("1.2",Pipeline | SendConfig), File(NULL) { File = 0; curl = curl_easy_init(); diff --git a/methods/mirror.cc b/methods/mirror.cc index 854366318..83ef0d133 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -114,7 +114,7 @@ bool MirrorMethod::Clean(string Dir) for(I=list.begin(); I != list.end(); ++I) { string uri = (*I)->GetURI(); - if(uri.find("mirror://") != 0) + if(uri.compare(0, strlen("mirror://"), "mirror://") != 0) continue; string BaseUri = uri.substr(0,uri.size()-1); if (URItoFileName(BaseUri) == Dir->d_name) @@ -198,9 +198,9 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file) // "stable" on the same machine. this is to avoid running into out-of-sync // issues (i.e. Release/Release.gpg different on each mirror) struct utsname buf; - int seed=1, i; + int seed=1; if(uname(&buf) == 0) { - for(i=0,seed=1; buf.nodename[i] != 0; i++) { + for(int i=0,seed=1; buf.nodename[i] != 0; ++i) { seed = seed * 31 + buf.nodename[i]; } } @@ -306,7 +306,7 @@ bool MirrorMethod::InitMirrors() if (s.size() == 0) continue; // ignore non http lines - if (s.find("http://") != 0) + if (s.compare(0, strlen("http://"), "http://") != 0) continue; AllMirrors.push_back(s); diff --git a/methods/rsh.cc b/methods/rsh.cc index d76dca6ef..a441220bf 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -20,7 +20,6 @@ #include <sys/stat.h> #include <sys/time.h> -#include <utime.h> #include <unistd.h> #include <signal.h> #include <stdio.h> @@ -395,13 +394,14 @@ void RSHMethod::SigTerm(int sig) { if (FailFd == -1) _exit(100); - close(FailFd); - // Timestamp - struct utimbuf UBuf; - UBuf.actime = FailTime; - UBuf.modtime = FailTime; - utime(FailFile.c_str(),&UBuf); + // Transfer the modification times + struct timespec times[2]; + times[0].tv_sec = FailTime; + times[1].tv_sec = FailTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(FailFd, times); + close(FailFd); _exit(100); } @@ -488,10 +488,11 @@ bool RSHMethod::Fetch(FetchItem *Itm) Fd.Close(); // Timestamp - struct utimbuf UBuf; - UBuf.actime = FailTime; - UBuf.modtime = FailTime; - utime(FailFile.c_str(),&UBuf); + struct timespec times[2]; + times[0].tv_sec = FailTime; + times[1].tv_sec = FailTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(FailFd, times); // If the file is missing we hard fail otherwise transient fail if (Missing == true) @@ -501,18 +502,17 @@ bool RSHMethod::Fetch(FetchItem *Itm) } Res.Size = Fd.Size(); + struct timespec times[2]; + times[0].tv_sec = FailTime; + times[1].tv_sec = FailTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(Fd.Fd(), times); + FailFd = -1; } Res.LastModified = FailTime; Res.TakeHashes(Hash); - // Timestamp - struct utimbuf UBuf; - UBuf.actime = FailTime; - UBuf.modtime = FailTime; - utime(Queue->DestFile.c_str(),&UBuf); - FailFd = -1; - URIDone(Res); return true; diff --git a/methods/server.cc b/methods/server.cc index a2128441c..e12c23c07 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -17,9 +17,9 @@ #include <apt-pkg/hashes.h> #include <apt-pkg/netrc.h> +#include <fcntl.h> #include <sys/stat.h> #include <sys/time.h> -#include <utime.h> #include <unistd.h> #include <signal.h> #include <stdio.h> @@ -368,14 +368,14 @@ void ServerMethod::SigTerm(int) { if (FailFd == -1) _exit(100); + + struct timespec times[2]; + times[0].tv_sec = FailTime; + times[1].tv_sec = FailTime; + times[0].tv_nsec = times[1].tv_nsec = 0; + futimens(FailFd, times); close(FailFd); - - // Timestamp - struct utimbuf UBuf; - UBuf.actime = FailTime; - UBuf.modtime = FailTime; - utime(FailFile.c_str(),&UBuf); - + _exit(100); } /*}}}*/ @@ -539,11 +539,10 @@ int ServerMethod::Loop() File = 0; // Timestamp - struct utimbuf UBuf; - time(&UBuf.actime); - UBuf.actime = Server->Date; - UBuf.modtime = Server->Date; - utime(Queue->DestFile.c_str(),&UBuf); + struct timespec times[2]; + times[0].tv_sec = times[1].tv_sec = Server->Date; + times[0].tv_nsec = times[1].tv_nsec = 0; + utimensat(AT_FDCWD, Queue->DestFile.c_str(), times, AT_SYMLINK_NOFOLLOW); // Send status to APT if (Result == true) diff --git a/methods/server.h b/methods/server.h index 4dc6a1f2f..2b81e6173 100644 --- a/methods/server.h +++ b/methods/server.h @@ -137,7 +137,7 @@ class ServerMethod : public pkgAcqMethod virtual ServerState * CreateServerState(URI uri) = 0; virtual void RotateDNS() = 0; - ServerMethod(const char *Ver,unsigned long Flags = 0) : pkgAcqMethod(Ver, Flags), PipelineDepth(0), AllowRedirect(false), Debug(false) {}; + ServerMethod(const char *Ver,unsigned long Flags = 0) : pkgAcqMethod(Ver, Flags), Server(NULL), File(NULL), PipelineDepth(0), AllowRedirect(false), Debug(false) {}; virtual ~ServerMethod() {}; }; diff --git a/test/integration/framework b/test/integration/framework index ca2f90050..5b9a58568 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -3,40 +3,46 @@ EXIT_CODE=0 # we all like colorful messages -if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null && \ - expr match "$(readlink -f /proc/$$/fd/2)" '/dev/pts/[0-9]\+' > /dev/null; then - CERROR="[1;31m" # red - CWARNING="[1;33m" # yellow - CMSG="[1;32m" # green - CINFO="[1;96m" # light blue - CDEBUG="[1;94m" # blue - CNORMAL="[0;39m" # default system console color - CDONE="[1;32m" # green - CPASS="[1;32m" # green - CFAIL="[1;31m" # red - CCMD="[1;35m" # pink +if [ "$MSGCOLOR" != 'NO' ]; then + if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then + export MSGCOLOR='NO' + fi +fi + + +if [ "$MSGCOLOR" != 'NO' ]; then + CERROR="\033[1;31m" # red + CWARNING="\033[1;33m" # yellow + CMSG="\033[1;32m" # green + CINFO="\033[1;96m" # light blue + CDEBUG="\033[1;94m" # blue + CNORMAL="\033[0;39m" # default system console color + CDONE="\033[1;32m" # green + CPASS="\033[1;32m" # green + CFAIL="\033[1;31m" # red + CCMD="\033[1;35m" # pink fi msgdie() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; } msgwarn() { echo "${CWARNING}W: $1${CNORMAL}" >&2; } -msgmsg() { echo "${CMSG}$1${CNORMAL}" >&2; } -msginfo() { echo "${CINFO}I: $1${CNORMAL}" >&2; } -msgdebug() { echo "${CDEBUG}D: $1${CNORMAL}" >&2; } -msgdone() { echo "${CDONE}DONE${CNORMAL}" >&2; } +msgmsg() { echo "${CMSG}$1${CNORMAL}"; } +msginfo() { echo "${CINFO}I: $1${CNORMAL}"; } +msgdebug() { echo "${CDEBUG}D: $1${CNORMAL}"; } +msgdone() { echo "${CDONE}DONE${CNORMAL}"; } msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; } -msgnmsg() { echo -n "${CMSG}$1${CNORMAL}" >&2; } -msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}" >&2; } -msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}" >&2; } +msgnmsg() { echo -n "${CMSG}$1${CNORMAL}"; } +msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}"; } +msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}"; } msgtest() { while [ -n "$1" ]; do - echo -n "${CINFO}$1${CCMD} " >&2; - echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " >&2; + echo -n "${CINFO}$1${CCMD} " + echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " shift if [ -n "$1" ]; then shift; else break; fi done - echo -n "…${CNORMAL} " >&2; + echo -n "…${CNORMAL} " } -msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; } +msgpass() { echo "${CPASS}PASS${CNORMAL}"; } msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; } msgfail() { if [ $# -gt 0 ]; then echo "${CFAIL}FAIL: $*${CNORMAL}" >&2; @@ -57,7 +63,7 @@ if [ $MSGLEVEL -le 2 ]; then msgmsg() { true; } msgnmsg() { true; } msgtest() { true; } - msgpass() { echo -n " ${CPASS}P${CNORMAL}" >&2; } + msgpass() { echo -n " ${CPASS}P${CNORMAL}"; } msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; } if [ -n "$CFAIL" ]; then msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } @@ -81,50 +87,59 @@ msgdone() { [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then true; else - echo "${CDONE}DONE${CNORMAL}" >&2; + echo "${CDONE}DONE${CNORMAL}"; fi } runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " + local CMD="$1" + shift if [ -f ./aptconfig.conf ]; then - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" elif [ -f ../aptconfig.conf ]; then - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" else - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" fi } -aptconfig() { runapt apt-config $*; } -aptcache() { runapt apt-cache $*; } -aptcdrom() { runapt apt-cdrom $*; } -aptget() { runapt apt-get $*; } -apt() { runapt apt $*; } -aptftparchive() { runapt apt-ftparchive $*; } -aptkey() { runapt apt-key $*; } -aptmark() { runapt apt-mark $*; } +aptconfig() { runapt apt-config "$@"; } +aptcache() { runapt apt-cache "$@"; } +aptcdrom() { runapt apt-cdrom "$@"; } +aptget() { runapt apt-get "$@"; } +aptftparchive() { runapt apt-ftparchive "$@"; } +aptkey() { runapt apt-key "$@"; } +aptmark() { runapt apt-mark "$@"; } +apt() { runapt apt "$@"; } aptwebserver() { - LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver $*; + LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@"; } dpkg() { - $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $* + command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" } aptitude() { if [ -f ./aptconfig.conf ]; then - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $* + APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" elif [ -f ../aptconfig.conf ]; then - APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $* + APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" else - LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $* + LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" fi } gdb() { echo "gdb: run »$*«" - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1 --args $* + APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@" } http() { LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http } +gpg() { + # see apt-key for the whole trickery. Setup is done in setupenvironment + command gpg --ignore-time-conflict --no-options --no-default-keyring \ + --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \ + --no-auto-check-trustdb --trust-model always \ + "$@" +} exitwithstatus() { # error if we about to overflow, but ... @@ -171,7 +186,7 @@ setupenvironment() { mkdir rootdir aptarchive keys cd rootdir mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d - mkdir -p var/cache var/lib var/log + mkdir -p var/cache var/lib var/log tmp mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers touch var/lib/dpkg/available mkdir -p usr/lib/apt @@ -197,16 +212,30 @@ setupenvironment() { echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf - if ! $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then + if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it… fi echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf echo 'quiet::NoUpdate "true";' >> aptconfig.conf echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary - export LC_ALL=C + export LC_ALL=C.UTF-8 export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" configcompression '.' 'gz' #'bz2' 'lzma' 'xz' + + # gpg needs a trustdb to function, but it can't be invalid (not even empty) + # see also apt-key where this trickery comes from: + local TRUSTDBDIR="${TMPWORKINGDIRECTORY}/gnupghome" + mkdir "$TRUSTDBDIR" + chmod 700 "$TRUSTDBDIR" + # We also don't use a secret keyring, of course, but gpg panics and + # implodes if there isn't one available - and writeable for imports + local SECRETKEYRING="${TRUSTDBDIR}/secring.gpg" + touch $SECRETKEYRING + # now create the trustdb with an (empty) dummy keyring + # newer gpg versions are fine without it, but play it safe for now + gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1 + msgdone "info" } @@ -248,7 +277,7 @@ configdpkg() { fi fi rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg - if $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then + if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then local ARCHS="$(getarchitectures)" if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then DPKGARCH="$(dpkg --print-architecture)" @@ -392,7 +421,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control | while read SRC; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then -# gpg --yes --no-default-keyring --secret-keyring ./keys/joesixpack.sec \ +# gpg --yes --secret-keyring ./keys/joesixpack.sec \ # --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \ # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" @@ -410,7 +439,14 @@ Package: $NAME" >> ${BUILDDIR}/debian/control (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch) (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) - dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null + local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" + # ensure the right permissions as dpkg-deb ensists + chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN + if ! dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then + cat $LOG + false + fi + rm $LOG echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist done @@ -426,14 +462,19 @@ buildpackage() { local RELEASE=$2 local SECTION=$3 local ARCH=$(getarchitecture $4) - msgninfo "Build package $(echo "$BUILDDIR" | grep -o '[^/]*$') for ${RELEASE} in ${SECTION}… " + local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" + local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" + msgninfo "Build package ${PKGNAME} for ${RELEASE} in ${SECTION}… " cd $BUILDDIR if [ "$ARCH" = "all" ]; then ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" fi - local BUILT="$(dpkg-buildpackage -uc -us -a$ARCH 2> /dev/null)" - local PKGS="$( echo "$BUILT" | grep '^dpkg-deb: building package' | cut -d'/' -f 2 | sed -e "s#'\.##")" - local SRCS="$( echo "$BUILT" | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')" + if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then + cat $BUILDLOG + false + fi + local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")" + local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')" cd - > /dev/null for PKG in $PKGS; do echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist @@ -446,9 +487,9 @@ buildpackage() { buildaptarchive() { if [ -d incoming ]; then - buildaptarchivefromincoming $* + buildaptarchivefromincoming "$@" else - buildaptarchivefromfiles $* + buildaptarchivefromfiles "$@" fi } @@ -664,7 +705,12 @@ compressfile() { } # can be overridden by testcases for their pleasure -getcodenamefromsuite() { echo -n "$1"; } +getcodenamefromsuite() { + case "$1" in + unstable) echo 'sid';; + *) echo -n "$1";; + esac +} getreleaseversionfromsuite() { true; } getlabelfromsuite() { true; } @@ -761,7 +807,7 @@ setupaptarchive() { signreleasefiles() { local SIGNER="${1:-Joe Sixpack}" - local GPG="gpg --batch --yes --no-default-keyring --trustdb-name rootdir/etc/apt/trustdb.gpg" + local GPG="gpg --batch --yes" msgninfo "\tSign archive with $SIGNER key… " local REXKEY='keys/rexexpired' local SECEXPIREBAK="${REXKEY}.sec.bak" @@ -808,8 +854,7 @@ webserverconfig() { downloadfile "http://localhost:8080/_config/set/${1}/${2}" '/dev/null' >/dev/null local DOWNLOG='download-testfile.log' rm -f "$DOWNLOG" - local STATUS="$(mktemp)" - addtrap "rm $STATUS;" + local STATUS="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.status" downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" if [ "$(cat "$STATUS")" = '200' ]; then msgpass @@ -817,6 +862,7 @@ webserverconfig() { cat >&2 "$DOWNLOG" msgfail "Statuscode was $(cat "$STATUS")" fi + rm "$STATUS" } rewritesourceslist() { @@ -832,10 +878,13 @@ changetowebserver() { else shift fi - local LOG='/dev/null' if test -x ${APTWEBSERVERBINDIR}/aptwebserver; then cd aptarchive - aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1 + local LOG="webserver.log" + if ! aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1 ; then + cat $LOG + false + fi local PID="$(cat aptwebserver.pid)" if [ -z "$PID" ]; then msgdie 'Could not fork aptwebserver successfully' @@ -924,7 +973,7 @@ Filename: ${2} } checkdiff() { - local DIFFTEXT="$($(which diff) -u $* | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" + local DIFFTEXT="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" if [ -n "$DIFFTEXT" ]; then echo echo "$DIFFTEXT" @@ -957,8 +1006,7 @@ testequal() { shift fi - local COMPAREFILE=$(mktemp) - addtrap "rm $COMPAREFILE;" + local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" echo "$1" > $COMPAREFILE shift @@ -969,10 +1017,9 @@ testequal() { } testequalor2() { - local COMPAREFILE1=$(mktemp) - local COMPAREFILE2=$(mktemp) - local COMPAREAGAINST=$(mktemp) - addtrap "rm $COMPAREFILE1 $COMPAREFILE2 $COMPAREAGAINST;" + local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" + local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" + local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" echo "$1" > $COMPAREFILE1 echo "$2" > $COMPAREFILE2 shift 2 @@ -998,8 +1045,7 @@ N: Can't select versions from package '$1' as it is purely virtual" msgtest "Test for virtual packages" "apt-cache show $PACKAGE" VIRTUAL="${VIRTUAL} N: No packages found" - local COMPAREFILE=$(mktemp) - addtrap "rm $COMPAREFILE;" + local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" local ARCH="$(getarchitecture 'native')" echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail @@ -1007,7 +1053,7 @@ N: No packages found" testnopackage() { msgtest "Test for non-existent packages" "apt-cache show $*" - local SHOWPKG="$(aptcache show $* 2>&1 | grep '^Package: ')" + local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" if [ -n "$SHOWPKG" ]; then echo echo "$SHOWPKG" @@ -1019,10 +1065,10 @@ testnopackage() { testdpkginstalled() { msgtest "Test for correctly installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l $* 2>/dev/null | grep '^i' | wc -l)" + local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)" if [ "$PKGS" != $# ]; then echo $PKGS - dpkg -l $* | grep '^[a-z]' + dpkg -l "$@" | grep '^[a-z]' msgfail return 1 fi @@ -1031,10 +1077,10 @@ testdpkginstalled() { testdpkgnotinstalled() { msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l $* 2> /dev/null | grep '^i' | wc -l)" + local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)" if [ "$PKGS" != 0 ]; then echo - dpkg -l $* | grep '^[a-z]' + dpkg -l "$@" | grep '^[a-z]' msgfail return 1 fi @@ -1042,8 +1088,7 @@ testdpkgnotinstalled() { } testmarkedauto() { - local COMPAREFILE=$(mktemp) - addtrap "rm $COMPAREFILE;" + local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" if [ -n "$1" ]; then msgtest 'Test for correctly marked as auto-installed' "$*" while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE @@ -1060,8 +1105,7 @@ testsuccess() { else msgtest 'Test for successful execution of' "$*" fi - local OUTPUT=$(mktemp) - addtrap "rm $OUTPUT;" + local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" if $@ >${OUTPUT} 2>&1; then msgpass else @@ -1077,8 +1121,7 @@ testfailure() { else msgtest 'Test for failure in execution of' "$*" fi - local OUTPUT=$(mktemp) - addtrap "rm $OUTPUT;" + local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" if $@ >${OUTPUT} 2>&1; then echo cat $OUTPUT diff --git a/test/integration/run-tests b/test/integration/run-tests index 7316016e2..79d5d1a29 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -2,24 +2,38 @@ set -e FAIL=0 +PASS=0 +ALL=0 + FAILED_TESTS="" DIR=$(readlink -f $(dirname $0)) -if [ "$1" = "-q" ]; then - export MSGLEVEL=2 -elif [ "$1" = "-v" ]; then - export MSGLEVEL=4 -fi +while [ -n "$1" ]; do + if [ "$1" = "-q" ]; then + export MSGLEVEL=2 + elif [ "$1" = "-v" ]; then + export MSGLEVEL=4 + elif [ "$1" = '--color=no' ]; then + export MSGCOLOR='NO' + else + echo >&2 "WARNING: Unknown parameter »$1« will be ignored" + fi + shift +done +export MSGLEVEL="${MSGLEVEL:-3}" -if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then +if [ "$MSGCOLOR" != 'NO' ]; then + if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then + export MSGCOLOR='NO' + fi +fi +if [ "$MSGCOLOR" != 'NO' ]; then CTEST='\033[1;32m' CHIGH='\033[1;35m' CRESET='\033[0m' -elif [ -z "${MSGLEVEL}" ]; then - export MSGLEVEL=2 -fi - -if [ -z "$MSGLEVEL" ]; then - MSGLEVEL=5 +else + CTEST='' + CHIGH='' + CRESET='' fi for testcase in $(run-parts --list $DIR | grep '/test-'); do @@ -29,18 +43,23 @@ for testcase in $(run-parts --list $DIR | grep '/test-'); do echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}" fi if ! ${testcase}; then - FAIL=$((FAIL+1)) - FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" - echo "$(basename $testcase) ... FAIL" - fi + FAIL=$((FAIL+1)) + FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" + echo >&2 "$(basename $testcase) ... FAIL" + else + PASS=$((PASS+1)) + fi + ALL=$((ALL+1)) if [ "$MSGLEVEL" -le 2 ]; then echo fi done -echo "failures: $FAIL" -if [ -n "$FAILED_TESTS" ]; then - echo "Failed tests: $FAILED_TESTS"; +echo >&2 "Statistics: $ALL tests were run: $PASS successfully and $FAIL failed" +if [ -n "$FAILED_TESTS" ]; then + echo >&2 "Failed tests: $FAILED_TESTS" +else + echo >&2 'All tests seem to have been run successfully. What could possibly go wrong?' fi # ensure we don't overflow exit $((FAIL <= 255 ? FAIL : 255)) diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 6eac079f3..fce0be018 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -19,7 +19,8 @@ testdownload() { APT="${APT}/${3}" fi msgtest "Test download of package file $1 with" "$APT" - aptget -qq download ${APT} && test -f $1 && msgpass || msgfail + testsuccess --nomsg aptget download ${APT} + testsuccess test -f $1 rm $1 } diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source index 3ee7a9e23..083e26db1 100755 --- a/test/integration/test-apt-get-source +++ b/test/integration/test-apt-get-source @@ -39,12 +39,24 @@ Need to get 0 B of source archives. 'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo -# select by release +# select by release: suite testequal "$HEADER Selected version '1.0' (stable) for foo Need to get 0 B of source archives. 'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/stable +testequal "$HEADER +Selected version '2.0' (unstable) for foo +Need to get 0 B of source archives. +'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/unstable + +# select by release: codename +testequal "$HEADER +Selected version '2.0' (sid) for foo +Need to get 0 B of source archives. +'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/sid # select by version testequal "$HEADER diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 742adb5e2..87f1886ea 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -7,6 +7,8 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'i386' +echo 'APT::Sources::Use-Deb822 "true";' > rootdir/etc/apt/apt.conf.d/00enabledeb822 + SOURCES='rootdir/etc/apt/sources.list' BASE='# some comment # that contains a : as well @@ -19,13 +21,13 @@ Sections: main Description: summay and the long part' -msgtest 'Test old-style sources.list' +msgtest 'Test sources.list' 'old style' echo "deb http://ftp.debian.org/debian stable main" > $SOURCES testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris -msgtest 'Test simple deb822 sources.list' +msgtest 'Test sources.list' 'simple deb822' echo "$BASE" > $SOURCES testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only index e9d684309..50ca2bf57 100755 --- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only +++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only @@ -35,5 +35,5 @@ testequal "Package files: 100 ${ROOTDIR}/rootdir/var/lib/dpkg/status release a=now 500 file:${ROOTDIR}/aptarchive/ unstable/main i386 Packages - release a=unstable,n=unstable,c=main + release a=unstable,n=sid,c=main Pinned packages:" aptcache policy diff --git a/test/interactive-helper/rpmver.cc b/test/interactive-helper/rpmver.cc index 9fc807de8..15c96cbbe 100644 --- a/test/interactive-helper/rpmver.cc +++ b/test/interactive-helper/rpmver.cc @@ -2,6 +2,7 @@ #include <rpm/rpmio.h> #include <rpm/misc.h> #include <stdlib.h> +#include <stdio.h> #include <ctype.h> #define xisdigit(x) isdigit(x) @@ -12,10 +13,8 @@ using namespace std; int rpmvercmp(const char * a, const char * b) { - char oldch1, oldch2; char * str1, * str2; char * one, * two; - int rc; int isnum; /* easy comparison to see if versions are identical */ @@ -53,9 +52,9 @@ int rpmvercmp(const char * a, const char * b) /* save character at the end of the alpha or numeric segment */ /* so that they can be restored after the comparison */ - oldch1 = *str1; + char oldch1 = *str1; *str1 = '\0'; - oldch2 = *str2; + char oldch2 = *str2; *str2 = '\0'; /* take care of the case where the two version segments are */ @@ -81,7 +80,7 @@ int rpmvercmp(const char * a, const char * b) /* segments are alpha or if they are numeric. don't return */ /* if they are equal because there might be more segments to */ /* compare */ - rc = strcmp(one, two); + int rc = strcmp(one, two); if (rc) return rc; /* restore character that was replaced by null above */ diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc index 677b1c892..e95016240 100644 --- a/test/libapt/parsedepends_test.cc +++ b/test/libapt/parsedepends_test.cc @@ -176,7 +176,7 @@ test: equals("7.15.3~", Version); equals(Null | pkgCache::Dep::Equals | pkgCache::Dep::Or, Op); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); if (StripMultiArch == true) equals("overlord-dev", Package); else |