Bug 185070 - [patch] dd(1) add better error message when partial write to dev
Summary: [patch] dd(1) add better error message when partial write to dev
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-21 14:40 UTC by luke.tw
Modified: 2017-12-31 22:27 UTC (History)
0 users

See Also:


Attachments
file.diff (850 bytes, patch)
2013-12-21 14:40 UTC, luke.tw
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description luke.tw 2013-12-21 14:40:00 UTC
when dd writes to a device, the error message is misleading if the write size is less than the sector size of the device.

Fix: 3. after applying the patch:
bsd10# ./dd if=/root/513b of=/dev/da1
dd: /root/513b: not a multiple of /dev/da1's sector size (512 bytes)
1+1 records in
1+0 records out
512 bytes transferred in 0.003080 secs (166227 bytes/sec)
bsd10# ./dd if=/root/513b of=/dev/da1 bs=1
dd: bs=1: not a multiple of /dev/da1's sector size (512 bytes)
1+0 records in
0+0 records out
0 bytes transferred in 0.000059 secs (0 bytes/sec)

Patch attached with submission follows:
How-To-Repeat: 1. create input files
bsd10# dd if=/dev/random of=/root/512b bs=1 count=512
512+0 records in
512+0 records out
512 bytes transferred in 0.001007 secs (508400 bytes/sec)
bsd10# dd if=/dev/random of=/root/513b bs=1 count=513
513+0 records in
513+0 records out
513 bytes transferred in 0.000936 secs (548059 bytes/sec)

2. dd these input files to /dev/
bsd10# dd if=/root/512b of=/dev/da1
1+0 records in
1+0 records out
512 bytes transferred in 0.005722 secs (89478 bytes/sec)
bsd10# dd if=/root/513b of=/dev/da1
dd: /dev/da1: Invalid argument
1+1 records in
1+0 records out
512 bytes transferred in 0.000363 secs (1410962 bytes/sec)
bsd10# dd if=/root/513b of=/dev/da1 bs=1
dd: /dev/da1: Invalid argument
1+0 records in
0+0 records out
0 bytes transferred in 0.000159 secs (0 bytes/sec)
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:41 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped