| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
References:
- https://www.reddit.com/r/cpp_questions/comments/pm63yx/why_clangtidy_says_use_emplace_back_instead_of/
- https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-emplace.html
|
| |
|
|
|
|
|
|
| |
Benchmark:
- https://stackoverflow.com/questions/62058906/why-my-performance-benchmark-gives-me-wrong-results
References:
- https://clang.llvm.org/extra/clang-tidy/checks/performance/prefer-single-char-overloads.html
|
| |
|
|
|
|
|
|
| |
A specific CLI version can now be requested using the --cli-version
flag, and old versions can be deprecated on a reasonable cadence.
Therefore, a warning is no longer necessary.
Gbp-Dch: full
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test like this:
sudo mount -t tmpfs -o size=0 tmpfs rootfs
cat << 'END' > run.sh
set -exu
export LD_LIBRARY_PATH=/home/josch/git/apt/build/apt-pkg
mkdir -p "$1/etc/apt" "$1/var/cache" "$1/var/lib/dpkg/"
echo "Dir \"$(cd "$1" && pwd)\";" > "$1/apt.conf"
echo "deb [signed-by=/usr/share/keyrings/debian-archive-keyring.pgp] http://deb.debian.org/debian/ unstable main" > "$1/etc/apt/sources.list"
APT_CONFIG="$1/apt.conf" build/cmdline/apt-get update
APT_CONFIG="$1/apt.conf" build/cmdline/apt-get --yes --download-only install '?essential'
END
./run.sh rootfs
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was missed in 4b22a1e36 (apt-team/apt!522), and caused the
following error when built with GCC 12:
/var/tmp/apt-20251026-9687-pc954n/apt-3.1.10/apt-private/private-cmndline.cc:544:23: error: ‘optional’ is not a member of ‘std’
544 | static std::pair<std::optional<long unsigned int>, std::optional<long unsigned int>> parseCliVersion(std::string_view version)
| ^~~~~~~~
/var/tmp/apt-20251026-9687-pc954n/apt-3.1.10/apt-private/private-cmndline.cc:27:8: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
26 | #include <apti18n.h>
+++ |+#include <optional>
27 | /*}}}*/
While at it, also add missing <utility> include for std::pair.
Discovered in https://github.com/Homebrew/homebrew-core/pull/251162 by
Anton Melnikov.
Co-authored-by: Anton Melnikov <antonsm21@gmail.com>
Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
|
| |
|
|
|
| |
Enable the new solver by default and remove the vendor-specific
configuration change in Ubuntu's drop-in.
|
| |
|
|
|
|
| |
The --cli-version argument can be used to request a specific
CLI version. The default CLI version is the APT version for apt(8)
and 0 for the other apt-get tools.
|
| |
|
|
|
|
|
|
| |
This allows:
apt build-dep --mark-auto apt
Closes: #973260
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
For some reason I have them in my log file.
|
| | |
|
| |
|
|
|
|
| |
If there is an error writing to cout, cerr, or clog, APT should return a
non-zero exit code. This allows automated tools to reliably check for
warnings.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We inadvertently considered more upgrades as a better solution in
all cases, but if we are *installing* rather than upgrading, we
should count upgrades as a negative.
Change the code to accomodate that. This requires a few more
tricks:
- We remove the keep count check. This does not appear to work
correctly and would have prevented the fix. We are already
counting all possible changes, so why bother.
- We need to subtract the upgrade count from the install count
(upgrades are a class of installs) since we now allow comparing
solutions with different upgrade counts for install counts.
- After comparing the "new install count", we now compare upgrade
count too, in the opposite direction of upgrading.
To test, we abuse that solver 3.0 does not upgrade all packages
in a source package when using the install command.
LP: #2105395
|
| |
|
|
|
|
| |
The error messages are multi-line now, so need correct escaping.
LP: #2104276
|
| |
|
|
|
|
| |
Use setenv() to avoid overriding user defined variables.
LP: #2103921
|
| |
|
|
| |
whoopsie does not accept empty values
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Store the solver dumps with zstd compression and base64-encode
them in the crash report; such that they take up significantly
less space and can fit in cassandra's schema.
Base64 is wrapped at 76 characters as the base64 tool does. Do
some magic std::string_view conversion to avoid string copies
for the substr() used to get 76 characters at a time.
Note we can rely on substr(i, 76) to handle less than 76 characters
just fine; it uses std::min(76, size() - i) characters.
|
| |
|
|
| |
These are faster to generate and significantly smaller.
|
| |
|
|
|
|
|
|
|
|
| |
This can provide useful additional context.
To avoid updating the whole test suite for it, introduce a new
option `quiet::NoSolver3Explanation` and set it by default. All
the other tests that assert output will already have matching
tests for --solver 3.0 with the correct messages asserted, it
makes no sense to duplicate them.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Always run the 3.0 solver after the internal solver. If the internal
solver failed, and the 3.0 solver did not, use the 3.0 result.
If 3.0 solver failed or produced a worse result than the internal
solver, write an apport crash dump.
We exclude situations which we now the solver can't handle, i.e.
removals are forbidden and you requested removals, and stuff like
that.
|
| |
|
|
| |
string{=> _view})
|
| | |
|
| |
|
|
|
|
|
| |
/dev/stdout may not exist, so let's instead just reference
the std::cout stream.
Reported-by: h01ger on IRC
|
| |
|
|
| |
I don't know why I used a double here this is awkward.
|
| |
|
|
| |
That just needs using '-' to replace spaces in Origin to get the keyring file name.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This handles rewriting .list entries to .sources ones; the
only options handled are
- signed-by => Signed-By
- trusted => Trusted
The options to specify architectures, check-valid-until, etc.
are not supported as they are not exposed in the code. We
probably should refactor the parser at some point so we can
actually read the parsed entry rather than the abstract objects
we create from it.
This can be improved further:
- Keyrings from /etc/apt/trusted.gpg.d should be moved to
/etc/apt/keyrings.
- automatic detection by trying to verify using each keyring
in trusted.gpg.d until we find the right one and then using
that for Signed-By rather than leave some sources empty.
|
| | |
|
| |
|
|
|
|
| |
Warn about the missing field there and suggest the transition
to deb822 .sources files if we found any non-deb822 source
without signed-by.
|
| |
|
|
|
|
|
|
|
| |
They were implemented to help a tiny bit in notifying users even if they
didn't read the Release notes (or didn't realize it would apply to them)
that they likely have to change their sources.list entries, but that
transition is now over for a while, so everyone who should have seen it
has hopefully reacted to it and so all this code now does is waste
space, time and idly waiting for false positives.
|
| |
|
|
|
| |
nodiscard is a C++17 feature and already used (not just due to my recent
changes) in our codebase, so lets drop the last remaining holdouts.
|
| |
|
|
|
|
|
|
|
| |
We were rather inconsistent in using it and as our public headers
contain deduction guides (a c++17 feature) it seems silly to try to hide
a c++11 feature in a macro, so lets stop this charade and drop the
macro and while we are changing all these lines lets apply [[nodiscard]]
(another c++17 feature) and other suggestions from clang-tidy and
formatting for a little more consistency.
|
| |
|
|
|
| |
Add new fields `APT-Pin`, `APT-Candidate`, and `APT-Release` to the
output, same as in EDSP (limited to one release for now).
|
| |
|
|
|
|
|
|
|
|
|
| |
There could be | or ; or other stuff in PAGER that needs
special handling, let's encode a list of known-good characters
instead. This covers all known pagers.
You could also try to execvp() PAGER in its entirety and if
it fails with ENOENT fall back to the shell but then you
don't get correct error handling if the pager really doesn't
exist (in which case we should abort trying to page).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Automatically show the output of `show`, `policy`, `list`,
`search`, `showsrc` in a pager.
The pager setup is inspired by git's pager setup. Notably,
the pager is found using APT_PAGER and PAGER variables.
We wait for the pager to be setup somewhat correctly by
using a notify pipe to figure out whether execvp() was
succesful - then the pipe will read EOF as the other end
got closed by CLOEXEC during exec - or not, then the pipe
will contain an errno.
We set up the correct handlers for signals and exit to close
the fds and wait for the pager. Notably inside the signal
handler we cannot flush our streams, only close them, so
there is some duplication.
We call the InitOutputPager() function from inside the
various Do...() functions rather than setting it up
generally in InitOutput(). Doing so allows us to first
render the progress without a pager, and then setup
the pager for the content only which improves user
experience.
When we setup a pager we also take care to disable
standard input, as we should not be prompting users
while a pager is running (the pager will be reading
from the tty directly). We do this by dup2-ing() a
/dev/null over it; if we just close()d the fd, another
open() might reuse the fd number and problems could
occur.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of deciding if the first or the last error in a retry chain is
the best one to display if the entire chain fails in the end we teach
our progress reporting to collect the ignored errors (if it hasn't shown
them) and print them all together in the Err line.
We de-duplicate the collection which makes it harder to match the Ign
line with the error messages, but for these cases its probably better to
enable direct display of the text anyhow – and repeating the same message
multiple times is boring and probably not that helpful for a user
wanting to know why all the downloads failed even they asked apt to
retry 429 times…
References: 841243df877b39dfcb907a7fab9c4e8b4f65d715
|
| |
|
|
|
| |
This silences the warning:
| warning: ‘class Matcher’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
gcc produces a length warning starting with:
| warning: ignoring return value of ‘_FIter std::remove_if(_FIter, _FIter, _Predicate) [with …]’, declared with attribute ‘nodiscard’ [-Wunused-result]
which is usually correct, but in the usage here we don't want to call an
erase as we operate on a c-style new[] array here which contains pointers
into argv and has an explicit sentinel (nullptr) – FileSize() is based
on this sentinel.
Casting to void silences the warning as is standard practice and
hopefully indicates better that this is intended than ignoring the
warning for the casual on-looker.
|
| |
|
|
| |
Suggested-by: mhoye on IRC
|
| |\
| |
| |
| |
| | |
Internally replace APT::StringView with std::string_view where it doesn't affect the ABI, with implementations that support both std::string_view and APT::StringView with new shims. ReportMirrorFailureToCentral: fix use-after-free
See merge request apt-team/apt!394
|
| | | |
|
| |\ \
| |/
|/|
| |
| | |
JSON: Pass options to hooks in hello message
See merge request apt-team/apt!389
|