lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <i2tzjbfyzxdymkbebyla3oqo5krj3mknpixtb54ojnaeqpg57t@vbiexo6jmkig>
Date: Sun, 6 Apr 2025 13:35:24 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Integral <integral@...hlinuxcn.org>
Cc: Kent Overstreet <kent.overstreet@...il.com>, 
	linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] bcachefs: split error messages of invalid
 compression into two lines

On Sun, Apr 06, 2025 at 11:26:59PM +0800, Integral wrote:
> When an invalid compression type or level is passed as an argument
> to `--compression`, two error messages are squashed into one line:
> 
>     > bcachefs format --compression=lzo bcachefs-comp.img
>     invalid option: invalid compression typecompression: parse error
> 
>     > bcachefs format --compression=lz4:16 bcachefs-comp.img
>     invalid option: invalid compression levelcompression: parse error
> 
> To resolve this issue, add a newline character at the end of the
> first error message to separate them into two lines.
> 
> Signed-off-by: Integral <integral@...hlinuxcn.org>

Applied

I've also been working on consistent indentation for multiline error/log
messages, so that we can see grouping better.

If you want to add that, the new helper is

  printbuf_indent_add_nextline()

With that we can initialize a printbuffer and at the same time set it so
that lines after the first are two space indented.

> ---
>  fs/bcachefs/compress.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c
> index 28ed32449913..d68c3c7896a3 100644
> --- a/fs/bcachefs/compress.c
> +++ b/fs/bcachefs/compress.c
> @@ -714,7 +714,7 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res,
>  
>  	ret = match_string(bch2_compression_opts, -1, type_str);
>  	if (ret < 0 && err)
> -		prt_str(err, "invalid compression type");
> +		prt_str(err, "invalid compression type\n");
>  	if (ret < 0)
>  		goto err;
>  
> @@ -729,7 +729,7 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res,
>  		if (!ret && level > 15)
>  			ret = -EINVAL;
>  		if (ret < 0 && err)
> -			prt_str(err, "invalid compression level");
> +			prt_str(err, "invalid compression level\n");
>  		if (ret < 0)
>  			goto err;
>  
> -- 
> 2.49.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ