patchGNU Core Utilities - Patches: patch #4978, hexadecimal support for dd

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #4978: hexadecimal support for dd

Submitter:  None
Submitted:  Fri 17 Mar 2006 01:11:50 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  eggert Originator Email:  -email is unavailable-
Open/Closed:  Closed

Thu 23 Mar 2006 01:52:37 PM UTC, comment #3: 

Short, easy to type, conforming to POSIX:

dd if=/dev/zero of=test bs=$((0xe0000)) count=1

Andreas Schwab <schwab>
Thu 23 Mar 2006 01:12:47 PM UTC, comment #2: 

How about introducing new operands?  POSIX requires 'x' to mean multiplication of decimal values in bs, cbs, ibs, and obs; but for count, skip, and seek, it only documents a value 'n'.  So for the former, why not introduce bsx, cbsx, ibsx, and obsx that take a single integer in any radix (or at least a standard C literal integer) with optional multiplier?  count, skip, and seek can be modified directly to accept hexadecimal.

So your above example would then be written:
dd if=/dev/zero of=test bsx=0xe0000 count=1

And if you wanted to be POSIX compliant, without resorting to perl, try something like:
dd if=/dev/zero of=test bs=14x16x4k count=1

Eric Blake <ericb>
Group administrator
Wed 22 Mar 2006 08:30:59 PM UTC, comment #1: 

Alas, this is an incompatible change; look for how 'x' is
treated in the very next line of source code after your
proposed patch.   Also, the code won't work well if the
user attempts to apply the valid suffixes b, c, or E
to a hexadecimal number.

Perhaps some different syntax could be used, that is
upwards compatible with the current behavior?

Paul Eggert <eggert>
Group administrator
Fri 17 Mar 2006 01:11:50 PM UTC, original submission:  

This patch adds support for parsing hexadecimal numbers to dd.
So instead of writing:

 dd if=/dev/zero of=test bs=`perl -e 'printf("%d",0xe0000);'` count=1

you can just write

 dd if=/dev/zero of=test bs=0xe0000 count=1

It's a feature I use everyday and I'd be really glad if you could take it into the official release of GNU coreutils.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #9659:  dd.diff added by None (667B - text/x-diff - Patch to add hexadecimal support to dd, against coreutils CVS from 2006-03-17)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-09-13 eggert StatusNone Wont Do
    Open/ClosedOpen Closed
2006-03-22 eggert Assigned toNone eggert
2006-03-17 None Carbon-Copy- Added stepan --AT-- coresystems --DOT-- de
2006-03-17 None Attached File- Added dd.diff, #6048

Back to the top

Powered by Savane 3.14-2340.
Corresponding source code