From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux 2.4.2-2 i686; en-US; 0.7) Gecko/20010316 Description of problem: od --width seems to be confused about the size of a double float. With --width a multiple of 8, od prints a warning message and sets --width to be a multiple of 12 instead. However, od seems to be correctly reading 8 bytes for each double, so if --width is a multiple of 8 and 12 (e.g., 24) then the output is correct. Also, od is confused about sizeof(float) -- od seems to think sizeof(float) == 8 for purposes of --width. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Create data file t.data containing 6 doubles, 1, 2, 3, 4, 5, 6. (See additional info.) 2. Run "od -t f8 --width=8 t.data". Actual Results: [robert@chromium /tmp]$ od -t f8 --width=8 t.data od: warning: invalid width 8; using 12 instead 0000000 1.000000000000000e+00 0000014 5.304989477413181e-315 0000030 4.000000000000000e+00 0000044 5.311465294646351e-315 0000060 Expected Results: Output should be: 0000000 1.000000000000000e+00 0000010 2.000000000000000e+00 0000020 3.000000000000000e+00 0000030 4.000000000000000e+00 0000040 5.000000000000000e+00 0000050 6.000000000000000e+00 Additional info: 1. "od -t f8 --width=24 t.data" yields correct output, i.e., 3 doubles per line, 2 lines. 2. "od -t f8 --width=12 t.data" yields same incorrect output as "Actual Results" above, and there is no warning message (as there should be since width is not a multiple of sizeof(double)). 3. Bytes in t.data are the following: $ od -b t.data 0000000 000 000 000 000 000 000 360 077 000 000 000 000 000 000 000 100 0000020 000 000 000 000 000 000 010 100 000 000 000 000 000 000 020 100 0000040 000 000 000 000 000 000 024 100 000 000 000 000 000 000 030 100 0000060 4. "od -t f4 --width=4 t.data" yields "od: warning: invalid width 4; using 8 instead". (Output is goofy since t.data contains doubles instead of singles, but that's beside the point.) 5. I am using od built from textutils-2.0.11-7.src.rpm, according to rpm.
OK, I think I found it. There are 2 parallel lists containing type info, size_spec (a list of enums), and width_bytes (a list of sizeofs). width_bytes was missing sizeof(long long), so the placement of the float, double, and long double items was off by 1. The patch shown below fixes the --width problem. BTW I am working with od.c from textutils-2.0.11-7.src.rpm. [root@chromium src]# diff -c od.original od.c *** od.original Sun Oct 28 17:30:11 2001 --- od.c Sun Oct 28 17:46:27 2001 *************** *** 135,140 **** --- 135,141 ---- sizeof (short int), sizeof (int), sizeof (long int), + sizeof (long long), sizeof (float), sizeof (double), sizeof (LONG_DOUBLE)
You're right, fixed in 2.0.16-1.