Linux NFS development
 help / color / mirror / Atom feed
From: Martin Doucha <mdoucha@suse.cz>
To: Petr Vorel <pvorel@suse.cz>, ltp@lists.linux.it
Cc: linux-nfs@vger.kernel.org, Cyril Hrubis <chrubis@suse.cz>
Subject: Re: [PATCH 1/1] generate_lvm_runfile.sh: Fix bashism
Date: Thu, 4 Aug 2022 17:33:24 +0200	[thread overview]
Message-ID: <2fd92c3d-a67e-3cfc-aaf8-ca35176cf399@suse.cz> (raw)
In-Reply-To: <20220803175752.19015-1-pvorel@suse.cz>

Hi,
`trap ... EXIT` cannot be used to emulate `trap ... ERR`. The latter
behaves as if every command/pipeline in the script (except conditions)
were wrapped in ROD. So `trap ... ERR` will trigger exit on any failure,
while `trap ... EXIT` will let the script continue after all errors and
then check exit code of only the very last command. That's not what we
want here.

On 03. 08. 22 19:57, Petr Vorel wrote:
> ERR is not on dash (tested on 0.5.11).
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/misc/lvm/generate_lvm_runfile.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/testcases/misc/lvm/generate_lvm_runfile.sh b/testcases/misc/lvm/generate_lvm_runfile.sh
> index 72b286a69..5bf5d91d6 100755
> --- a/testcases/misc/lvm/generate_lvm_runfile.sh
> +++ b/testcases/misc/lvm/generate_lvm_runfile.sh
> @@ -13,7 +13,7 @@ LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
>  
>  generate_runfile()
>  {
> -	trap 'tst_brk TBROK "Cannot create LVM runfile"' ERR
> +	trap '[ $? -eq 0 ] && exit 0 || tst_brk TBROK "Cannot create LVM runfile"' EXIT
>  	INFILE="$LTPROOT/testcases/data/lvm/runfile.tpl"
>  	OUTFILE="$LTPROOT/runtest/lvm.local"
>  	FS_LIST=`tst_supported_fs`


-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

  reply	other threads:[~2022-08-04 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03 17:57 [PATCH 1/1] generate_lvm_runfile.sh: Fix bashism Petr Vorel
2022-08-04 15:33 ` Martin Doucha [this message]
2022-08-04 20:24   ` Petr Vorel

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=2fd92c3d-a67e-3cfc-aaf8-ca35176cf399@suse.cz \
    --to=mdoucha@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=linux-nfs@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox