All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH] tests/util/grub-shell-luks-tester: Fix detached header test getting wrong header path
Date: Sat,  8 Jun 2024 23:22:05 -0500	[thread overview]
Message-ID: <20240609042205.176188-1-development@efficientek.com> (raw)

When $detached_header was set 1, $luksdiskfile was set to the luks header
file path with "${detached_header:-$luksfile}" appended, which evaluates
to "1". Fix this by using two statements to set $luksdiskfile. The first
sets it to the header file if $detached_header is set, otherwise leave it
unset. The second statement sets it to itself if it is already set,
otherwise it is set to $luksfile.

Fixes: a7b540e6e (tests: Add cryptomount functional test)
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/util/grub-shell-luks-tester.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/util/grub-shell-luks-tester.in b/tests/util/grub-shell-luks-tester.in
index 8926cbc96efa..b2a8a91b41f2 100644
--- a/tests/util/grub-shell-luks-tester.in
+++ b/tests/util/grub-shell-luks-tester.in
@@ -162,6 +162,8 @@ get_random_bytes() {
 lukstestdir="`mktemp -d "${TMPDIR:-/tmp}/$(basename "$0").XXXXXXXXXX"`" || exit 20
 luksfile=$lukstestdir/luks.disk
 lukshdrfile=$lukstestdir/luks.header
+luksdiskfile=${detached_header:+$lukshdrfile}
+luksdiskfile=${luksdiskfile:-$luksfile}
 lukskeyfile=$lukstestdir/luks.key
 vfile=$lukstestdir/mnt/test.verify
 vtext="TEST VERIFIED"
@@ -193,7 +195,7 @@ truncate -s $disksize $luksfile || exit 21
 cryptsetup luksFormat -q $csopts $luksfile $lukskeyfile || exit 22
 
 # Run any cryptsetup scripts
-export luksdiskfile=${detached_header:+$lukshdrfile}${detached_header:-$luksfile}
+export luksdiskfile
 export lukskeyfile
 for csscript in $csscripts; do
     [ -f "$csscript" ] && . $csscript
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

             reply	other threads:[~2024-06-09  4:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-09  4:22 Glenn Washburn [this message]
2024-06-12 16:34 ` [PATCH] tests/util/grub-shell-luks-tester: Fix detached header test getting wrong header path Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240609042205.176188-1-development@efficientek.com \
    --to=development@efficientek.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.