Date: Tue, 23 Apr 2013 11:10:01 GMT From: Matthew Rezny <mrezny@hexaneinc.com> To: freebsd-standards@FreeBSD.org Subject: Re: standards/177742: conflict of dd's bs= option with use of conv=sparse Message-ID: <201304231110.r3NBA11i085387@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: Matthew Rezny <mrezny@hexaneinc.com> To: Konstantin Belousov <kostikbel@gmail.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 13:00:43 +0200 On Tue, 23 Apr 2013 09:21:23 +0300 Konstantin Belousov <kostikbel@gmail.com> wrote: > 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= 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)) == C_BS) { > > out.dbcnt = in.dbcnt; > > dd_out(0); > > in.dbcnt = 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= expr operand is specified and no conversions other > than sync, noerror, or notrunc are requested, the data returned from > each input block shall be written as a separate output block. > > 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)) == > C_BS) { out.dbcnt = in.dbcnt; > dd_out(1); > in.dbcnt = 0; > On review, I think the dd_out(0) was an oversight. I put the more precise condition up top but then forgot to put it back to dd_out(1) as it had been. The one line patch you plan to commit should be effective. Thank you for taking the time to read my perhaps overly verbose report on the issue.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304231110.r3NBA11i085387>