summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream/Revert-lib-pager-Apply-pager-specific-fixes-only-when-nee.patch
blob: 6bd724475c7caa3da1879367d02ceb45fc3310d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Sat, 13 Apr 2024 09:42:39 +0200
Subject: Revert "lib/pager: Apply pager-specific fixes only when needed"
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Less is not always detectable, as it can be hidden behind symlinks or
wrapper as for example in a default Debian installation.
Also testing for the literal string "less" does not match full path
specifications like "/usr/bin/less".

Instead always apply the fixes.

This reverts commit c10ad975895372122f72c8d9da089b6ea69f778b.
Closes #2951
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Debian-Bug: 1068831
---
 lib/pager.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/lib/pager.c b/lib/pager.c
index 5f62a78..47f1233 100644
--- a/lib/pager.c
+++ b/lib/pager.c
@@ -85,9 +85,7 @@ static int start_command(struct child_process *cmd)
 			close(cmd->in);
 		}
 
-		if (cmd->preexec_cb)
-			cmd->preexec_cb();
-
+		cmd->preexec_cb();
 		execvp(cmd->argv[0], (char *const*) cmd->argv);
 		errexec(cmd->argv[0]);
 	}
@@ -142,7 +140,7 @@ static int finish_command(struct child_process *cmd)
 	return wait_or_whine(cmd->pid);
 }
 
-static void pager_preexec_less(void)
+static void pager_preexec(void)
 {
 	/*
 	 * Work around bug in "less" by not starting it until we
@@ -242,11 +240,7 @@ static void __setup_pager(void)
 	pager_argv[2] = pager;
 	pager_process.argv = pager_argv;
 	pager_process.in = -1;
-
-	if (!strncmp(pager, "less", 4))
-		pager_process.preexec_cb = pager_preexec_less;
-	else
-		pager_process.preexec_cb = NULL;
+	pager_process.preexec_cb = pager_preexec;
 
 	if (start_command(&pager_process))
 		return;