standards/177742: conflict of dd's bs= option with use of conv=sparse

Konstantin Belousov kostikbel at
Wed Apr 10 19:01:21 UTC 2013

On Wed, Apr 10, 2013 at 02:10:01PM +0000, Matthew Rezny wrote:
> The following reply was made to PR standards/177742; it has been noted by GNATS.
> From: Matthew Rezny <mrezny at>
> To: bug-followup at
> Cc:  
> Subject: Re: standards/177742: conflict of dd's bs= option with use of
>  conv=sparse
> Date: Wed, 10 Apr 2013 15:31:08 +0200
>  The patch I suggested got a little messed up by the web form, and it
>  also contained a typo. Further, I had neglected to consider the
>  C_BS flag itself should be present after masking off the few allowed
>  flags, so the patch should be amended as such follows.
>   if (ddflags & C_BS) {
>       out.dbcnt = in.dbcnt;
>  -    dd_out(1);
>  +    dd_out((ddflags & !(C_NOERROR | C_NOTRUNC | C_SYNC)) == C_BS);
>       in.dbcnt = 0;
>       continue;
>   }
>  This patch has been tested to confirm conv=sparse now works as expected
>  with bs= set. No other conversions have been checked with the bs=
>  option and from reading the code I don't think they will.

I somehow followed what you wrote.

Still, I think your patch is not correct. Its result is always using the
block coalescing mode there. The issue is that the '!' operator result
is defined to be either 0 or 1, which mask and-ed with ddflags never could
be equal to the C_BS == 4. You probably mean '~' ?

In fact, the test in the containing if () means that C_BS is guaranteed
to be set there.

So my question is, do you want to explicitely check that no other flags
are set, except noerror, notrunc, sync and bs ? Or is it yet another bug ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <>

More information about the freebsd-standards mailing list