[packages/poldek] fix `ls -ut` breaking global order; rel 14
atler
atler at pld-linux.org
Tue Aug 30 16:51:16 CEST 2022
commit c447c41de6ffaf0e269a689e655a15e36058422d
Author: Jan Palus <atler at pld-linux.org>
Date: Tue Aug 30 16:49:14 2022 +0200
fix `ls -ut` breaking global order; rel 14
poldek.spec | 4 +++-
sorted-ls-upgradable.patch | 53 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 1 deletion(-)
---
diff --git a/poldek.spec b/poldek.spec
index 706ec64..2b661fc 100644
--- a/poldek.spec
+++ b/poldek.spec
@@ -22,7 +22,7 @@
%define ver_rpm 1:4.14
%endif
-%define rel 13
+%define rel 14
Summary: RPM packages management helper tool
Summary(hu.UTF-8): RPM csomagkezelést segítő eszköz
Summary(pl.UTF-8): Pomocnicze narzędzie do zarządzania pakietami RPM
@@ -69,6 +69,7 @@ Patch17: %{name}-rsa_sig_rpmorg.patch
Patch18: no-bdb-for-rpm-org.patch
Patch19: more-trace.patch
Patch20: boolean-deps.patch
+Patch21: sorted-ls-upgradable.patch
URL: http://poldek.pld-linux.org/
%{?with_rpm5:BuildRequires: %{db_pkg}-devel >= %{ver_db}}
BuildRequires: autoconf >= 2.63
@@ -264,6 +265,7 @@ cd ..
%patch18 -p1
%patch19 -p1
%patch20 -p1
+%patch21 -p1
%{__rm} doc/poldek.info
%{__rm} m4/libtool.m4 m4/lt*.m4
diff --git a/sorted-ls-upgradable.patch b/sorted-ls-upgradable.patch
new file mode 100644
index 0000000..b97253f
--- /dev/null
+++ b/sorted-ls-upgradable.patch
@@ -0,0 +1,53 @@
+From b7c0f1246788d1716c519387d75d7920ef59865a Mon Sep 17 00:00:00 2001
+From: Jan Palus <jpalus at fastmail.com>
+Date: Tue, 30 Aug 2022 16:32:24 +0200
+Subject: [PATCH] cli/ls: sort entries just before listing (after filtering)
+
+fixes global entries order being broken after doing `ls -ut`.
+"upgradable" listing overrides `ls_ents` and hence sort order
+restoration operates on wrong array. observed broken beavior:
+
+- invoking:
+ (1) ls -u
+ (2) ls -ut
+ (3) ls -u
+
+ should result in (1) and (3) being the same while in fact (2) and (3)
+ are the same
+
+- after invoking `ls -ut` package name completion is broken since it
+ uses binary search and therefore relies on correct order
+
+also doing `ls -u` might get marginally faster since it no longer needs
+to sort all available packages, but only those which are upgradable.
+---
+ cli/ls.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/cli/ls.c b/cli/ls.c
+index 1808f43..5a94374 100644
+--- a/cli/ls.c
++++ b/cli/ls.c
+@@ -368,9 +368,6 @@ static int ls(struct cmdctx *cmdctx)
+ goto l_end;
+ }
+
+- if ((cmpf = select_cmpf(cmdctx->_flags)))
+- n_array_sort_ex(ls_ents, cmpf);
+-
+ if (cmdctx->_flags & OPT_LS_UPGRADEABLE) {
+ tn_array *tmp;
+
+@@ -386,6 +383,9 @@ static int ls(struct cmdctx *cmdctx)
+ }
+
+ if (n_array_size(ls_ents)) {
++ if ((cmpf = select_cmpf(cmdctx->_flags)))
++ n_array_sort_ex(ls_ents, cmpf);
++
+ rc = do_ls(ls_ents, cmdctx, evrs);
+
+ if (cmpf)
+--
+2.37.2
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/poldek.git/commitdiff/c447c41de6ffaf0e269a689e655a15e36058422d
More information about the pld-cvs-commit
mailing list