public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/581: remove extra escape character from awk line
@ 2023-11-22 17:03 Luis Henriques
  2023-11-22 23:16 ` Eric Biggers
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Henriques @ 2023-11-22 17:03 UTC (permalink / raw)
  To: fstests

Checking the keys in /proc/key-users is buggy, as there's an extra '\'
character: in '{print \$4}' the '$4' shouldn't be escaped otherwise the
'awk' command will fail.  This has passed unnoticed because the output
is sent to '_user_do' function and the result assigned to a variable.

While there, replace 'awk' by $AWK_PROG.

Signed-off-by: Luis Henriques <lhenriques@suse.de>
---
 tests/generic/581 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi!

Please note that I'm not an 'awk' expert and I may be wrong!  But if I do
see an error if I run something like:

$ awk '/^[[:space:]]*1000:/{print \$4}' /proc/key-users 
awk: cmd. line:1: /^[[:space:]]*1000:/{print \$4}
awk: cmd. line:1:                            ^ backslash not last character on line

But maybe this depends on the awk implementation, although I've tried a few.

diff --git a/tests/generic/581 b/tests/generic/581
index cabc7e1c69ab..1a4b571d40ce 100755
--- a/tests/generic/581
+++ b/tests/generic/581
@@ -92,7 +92,7 @@ while grep -E -q '^[0-9a-f]+ [^ ]*i[^ ]*' /proc/keys; do
 done
 
 # Set the user key quota to the fsgqa user's current number of keys plus 5.
-orig_keys=$(_user_do "awk '/^[[:space:]]*$(id -u fsgqa):/{print \$4}' /proc/key-users | cut -d/ -f1")
+orig_keys=$(_user_do "$AWK_PROG '/^[[:space:]]*$(id -u fsgqa):/{print $4}' /proc/key-users | cut -d/ -f1")
 : ${orig_keys:=0}
 echo "orig_keys=$orig_keys" >> $seqres.full
 orig_maxkeys=$(</proc/sys/kernel/keys/maxkeys)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-05 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 17:03 [PATCH] generic/581: remove extra escape character from awk line Luis Henriques
2023-11-22 23:16 ` Eric Biggers
2023-11-23 11:46   ` Luís Henriques
2023-11-28 14:16     ` Luis Henriques
2023-11-28 17:37       ` Eric Biggers
2023-11-28 18:25         ` Luis Henriques
2023-12-05 17:28           ` Luis Henriques

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox