Re: [PATCH 05/10] common: add _filter_trailing_whitespace

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Fri, Dec 29, 2023 at 11:02 AM Anand Jain <anand.jain@xxxxxxxxxx> wrote:
>
> The command 'btrfs inspect-internal dump-tree -t raid_stripe'
> introduces trailing whitespace in its output.
> Apply a filter to remove it. Used in btrfs/30[4-8][.out].
>
> Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
> ---
>  common/filter | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/common/filter b/common/filter
> index 509ee95039ac..016d213b8bee 100644
> --- a/common/filter
> +++ b/common/filter
> @@ -651,5 +651,10 @@ _filter_bash()
>         sed -e "s/^bash: line 1: /bash: /"
>  }
>
> +_filter_trailing_whitespace()
> +{
> +       sed -e "s/ $//"
> +}

If we're having such a generic filter in common file, than I'd rather
have it delete any number of trailing white spaces, not just a single
one, and also account for tabs and other white spaces, so:

sed -e "s/\s+$//"

Also, since this is so specific to the raid stripe tree, I'd rather
have this filter included in the raid stripe tree filter introduced in
patch 2, _filter_stripe_tree(). That would make the tests shorter and
cleaner by avoiding piping yet over another filter that is used only
for the raid stripe tree dump...

Thanks.




> +
>  # make sure this script returns success
>  /bin/true
> --
> 2.39.3
>
>





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux