Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2013 06:30:01 GMT
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/177742: conflict of dd's bs= option with use of conv=sparse
Message-ID:  <201304230630.r3N6U1b4030412@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/177742; it has been noted by GNATS.

From: Konstantin Belousov <kostikbel@gmail.com>
To: Matthew Rezny <mrezny@hexaneinc.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: standards/177742: conflict of dd's bs= option with use of
 conv=sparse
Date: Tue, 23 Apr 2013 09:21:23 +0300

 --SvF6CGw9fzJC4Rcx
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Thu, Apr 11, 2013 at 05:44:59AM +0200, Matthew Rezny wrote:
 > Looking not just at my problem but the overall situation, it seems the
 > logic in dd_in() does not hold up. The last line, (*cfunc)();, actually
 > invokes the appropriate conversion(s) and then calls dd_out(0). With
 > the simple test on line 361, we will never get down to that call if bs=3D
 > option is used. Really, to make the code fit the comment, it should
 > probably be something like
 > if ((ddflags & ~(C_NOERROR | C_NOTRUNC | C_SYNC)) =3D=3D C_BS) {
 >     out.dbcnt =3D in.dbcnt;
 >     dd_out(0);
 >     in.dbcnt =3D 0;
 >     continue;
 > }
 I do not see why did you changed dd_out(1) to dd_out(0).
 
 Anyway, I am going to commit the following patch, unless I get some
 objection in two-three days:
 
 commit 37664b1393db30d97aa9eefa70360cd550bf9dd9
 Author: Konstantin Belousov <kib@freebsd.org>
 Date:   Tue Apr 23 09:18:31 2013 +0300
 
     Literally follow POSIX:
     If the bs=3D expr operand is specified and no conversions other than sy=
 nc,
     noerror, or notrunc are requested, the data returned from each input
     block shall be written as a separate output block.
    =20
     PR:	standards/177742
     Submitted by:	Matthew Rezny <mrezny@hexaneinc.com>
 
 diff --git a/bin/dd/dd.c b/bin/dd/dd.c
 index 01b66fc..9d0f9b1 100644
 --- a/bin/dd/dd.c
 +++ b/bin/dd/dd.c
 @@ -358,7 +358,7 @@ dd_in(void)
  		 * than noerror, notrunc or sync are specified, the block
  		 * is output without buffering as it is read.
  		 */
 -		if (ddflags & C_BS) {
 +		if ((ddflags & ~(C_NOERROR | C_NOTRUNC | C_SYNC)) =3D=3D C_BS) {
  			out.dbcnt =3D in.dbcnt;
  			dd_out(1);
  			in.dbcnt =3D 0;
 
 --SvF6CGw9fzJC4Rcx
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (FreeBSD)
 
 iQIcBAEBAgAGBQJRdihiAAoJEJDCuSvBvK1BMCAQAKLZOlG4LmQ3vKztqcKc8y//
 irjQYUgzWhD0nVS3JrwSiJ4jXsh2VgSWSllFWgynrcObJ57elV567Ficn9CBYYLl
 SD2Z+mqENhdO8e1gliAQ80hkUnqdRKHko8NRJmcqN21/G/6cEC5ACAiuzkMtY7xA
 08A3/3nJF0fG/TpgMFbflv6j8ILN7r4HM52lAaobZph6B6bIfY2ravRVGMuT8/Vs
 UZy1S4yZAFRZXmT5L+jpTTlQkavI9dQEGybV1ILmmNFmJDFRVibUs2CEmrgVKQCN
 wmIxwkfIzBHlzdeUK7EpcZQkB9RZUyLmghaubE2vEXkvvBD2+QEKn51UO4o1CDK7
 LVl1Dz9jRzjJzyjLGfGm+J8qNS3qyg81A0E93kIf1qB0PFTEK05RXKWsP/aYDx/1
 QqKBv3Zj8dJsul0gr7GUW/vywwZ17GTCjWGiXmrsPB9JrYLoY5W2x4x/Ycx7cBC+
 XDdI3kRcOxLNxX4V0lD8yjeHwXUupSgfOqzFojplOTitvagPipwximEZQ4ok/0em
 uyr+26R/LZ97Ng5Ey+7/+Gv8Q0tV1EPsb7Vl+/cfPl5Y8ImELVKeNO+hoWVGUbCV
 eNSKIoJw71HbEvTjxtmerdH9PCXtuugwt1cn/rQCZCRR1PvIGgZjjkBd7D/7Aa23
 ieviqWDI9xaMPM5cJrK2
 =/6OP
 -----END PGP SIGNATURE-----
 
 --SvF6CGw9fzJC4Rcx--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304230630.r3N6U1b4030412>