From nobody@FreeBSD.org  Sun Mar  2 13:03:37 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0E535106567B
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  2 Mar 2008 13:03:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 02C9C8FC19
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  2 Mar 2008 13:03:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m22D0gvD091188
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 2 Mar 2008 13:00:42 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m22D0gbg091187;
	Sun, 2 Mar 2008 13:00:42 GMT
	(envelope-from nobody)
Message-Id: <200803021300.m22D0gbg091187@www.freebsd.org>
Date: Sun, 2 Mar 2008 13:00:42 GMT
From: Nick Hibma <nick@anywi.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dd ignores any conversions if 'bs' was specified

>Number:         121287
>Category:       bin
>Synopsis:       dd(1) ignores any conversions if 'bs' was specified
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 02 13:10:01 UTC 2008
>Closed-Date:    Mon Jan 04 16:14:57 UTC 2010
>Last-Modified:  Mon Jan 04 16:14:57 UTC 2010
>Originator:     Nick Hibma
>Release:        6-STABLE
>Organization:
AnyWi Technologies
>Environment:
System: FreeBSD hind.van-laarhoven.org 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #20: Fri Dec 14 13:39:34 CET 2007
root@hind.van-laarhoven.org:/usr/src/sys/i386/compile/HIND i386

>Description:
If you specify a block size with bs (probably with ibs and obs as well)
any conversions will be ignored, notable bs.

If you copy a large file (CF image file in my case) reading in large
block sizes is preferrable, especially on for example USB devices.
>How-To-Repeat:
nick@hind:/usr/home/nick % dd bs=1M count=1 if=/dev/zero of=sparsefile.1 
1+0 records in
1+0 records out
1048576 bytes transferred in 0.098494 secs (10646084 bytes/sec)
nick@hind:/usr/home/nick % dd count=1 if=/dev/zero of=sparsefile.2
1+0 records in
1+0 records out
512 bytes transferred in 0.000175 secs (2925727 bytes/sec)
nick@hind:/usr/home/nick % du -sk sparsefile.*
1040    sparsefile.1
2       sparsefile.2
>Fix:
The following code fragment shows the problematic code:

src/bin/dd.c:349: rev.1.43

        /*
         * POSIX states that if bs is set and no other conversions
         * than noerror, notrunc or sync are specified, the block
         * is output without buffering as it is read.
         */
        if (ddflags & C_BS) {
                out.dbcnt = in.dbcnt;
                dd_out(1);
                in.dbcnt = 0; 
                continue; 
        }

>Release-Note:
>Audit-Trail:

From: "Jordan Sissel" <psionic@gmail.com>
To: bug-followup@FreeBSD.org, nick@anywi.com
Cc:  
Subject: re: bin/121287: dd(1) ignores any conversions if 'bs' was specified
Date: Sat, 8 Mar 2008 21:03:23 -0800

 % dd if=/dev/zero conv=sparse ibs=1m count=100 of=myfile
 100+0 records in
 204800+0 records out
 104857600 bytes transferred in 0.274636 secs (381805694 bytes/sec)
 % du -hs myfile
  48K    myfile
 % ls -l myfile
 -rw-r--r--  1 jls  jls  104857600 Mar  8 12:12 myfile
 
 Setting ibs and conv=sparse correctly generates a sparse file.
 
 Additionaly, in your report you show two examples, both of which would
 never create sparse files (despite your filenames containing
 'sparsefile')
 
 Can you elaborate on this? I don't really see a problem.
 
 -Jordan

From: Nick Hibma <nick@van-laarhoven.org>
To: bug-followup@FreeBSD.org,
 nick@anywi.com
Cc:  
Subject: Re: bin/121287: dd(1) ignores any conversions if 'bs' was specified
Date: Mon, 4 Jan 2010 16:14:14 +0100

 This can be closed.
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Mon Jan 4 16:14:41 UTC 2010 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121287 
>Unformatted:
