[parted-devel] [PATCH 0/3] Send errors to stderr, not stdout.

Jim Meyering jim at meyering.net
Fri Oct 14 19:53:56 UTC 2011


Richard W.M. Jones wrote:

> Even with the -m and/or -s option which are supposely designed to make
> parted machine-readable, it still mixes error messages and warnings on
> stdout.  In practice this makes it not machine-readable at all.
>
> Example:
>
> $ truncate -s 1M /tmp/test1.img
> $ parted -m -- /tmp/test1.img unit b print
> WARNING: You are not superuser.  Watch out for permissions.
> Error: /tmp/test1.img: unrecognised disk label
> BYT;
> /tmp/test1.img:1048576B:file:512:512:unknown:;
>
> The "WARNING:..." and "Error:..." lines go to stdout.
>
> These patches fix most of the problems, sending errors and warnings to
> stderr where they belong.  Parsing can now be attempted more sanely:
>
> $ ~/d/parted/parted/parted -m -- /tmp/test1.img unit b print 2>/dev/null
> BYT;
> /tmp/test1.img:1048576B:file:512:512:unknown:;

Thanks for the patches, and especially for
taking the time to adapt the tests to the new behavior.
I've applied them.



More information about the parted-devel mailing list