From f6198e45b4cd924f390f977077d96b4545da0c91 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 19 Dec 2024 17:49:59 +0100 Subject: Be more strict about which PAGER to execvp() directly 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). --- test/integration/test-apt-cli-pager | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/integration/test-apt-cli-pager') diff --git a/test/integration/test-apt-cli-pager b/test/integration/test-apt-cli-pager index 6d0f88f54..d1f8c3288 100755 --- a/test/integration/test-apt-cli-pager +++ b/test/integration/test-apt-cli-pager @@ -17,6 +17,13 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) +cat >> head3 << EOF +#!/bin/sh +exec head -3 +EOF + +chmod +x head3 + for show in info show; do msgmsg "$show supports pager" PAGER=cat testsuccessequal "Package: multi @@ -36,6 +43,10 @@ PAGER="head -3" testsuccessequal "Package: multi Version: 2.0 Priority: optional" runapt --unbuffer apt $show multi -o TestPager="head -3" +PAGER="cat|./head3" testsuccessequal "Package: multi +Version: 2.0 +Priority: optional" runapt --unbuffer apt $show multi -o TestPager="head -3" + # Test that we are not blocking PAGER=more testsuccessequal "Package: multi Version: 2.0 -- cgit v1.2.3-70-g09d2