Bug#950776: "Took 213503982334601d 7h 0min 15s" due to typo bug inftparchive/apt-ftparchive.cc
Package: apt-utils
Version: 1.8.2
Severity: minor
File: /usr/bin/apt-ftparchive
Tags: patch
I'm pretty sure this is a simple typo:
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 077701c..51d492c 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -973,7 +973,7 @@ static bool Generate(CommandLine &CmdL)
struct timeval NewTime = GetTimevalFromSteadyClock();
std::chrono::duration<double> Delta =
std::chrono::seconds(NewTime.tv_sec - StartTime.tv_sec) +
- std::chrono::microseconds(NewTime.tv_sec - StartTime.tv_usec);
+ std::chrono::microseconds(NewTime.tv_usec - StartTime.tv_usec);
c1out << "Done. " << SizeToStr(Stats.Bytes) << "B in " << Stats.Packages
<< " archives. Took " << TimeToStr(llround(Delta.count())) << endl;
Without that patch, "apt-ftparchive generate /dev/null" often returns a very large "Took Ad Bh Cmin Ds" instead of "Took 0s".
With this patch, I seem to get "Took 0s" consistently.
AFAICT this landed in
79b61ae 2018-05-26 17:36 +0200 DKa ∙ Use a steady clock source for progress reporting
and it still present in git master (1.9.9).
PS: I just noticed my patch only fixed ONE instance of this code, but it's copy-pasted into several places, so all of them need fixing.
-- System Information:
Debian Release: 10.2
APT prefers stable
APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 5.4.0-0.bpo.2-amd64 (SMP w/2 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages apt-utils depends on:
ii apt 1.8.2
ii libapt-inst2.0 1.8.2
ii libapt-pkg5.0 1.8.2
ii libc6 2.29-9
ii libdb5.3 5.3.28+dfsg1-0.5
ii libgcc1 1:8.3.0-6
ii libstdc++6 9.2.1-23
apt-utils recommends no packages.
apt-utils suggests no packages.
-- no debconf information
Reply to: