From nobody@FreeBSD.org  Thu Dec 27 17:27:38 2007
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 4D94C16A419
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 27 Dec 2007 17:27:38 +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 4334C13C442
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 27 Dec 2007 17:27:38 +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 lBRHR06p071714
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 27 Dec 2007 17:27:00 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id lBRHR0hA071713;
	Thu, 27 Dec 2007 17:27:00 GMT
	(envelope-from nobody)
Message-Id: <200712271727.lBRHR0hA071713@www.freebsd.org>
Date: Thu, 27 Dec 2007 17:27:00 GMT
From: Sean Bruno <sbruno@miralink.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dd yields a bogus error when input file is to small for output device
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         119068
>Category:       bin
>Synopsis:       dd(1) yields a bogus error when input file is to small for output device
>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:   Thu Dec 27 17:30:04 UTC 2007
>Closed-Date:    
>Last-Modified:  Thu Dec 27 18:29:53 UTC 2007
>Originator:     Sean Bruno
>Release:        RELENG_6
>Organization:
Miralink Inc
>Environment:
FreeBSD desdemona.office.miralink.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 11:05:30 UTC 2007     root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP  i386

>Description:
When using dd with an input file smaller than the block size of an output
device, the error generated doesn't give the end user any clue as to why
the dd failed.

For example, create a text file with a size of 256 bytes and attempt to
dd that file to a drive which has 512 byte blocks:

desdemona # ls -la test.txt                                                        
-rw-r--r--  1 root  wheel  256 Dec 28 01:47 test.txt

dd if=test.txt of=/dev/ad5
dd: /dev/ad5: Invalid argument

The error should give some kind of indication that the input file is too
small to use with the ouput device.  eg:

dd: /dev/ad5: Input file is smaller than block size of ouput.
>How-To-Repeat:
Create a text file that is smaller than 1 512 byte block, eg use
"jot -c 128 0 > testfile"

Attempt to dd that testfile to a SATA or IDE drive which has 512 byte blocks:

dd if=testfile of=/dev/adX
>Fix:
Use a file that is large than the block size of the drive.

>Release-Note:
>Audit-Trail:
>Unformatted:
