bin/121287: dd ignores any conversions if 'bs' was specified

Nick Hibma nick at anywi.com
Sun Mar 2 13:10:01 UTC 2008


>Number:         121287
>Category:       bin
>Synopsis:       dd ignores any conversions if 'bs' was specified
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 02 13:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>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 at 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 at 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 at 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 at 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:
>Unformatted:
 X-REMOTE_ADDR-Is-Open-Proxy: Maybe
 X-Send-Pr-Version: www-3.1
 X-GNATS-Notify: 
 
 


More information about the freebsd-bugs mailing list