aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-security/keyutils/files/0002-tests-Use-head-n1-for-busybox-compatibility.patch
blob: 900f2f0ec917a6784bcce3b29e23a38565f78974 (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
60
61
62
63
64
From 5e660f246bb04560692ac9fc144574732c7e19e7 Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alex.kiernan@gmail.com>
Date: Thu, 26 Jan 2023 08:28:16 +0000
Subject: [PATCH 2/2] tests: Use `head -n1` for busybox compatibility

Upstream-Status: Pending
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
 tests/keyctl/session/valid/runtest.sh | 4 ++--
 tests/keyctl/show/noargs/runtest.sh   | 2 +-
 tests/toolbox.inc.sh                  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/keyctl/session/valid/runtest.sh b/tests/keyctl/session/valid/runtest.sh
index 4c831314c0b0..456e9f32de23 100644
--- a/tests/keyctl/session/valid/runtest.sh
+++ b/tests/keyctl/session/valid/runtest.sh
@@ -17,7 +17,7 @@ then
     expect_key_rdesc rdesc "keyring@.*@.*@.*@_ses[^@]*\$"
 
     # check the session keyring ID is shown
-    seskeyring="`tail -2 $OUTPUTFILE | head -1`"
+    seskeyring="`tail -2 $OUTPUTFILE | head -n1`"
     if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null
     then
 	failed
@@ -30,7 +30,7 @@ new_session qwerty keyctl rdescribe @s "@"
 expect_key_rdesc rdesc "keyring@.*@.*@.*@qwerty"
 
 # check the session keyring ID is shown
-seskeyring="`tail -2 $OUTPUTFILE | head -1`"
+seskeyring="`tail -2 $OUTPUTFILE | head -n1`"
 if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null
 then
     failed
diff --git a/tests/keyctl/show/noargs/runtest.sh b/tests/keyctl/show/noargs/runtest.sh
index d5072716c76a..a6d8b6b585c4 100644
--- a/tests/keyctl/show/noargs/runtest.sh
+++ b/tests/keyctl/show/noargs/runtest.sh
@@ -31,7 +31,7 @@ then
 fi
 
 # the first key listed (line 2) should be a keying (the session keyring) ...
-keyring1="`grep -n keyring $OUTPUTFILE | cut -d: -f1 | head -1`"
+keyring1="`grep -n keyring $OUTPUTFILE | cut -d: -f1 | head -n1`"
 if [ "$keyring1" != "4" ]
 then
     failed
diff --git a/tests/toolbox.inc.sh b/tests/toolbox.inc.sh
index 7ea2f253ba7d..a461a73daaa3 100644
--- a/tests/toolbox.inc.sh
+++ b/tests/toolbox.inc.sh
@@ -229,7 +229,7 @@ function check_notify ()
     if [ "$1" = "-2" ]
     then
 	shift
-	my_logline="`tail -2 $watch_log | head -1`"
+	my_logline="`tail -2 $watch_log | head -n1`"
     else
 	my_logline="`tail -1 $watch_log`"
     fi
-- 
2.39.0