[dm-devel] [PATCH] kpartx: print "loop deleted" to stdout, not stderr

Martin Wilck mwilck at suse.com
Mon Feb 5 13:58:46 UTC 2018


On Mon, 2018-02-05 at 11:36 +0100, Julian Andres Klode wrote:
> Commit fa643f5d2590028a59c671b81ab41383806fd258 moved some
> code around and changed the print for loop deleted from stdout
> to stderr - but this is not an error message, and also printed
> to stdout in another place, so let's just use printf() again
> here.
> 
> Signed-off-by: Julian Andres Klode <julian.klode at canonical.com>
> ---
>  kpartx/kpartx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
> index c1af1c5e..2e882721 100644
> --- a/kpartx/kpartx.c
> +++ b/kpartx/kpartx.c
> @@ -399,7 +399,7 @@ main(int argc, char **argv){
>  					       loopdev);
>  				r = 1;
>  			} else
> -				fprintf(stderr, "loop deleted :
> %s\n", loopdev);
> +				printf("loop deleted : %s\n",
> loopdev);
>  		}
>  		goto end;
>  	}


Hm. This is a log message, and as such, should go to stderr. kpartx, as
a program primarily intended to run in udev rules, shouldn't print log
messages to stdout unless we have compelling reasons for it to do so.

I'm aware that this isn't done consistently in kpartx at the moment,
but IMO your patch goes in the wrong direction.

Regards
Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)




More information about the dm-devel mailing list