[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd3c9f54-8b68-4025-a368-91fe014e8eaf@gmail.com>
Date: Fri, 2 May 2025 11:40:40 +0530
From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@...il.com>
To: "Ritesh Harjani (IBM)" <ritesh.list@...il.com>, fstests@...r.kernel.org
Cc: linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
ojaswin@...ux.ibm.com, djwong@...nel.org, zlang@...nel.org,
david@...morbit.com, hch@...radead.org
Subject: Re: [PATCH v3 2/2] check: Replace exit with _fatal and _exit in check
On 5/1/25 09:01, Ritesh Harjani (IBM) wrote:
> "Nirjhar Roy (IBM)" <nirjhar.roy.lists@...il.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@...il.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
Powered by blists - more mailing lists