From b8797dcd025c34ee9495c30ad86c193445b63df9 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Mon, 8 Jul 2019 23:28:50 +0200 Subject: [PATCH] =?UTF-8?q?listfiles:=20make=20it=20robust=20against=20all?= =?UTF-8?q?=20kinds=20of=20=E2=80=9Cinteresting=E2=80=9D=20input=20=20?= =?UTF-8?q?=E2=80=93=C2=A0restore=20protection=20against=20empty=20input?= =?UTF-8?q?=20=20=E2=80=93=C2=A0handle=20non-empty=20inputs,=20with=20whit?= =?UTF-8?q?espace,=20quotes,=20linebreaks,=20etc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- macros.fedora-misc | 4 ++-- redhat-rpm-config.spec | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index a73b7c5..83e455a 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -12,9 +12,9 @@ # Arguments passed to the macro without flags will be interpreted as inclusion # globs. %listfiles(i:x:) %{expand: -%if "%{?-i*}%{expand:?listfiles_include}%*" != "" +%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))} listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) - %if "%{?-x*}%{expand:?listfiles_exclude}" != "" + %if %{lua: print(string.len(rpm.expand("%{?-x*}%{?listfiles_exclude}")))} while IFS= read -r finc ; do realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\ | sort -u | grep -q "${finc}" || echo "${finc}" diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 13d4662..9acd12b 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -202,6 +202,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +- listfiles: make it robust against all kinds of “interesting” inputs - wordwrap: make list indenting smarter, to produce something with enough structure that it can be converted into AppStream metadata