public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>, fstests@vger.kernel.org
Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,
	ojaswin@linux.ibm.com, djwong@kernel.org, zlang@kernel.org,
	david@fromorbit.com, hch@infradead.org
Subject: Re: [PATCH v3 2/2] check: Replace exit with _fatal and _exit in check
Date: Fri, 2 May 2025 11:40:40 +0530	[thread overview]
Message-ID: <dd3c9f54-8b68-4025-a368-91fe014e8eaf@gmail.com> (raw)
In-Reply-To: <87bjsdqa5x.fsf@gmail.com>


On 5/1/25 09:01, Ritesh Harjani (IBM) wrote:
> "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com> writes:
>
>> Some of the "status=<val>;exit" and "exit <val>" were not
>> replaced with _exit <val> and _fatal. Doing it now.
>>
> Indeed a nice cleanup. The changes in this patch looks good to me.
>
> Please feel free to add:
> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Thank you.
>
>
> So I guess these couple of series was to cleanup exit routines from
> common bash scripts. Do we plan to update the tests/ as well where
> we call...
>      status=X
>      exit
>
> ...or updating tests/ is not needed since we didn't find any wrong usage of
> "exit X" routines there?

Thank you for pointing this out. The exit command is used in 2 ways in 
the tests:

1. "exit 1"

2. "status=0; exit"

1) works because we set the value of "status" to 1 (failure by default) 
in _begin_fstest() - so even if "exit 1" is not correctly explicitly 
setting the value of "status", it simply works. However, "exit <any 
value != 1>" will not work (although I didn't find any place in tests 
where exit has been used with any other value apart from 0 and 1).

2) This works since we are setting the value of "status" correcting 
before "exit"ing.

But yes, we should ideally replace direct usage of exit with either 
_exit or _fatal (depending on the exit value). I will add this to my 
ToDo list and send a separate patch series with this and the README 
change you have suggested below.

>
>
> Either ways - I think we might need to update the README at some point
> in time which carries this snip. You might need to add that there are
> helper routines like  _exit() and _fatal() perhaps for use in common
> scripts.
>
> <snip>
>      To force a non-zero exit status use:
> 	status=1
> 	exit
>
>      Note that:
> 	exit 1
>      won't have the desired effect because of the way the exit trap
>      works.

I agree. I will send a separate patch with this and the exit call 
replacement of the tests.

--NR

>
>
> -ritesh

-- 
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore


  reply	other threads:[~2025-05-02  6:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 12:45 [PATCH v3 0/2] common: Move exit related functions to common/exit Nirjhar Roy (IBM)
2025-04-30 12:45 ` [PATCH v3 1/2] common: Move exit related functions to a common/exit Nirjhar Roy (IBM)
2025-05-01  3:17   ` Ritesh Harjani
2025-05-01  9:10     ` Zorro Lang
2025-05-02  4:23       ` Ritesh Harjani
2025-05-03  3:06         ` Ritesh Harjani
2025-04-30 12:45 ` [PATCH v3 2/2] check: Replace exit with _fatal and _exit in check Nirjhar Roy (IBM)
2025-05-01  3:31   ` Ritesh Harjani
2025-05-02  6:10     ` Nirjhar Roy (IBM) [this message]
2025-05-06  8:49 ` [PATCH v3 0/2] common: Move exit related functions to common/exit Nirjhar Roy (IBM)
2025-05-06 15:03   ` Zorro Lang

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=dd3c9f54-8b68-4025-a368-91fe014e8eaf@gmail.com \
    --to=nirjhar.roy.lists@gmail.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=zlang@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox