cmdline/apt-key: Create new keyrings with mode 0644 instead of 0600
cmdline/apt-key: Accept nonexistent --keyring file with adv as well
fix double free (closes: #711045)
Fix double free (closes: #711045)

* Fix double free (closes: #711045)

* Fix crash when the "mirror" method does not find any entry
  (closes: #699303)
prepare release
Merge branch 'debian/sid' of https://github.com/ion1/apt into debian/sid
merged trunk
streamline .gitignore further

adding some comments, regrouping files and use some patterns to avoid
updating the ignore file for new translations or abi changes

Git-Dch: Ignore
build the en manpages in subdirectory doc/en

Building manpages becames more consistent this way and
it is simpler to ignore build artefacts, too.
remove -ldl from cdrom and -lutil from apt-get linkage

Building src:apt shows:
dpkg-shlibdeps: warning: package could avoid a useless dependency if
debian/apt/usr/lib/apt/methods/cdrom was not linked against libdl.so.2
(it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if
debian/apt/usr/bin/apt-get was not linked against libutil.so.1 (it uses
none of the library's symbols)
rewrite pkgOrderList::DepRemove to stop incorrect immediate setting

Some squeeze → wheezy upgrades indicate that DepRemove runs amok
in complicated setups as it wasn't correctly working with or-groups.
Completely rewritten the check is now moving from or-group to or-group
instead.

The behavior should be the same as the code before, but
(hopefully) with less bugs and more comments.

Closes: 645713
prefer Essentials over Removals in ordering score

Doing Removes early is good to have them out of the way, so they
don't break 'Inst' or 'Conf' chains, but scoring them above Essentials
means that we end up upgrading (many) less important packages before
we handle big stuff like libc6 or debconf which not only fails if those
less important packages have unannounced (strict) dependencies, but also
leads to having these packages unconfigured for a long time triggering
bugs in maintainer scripts for no good reason (#708831).

So this commits sets the default value for remove scores to 100, which
is below the one for essentials (200) and a lot lower than the previous
default value (500).
fix priority sorting by prefering higher in MarkInstall

Used to work until a certain (here unnamed) person came along and used
the wrong operator causing low-priority packages to be sorted above
high-priority packages while choosing a provider in commit
 2b5c35c7bb915dbd46fefd7c79f05364ba22f93b from Nov 2011
try all providers in order if uninstallable in MarkInstall
do unpacks before configures in SmartConfigure

Splits the big loop over dependencies in SmartConfigure which unpacks and
configures dependencies into two loops and reverse their order, so that all
dependencies which need to be unpacked are handled first and only after that
configures are issued for dependencies.

This is needed as otherwise the unpack of a (new) dependency will be issued
in between a configure call for two (or more) packages which form a loop,
which means the configure calls aren't part of the same dpkg call and
therefore dpkg bails out.

Such tight loops should really be avoided as they are usually wrong – and in
reality the dependencies in libreoffice were greatly simplified thanks to
Rene Engelhard so the problem is gone for the benefit of all.

Closes: 707578
deprecate InstallProtect as a cpu-eating no-op

In the past packages were flagged "Protected" so that install/
remove markings where issued before the ProblemResolver.
Nowadays, the marking methods check if they are allowed to modify
the marking of a package instead, so that markings set by FromUser
calls are not overwritten anymore by automatic calls which elimates
the need for InstallProtect which just eats CPU now.

The method itself is left untouched for now in case frontend needs it
still for some wierd usecase, but they should be eliminated.
initialize the whole search array with zero

Git-Dch: Ignore
fix support for multiple patterns in apt-cache search

Patterns can appear in the name as well as in the description,
they don't have to match all in the name/description only.

Closes: 691453
make the vprintf like _error->Insert public

Git-Dch: Ignore
set Fail flag in FileFd on all errors consistently

Previously some errors would set the Fail flag while some didn't
without a clear reason as all errors leave a bad FileFd behind,
so we use a helper now to ensure that all errors set the flag.