From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A60D289E2E for ; Tue, 29 Apr 2025 23:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745970686; cv=none; b=N78YsOj54z6Ki/7F7jz0k0Fq0WrnjkDY0iw+HrmyVrPP3olKqMHT5OHCSLY2NBRGYbCIi9i6VpsnuSd9Rik9KcRNK//bpFA+hSgZFNtYxOIvXkG0IPiy8UufV+GiDYMwYW2sifS2tTBStREnakPaIzUeGDw9klwqkIKzL4rzero= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745970686; c=relaxed/simple; bh=8neD6MWQfw+EyFFux2CEmOhjmwenh3NYJpAggAD9C10=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Cww1TP20IYnC3NVDH/BUfz7VHIXCEDig2BBy4+4yLpRGlS30rnQSA+a86MW8TLlfRumeaSL9AUSfmWAfAipqgfHn2bg6dTwXkh2N3BGJBsVxohZaOJcXDOU3QNgqFCbdgb9YjeCn3XXkQQGxeUsUao8Qrajhl1SXIoB92jhNiLg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com; spf=pass smtp.mailfrom=fromorbit.com; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b=jICrypSr; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b="jICrypSr" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-224019ad9edso99948295ad.1 for ; Tue, 29 Apr 2025 16:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1745970684; x=1746575484; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DQB7I1cCDGP31Ffgc304vw5DAP8c3CZYgZKW54rrDxM=; b=jICrypSrSlUI0uNGsY4hr6lYY5WvpZ2GGe7xE8zmy2GsspQpY9N4wSUN/ITzWXx2+N 5/1w4PYJY4Hy5gWu0bETa7nE1o6lwOIKoAr7CMFMb14kOnFMW4eBPo/ya11a9NrvPnnG h4pJpAtcIbsb2D1oiGiPDMmHZ6UTYWmHvlTKgtzsez1Tq1vVmFQwwkg8TlVNHm7XBANc 8zmLVffMra3OQbJwdHGkw+PHXOusK1RBJJISyc//7wBCqxI9GZR/CS2CvoqnMr4NBkKn IVY4D0c+X/pcMxSytZWpT5mJ1iH4qPbmDcPsU7mdqEFE/zvobFsK0RXnJVa6qLm9xJp4 bItQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745970684; x=1746575484; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DQB7I1cCDGP31Ffgc304vw5DAP8c3CZYgZKW54rrDxM=; b=GPDNLzZ9iSMbZGm3xZTeDblHdoA+XA6P+E/sg7cGWEhlEHFcnIY83z5U+KXXuT9Ti5 BikR2dTudIZ/CIJrqfmHVeJdBubprPmW044LEiTRFiJs8f6CJ+s0x658oN6j0iGKAzLP XxPWfi8mMNMPOyA/no6BTxd9ZjaN/h8bKnhhpyUssBgg3hbYb6H+6YfB9IZ8pgdWMuQQ sYF5VoYTviHIf7zJbrdUSGqny55r5Zd/+UmmAGJc+LjRxBOsaRgNCohS3RfcW8zU5+FC ZC529IrOovIOHmEU2Hr1V0fOrZBJC16QNb8vuJDK+ghBmSSLOQqq0qcrzqJ6ooqXA40O dF2g== X-Gm-Message-State: AOJu0YwhBgmWVq+EwZ9SDERVzMBWL85pWePjRmrbEXrQtYEA0m/VTMJH FkKNV2jfCeysbZeP2nSxdKgdidFi67E5b6KjsFD6yA4FcPNEjH+nVcrcZpH9jLKVdMcMOP8ROAb f X-Gm-Gg: ASbGncuMlNW7ddA7vJGVBC2xi9uKW9Y60qrtV7ItKZlEGaunU/h3IiMPJoxRcdI/dpE krA/vz/x/pUSG4DzAPF/BYeWk5EGajb6XHrK7LOHFAz56vsasstS8FHld1EvKuDkjMORZT1p2xr SkVfkJRQB+M0sN6ebZp4fMLYI70ihCKPCqm7bDBVxdimHp9XFZOM8kR69TQ2ezihLXH7kaEvtah vbmp4MG8kqwM/wSN1yilgsPl8EPy/BLZlYTYVYNiDQUnomV/TXmcY8EkGi2l3IWHOdePSVNtgiS NzJcvUoAyqs++CofgIP6LuqhM7CbXttrio79KtZtsXlf288C4vbbt9dOl/cZs4SZMJuUW5JLCtG q90o= X-Google-Smtp-Source: AGHT+IGnw8oR5NQn26f2EFS9oWO/RFCD5rSfC11L3dAtCqKaPeKK28nVDtSMdG8CZUfJ9vzhi5Hg2w== X-Received: by 2002:a17:903:1c4:b0:21f:b483:2ad5 with SMTP id d9443c01a7336-22df350d4d0mr15944745ad.20.1745970684135; Tue, 29 Apr 2025 16:51:24 -0700 (PDT) Received: from dread.disaster.area (pa49-181-60-96.pa.nsw.optusnet.com.au. [49.181.60.96]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22db4d76ce1sm109571705ad.40.2025.04.29.16.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Apr 2025 16:51:23 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.98.2) (envelope-from ) id 1u9ujR-0000000F0V9-0vM9; Wed, 30 Apr 2025 09:51:21 +1000 Date: Wed, 30 Apr 2025 09:51:21 +1000 From: Dave Chinner To: "Nirjhar Roy (IBM)" Cc: fstests@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, ritesh.list@gmail.com, ojaswin@linux.ibm.com, djwong@kernel.org, zlang@kernel.org Subject: Re: [PATCH v2 1/2] common: Move exit related functions to a common/exit Message-ID: References: Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Apr 29, 2025 at 06:52:53AM +0000, Nirjhar Roy (IBM) wrote: > Introduce a new file common/exit that will contain all the exit > related functions. This will remove the dependencies these functions > have on other non-related helper files and they can be indepedently > sourced. This was suggested by Dave Chinner[1]. > > [1] https://lore.kernel.org/linux-xfs/Z_UJ7XcpmtkPRhTr@dread.disaster.area/ > Suggested-by: Dave Chinner > Signed-off-by: Nirjhar Roy (IBM) > --- > common/config | 17 +---------------- > common/exit | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ > common/preamble | 1 + > common/punch | 5 ----- > common/rc | 28 --------------------------- > 5 files changed, 52 insertions(+), 49 deletions(-) > create mode 100644 common/exit Neither of my replys to v1 made it to the list [1], so I'll have to repeat what I said here. I did point out that I had already sent this out here: https://lore.kernel.org/fstests/20250417031208.1852171-4-david@fromorbit.com/ but now this version is mostly the same (except for things noted below) so I'm good with this. > > diff --git a/common/config b/common/config > index eada3971..6a60d144 100644 > --- a/common/config > +++ b/common/config > @@ -38,7 +38,7 @@ > # - this script shouldn't make any assertions about filesystem > # validity or mountedness. > # > - > +. common/exit > . common/test_names This isn't needed. Include it in check and other high level scripts (which need to include this, anyway) before including common/config. > diff --git a/common/exit b/common/exit > new file mode 100644 > index 00000000..ad7e7498 > --- /dev/null > +++ b/common/exit > @@ -0,0 +1,50 @@ > +##/bin/bash > + > +# This functions sets the exit code to status and then exits. Don't use > +# exit directly, as it might not set the value of "$status" correctly, which is > +# used as an exit code in the trap handler routine set up by the check script. > +_exit() > +{ > + test -n "$1" && status="$1" > + exit "$status" > +} > + > +_fatal() > +{ > + echo "$*" > + _exit 1 > +} > + > +_die() > +{ > + echo $@ > + _exit 1 > +} This should be removed and replaced with _fatal > +die_now() > +{ > + _exit 1 > +} And this should be removed as well. i.e. These two functions are only used by common/punch, so change them to use _fatal and _exit rather than duplicating the wrappers. > diff --git a/common/preamble b/common/preamble > index ba029a34..9b6b4b26 100644 > --- a/common/preamble > +++ b/common/preamble > @@ -33,6 +33,7 @@ _register_cleanup() > # explicitly as a member of the 'all' group. > _begin_fstest() > { > + . common/exit > if [ -n "$seq" ]; then > echo "_begin_fstest can only be called once!" > _exit 1 Please leave a blank line between includes and unrelated code. -Dave. [1] Thanks Google, for removing mail auth methods without any warning and not reporting permanent delivery failure on attempts to send mail an unsupported auth method. -- Dave Chinner david@fromorbit.com