coreos / coreos-xhyve

Container Linux running on xhyve hypervisor
Apache License 2.0
330 stars 42 forks source link

README: Fix typo in dd example #53

Closed saj closed 3 months ago

saj commented 6 years ago

BSD dd will barf on an uppercase unit of measurement.

From the dd(1) man page:

Where sizes are specified, a decimal, octal, or hexadecimal number of bytes is expected. If the number ends with a b, k, m, g, or w, the number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G) or the number of bytes in an integer, respectively.

lucab commented 6 years ago

@saj Which dd and OS is this?

saj commented 6 years ago
% type dd
dd is /bin/dd

% strings /bin/dd | grep BSD
$FreeBSD: src/bin/dd/position.c,v 1.20 2002/02/02 06:24:12 imp Exp $
0E$FreeBSD: src/bin/dd/misc.c,v 1.23 2002/02/02 06:24:12 imp Exp $
$FreeBSD: src/bin/dd/dd.c,v 1.36 2002/03/07 14:00:33 markm Exp $
$FreeBSD: src/bin/dd/conv_tab.c,v 1.10 1999/09/12 16:51:53 green Exp $
$FreeBSD: src/bin/dd/conv.c,v 1.16 2002/02/02 06:24:12 imp Exp $
$FreeBSD: src/bin/dd/args.c,v 1.31 2002/02/22 20:51:00 markm Exp $

% sw_vers
ProductName:    Mac OS X
ProductVersion: 10.13.5
BuildVersion:   17F77

% dd if=/dev/zero of=./xhyve.img bs=1M count=5000
dd: bs: illegal numeric value

% dd if=/dev/zero of=./xhyve.img bs=1m count=5000
5000+0 records in
5000+0 records out
5242880000 bytes transferred in 5.325281 secs (984526468 bytes/sec)
lucab commented 6 years ago

As I feared, this is a GNU vs BSD mismatch. 1m (lowercase) is not accepted by GNU dd (my version is 8.25). I think we can settle this with 1024k (lowercase) which is equivalent and should work on both.

saj commented 6 years ago

I think we can settle this with 1024k (lowercase) which is equivalent and should work on both.

Revised.

I was under the impression this project only targeted users on Mac (BSD) platforms. (Edit: xhyve and all.) For that reason, I had not paid any consideration to GNU dd implementations.