From: Thomas Schmitt via Grub-devel <grub-devel@gnu.org>
To: grub-devel@gnu.org
Cc: Thomas Schmitt <scdbackup@gmx.net>,
development@efficientek.com, daniel.kiper@oracle.com,
phcoder@gmail.com
Subject: Re: [PATCH 1/4] tests/util/grub-shell-luks-tester: Add missing line to create RET variable in cleanup
Date: Mon, 23 Sep 2024 18:36:04 +0200 [thread overview]
Message-ID: <1515930754093681440@scdbackup.webframe.org> (raw)
In-Reply-To: <0bb35ed0f4793759cffe903955cb59381358ee42.1727070469.git.development@efficientek.com>
Hi,
(adding Vladimir Serbinenko to Cc)
Glenn Washburn wrote:
> --- a/tests/util/grub-shell-luks-tester.in
> +++ b/tests/util/grub-shell-luks-tester.in
> @@ -143,6 +143,7 @@ fi
>
> # Make sure that the dm-crypto device is shutdown
> cleanup() {
> + RET=$?
> if [ -e "$luksdev" ]; then
> cryptsetup close "$luksdev"
> fi
The change itself looks good to me.
But i think that there is
set -e
missing in
tests/util/grub-shell-luks-tester.in
and possibly in
tests/grub_cmd_cryptomount.in
At least inserted commands:
echo "grub_cmd_cryptomount.in: $(set -o | grep errexit)"
echo "grub-shell-luks-tester.in: $(set -o | grep errexit)" >>/tmp/grub-shell-luks-tester.errexit.log
say in grub_cmd_cryptomount.log and grub-shell-luks-tester.errexit.log:
grub_cmd_cryptomount: errexit off
grub-shell-luks-tester.in: errexit off
The neighbors of grub-shell-luks-tester.in have such a "set -e":
tests/util/grub-fs-tester.in
tests/util/grub-shell-tester.in
tests/util/grub-shell.in
Many tests/*.in have it too. So i propose to add it to
tests/grub_cmd_cryptomount.in
as well.
I came to this while trying whether it is it guaranteed that "$?" is
always meaningful, given the fact that cleanup() can be called from
various places in the script by
trap cleanup EXIT INT TERM KILL QUIT
My experiment was to press Ctrl+C while this shell code was sleeping
cleanup() {
RET=$?
echo "RET=$RET"
}
trap cleanup EXIT INT TERM KILL QUIT
sleep 10
ls /notexisting
I got two output lines:
RET=130
RET=2
So without "set -e" cleanup() can be called more than once.
I think that grub-shell-luks-tester.in does not expects this.
Have a nice day :)
Thomas
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2024-09-23 16:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 5:53 [PATCH 0/4] Various test fixes proposed by Thomas Schmitt Glenn Washburn
2024-09-23 5:53 ` [PATCH 1/4] tests/util/grub-shell-luks-tester: Add missing line to create RET variable in cleanup Glenn Washburn
2024-09-23 16:36 ` Thomas Schmitt via Grub-devel [this message]
2024-09-24 7:21 ` Thomas Schmitt via Grub-devel
2024-09-23 5:53 ` [PATCH 2/4] tests: Cleaup the cryptsetup script in grub_cmd_cryptomount unless debug is enabled Glenn Washburn
2024-09-23 5:53 ` [PATCH 3/4] tests: Default TMPDIR to /tmp in grub_cmd_cryptomount tests Glenn Washburn
2024-09-23 5:53 ` [PATCH 4/4] tests/util/grub-shell: Remove the work directory on successful run and debug is not on Glenn Washburn
2024-09-23 15:52 ` [PATCH 0/4] Various test fixes proposed by Thomas Schmitt Thomas Schmitt via Grub-devel
2024-09-26 19:19 ` Glenn Washburn
2024-09-26 20:44 ` Thomas Schmitt via Grub-devel
2024-09-26 22:21 ` Glenn Washburn
2024-09-27 11:59 ` Thomas Schmitt via Grub-devel
2024-10-01 3:49 ` Glenn Washburn
2024-10-02 7:08 ` Thomas Schmitt via Grub-devel
2024-10-05 20:11 ` Glenn Washburn
2024-10-06 6:48 ` Thomas Schmitt via Grub-devel
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=1515930754093681440@scdbackup.webframe.org \
--to=grub-devel@gnu.org \
--cc=daniel.kiper@oracle.com \
--cc=development@efficientek.com \
--cc=phcoder@gmail.com \
--cc=scdbackup@gmx.net \
/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.