[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250408142747.tojq7dhv3ad2mzaq@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com>
Date: Tue, 8 Apr 2025 22:27:48 +0800
From: Zorro Lang <zlang@...hat.com>
To: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@...il.com>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@...il.com>, fstests@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
ojaswin@...ux.ibm.com, djwong@...nel.org, zlang@...nel.org,
david@...morbit.com
Subject: Re: [PATCH v2 5/5] common: exit --> _exit
On Tue, Apr 08, 2025 at 12:43:32AM +0530, Nirjhar Roy (IBM) wrote:
>
> On 4/8/25 00:16, Ritesh Harjani (IBM) wrote:
> > Zorro Lang <zlang@...hat.com> writes:
> >
> > > On Fri, Apr 04, 2025 at 10:34:47AM +0530, Ritesh Harjani wrote:
> > > > "Nirjhar Roy (IBM)" <nirjhar.roy.lists@...il.com> writes:
> > > >
> > > > > Replace exit <return-val> with _exit <return-val> which
> > > > > is introduced in the previous patch.
> > > > >
> > > > > Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@...il.com>
> > <...>
> > > > > ---
> > > > > @@ -225,7 +225,7 @@ _filter_bmap()
> > > > > die_now()
> > > > > {
> > > > > status=1
> > > > > - exit
> > > > > + _exit
> > > > Why not remove status=1 too and just do _exit 1 here too?
> > > > Like how we have done at other places?
> > > Yeah, nice catch! As the defination of _exit:
> > >
> > > _exit()
> > > {
> > > status="$1"
> > > exit "$status"
> > > }
> > >
> > > The
> > > "
> > > status=1
> > > exit
> > > "
> > > should be equal to:
> > > "
> > > _exit 1
> > > "
> > >
> > > And "_exit" looks not make sense, due to it gives null to status.
> > >
> > > Same problem likes below:
> > >
> > >
> > > @@ -3776,7 +3773,7 @@ _get_os_name()
> > > echo 'linux'
> > > else
> > > echo Unknown operating system: `uname`
> > > - exit
> > > + _exit
> > >
> > >
> > > The "_exit" without argument looks not make sense.
> > >
> > That's right. _exit called with no argument could make status as null.
> Yes, that is correct.
> > To prevent such misuse in future, should we add a warning/echo message
>
> Yeah, the other thing that we can do is 'status=${1:-0}'. In that case, for
^^^^^^^^^^^^^^
That's good to me, I'm just wondering if the default value should be "1", to
tell us "hey, there's an unknown exit status" :)
Thanks,
Zorro
> cases where the return value is a success, we simply use "_exit". Which one
> do you think adds more value and flexibility to the usage?
>
> --NR
>
> > if the no. of arguments passed to _exit() is not 1?
> >
> > -ritesh
>
> --
> Nirjhar Roy
> Linux Kernel Developer
> IBM, Bangalore
>
Powered by blists - more mailing lists