hexdump :: irregular illegal seek

Bug #342433 reported by Ancoron Luziferis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bsdmainutils (Debian)
Fix Released
Unknown
bsdmainutils (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: bsdmainutils

I just found out that the hexdump program from the bsdmainutils package at least version 6.1.10ubuntu2 (also version 6.1.6 in Debian 4) for architecture AMD64 throws an "illegal seek" error when dealing with stdin input while using the -s option.

Simple test: echo "test" | hexdump -s 1

Most times all things are OK but sometimes it just throws an error:
"hexdump: stdin: Illegal seek"

The same tests made with "od" or "xxd" are OK.

I've attached a simple test script to verify the problem ("testBackslashHex.sh").

1.) using Ubuntu 8.10 (kernel 2.6.27.11-generic)
2.) bsdmainutils 6.1.10ubuntu2
3.) + 4.) see text

Ancoron

Revision history for this message
Ancoron Luziferis (ancoron) wrote :
Revision history for this message
Ancoron Luziferis (ancoron) wrote :

Tests with FreeBSD 6.2 showed that the version over there works correctly and doesn't throw any errors:

Executing backslash '\' test 'echo'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump -x'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump -x -s 1'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'sed ... | iconv ... | hexdump -x -s 2'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'od'...
   :) stable

Revision history for this message
Ancoron Luziferis (ancoron) wrote :

^^ the FreeBSD machine is a 64-bit release too, just like the Ubuntu 8.10 and Debian 4 machine.

Revision history for this message
Ancoron Luziferis (ancoron) wrote :

The same errors in Debian 4 32-bit:

Executing backslash '\' test 'echo'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump -x'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump -x -s 1'...
   :( 18 / 300 executions failed
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'sed ... | iconv ... | hexdump -x -s 2'...
   :( 21 / 300 executions failed
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'xxd'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'od'...
   :) stable

Revision history for this message
Ancoron Luziferis (ancoron) wrote :

To even more increase strangeness I ran the test script on a notebook with the same Ubuntu version (8.10) and I was unable to reproduce the faulty behavior:

ancoron@bitch:~$ ./testBackslashHex.sh
Executing backslash '\' test 'echo'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump -x'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'hexdump -x -s 1'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'sed ... | iconv ... | hexdump -x -s 2'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'xxd'...
   :) stable
|-----------------------------------------------------------------------------|
Executing backslash '\' test 'od'...
   :) stable

So to clarify the hardware environments this bug seems to be related with here is a small list of tested machines where the faulty behavior can be seen by running the provided test script:

- Intel Pentium 4 with HyperThreading enabled (2 logical CPUs) @ Debian 4
- Dual Intel Xeon Quad-Core (8 logical CPUs) @ Debian 4
- Intel Core 2 Duo (2 logical CPUs) @ Ubuntu 8.10
- AMD Athlon 64 X2 (2 logical CPUs) @ Ubuntu 8.10

And here is a list where I was unable to raise any errors:

- Intel Pentium M (1 logical CPU) @ Ubuntu 8.10

All Ubuntu 8.10 machines have the latest patches applied.

description: updated
Revision history for this message
Ancoron Luziferis (ancoron) wrote :

I had to change the bug title and description because I just found out that the error does occur with any string.

A modified test script is attached.

Revision history for this message
Ancoron Luziferis (ancoron) wrote :

This bug remains in Jaunty and will remain in Karmic.

Changed in bsdmainutils (Ubuntu):
status: New → Confirmed
Changed in bsdmainutils (Debian):
status: Unknown → New
Changed in bsdmainutils (Debian):
status: New → Fix Released
Revision history for this message
Ancoron Luziferis (ancoron) wrote :

Just tested the issue on a Lucid Alpha 3 AMD64 machine with version 8.0.1ubuntu1 of bsdmainutils:

+-----------------------------------------------------------------------------+
| HEXDUMP test script v 1.1 |
+-----------------------------------------------------------------------------+
| Using test string "test"
| Cycles: 1
| Executions per cycle: 1000
+----------------------------------------------------------------------------->
Executing test 'echo'...
   :) stable
|-----------------------------------------------------------------------------|
Executing test 'echo ... | hexdump'...
   :) stable
|-----------------------------------------------------------------------------|
Executing test 'echo ... | hexdump -x'...
   :) stable
|-----------------------------------------------------------------------------|
Executing test 'echo ... | hexdump -x -s 1'...
   :( 57 / 1000 executions failed
|-----------------------------------------------------------------------------|
Executing test 'echo ... | sed ... | iconv ... | hexdump -x -s 2'...
   :( 69 / 1000 executions failed
|-----------------------------------------------------------------------------|
Executing test 'echo ... | xxd -s 1'...
   :) stable
|-----------------------------------------------------------------------------|
Executing test 'echo ... | od -x -j 1'...
   :) stable

So this is NOT fixed in Lucid yet.

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

Ubuntu 10.10, bsdmainutils 8.0.11ubuntu1, seems to be working fine.

    $ echo "ABCD" | hexdump -s 1
    0000001 4342 0a44
    0000005

That's "CB \nD"; the A has been skipped.

Revision history for this message
Ancoron Luziferis (ancoron) wrote :

Hi Ralph,

could you please download and execute the updated test script I have provided to verify that your version is running correctly?

I just tested again on an Ubuntu 11.04 that has bsdmainutils 8.2.2 (which fails, but is OK since not an LTS release):

$ testHexdump.sh "ABCD"
+-------------------------------------------------------------------------+
| HEXDUMP test script v 1.2 |
+-------------------------------------------------------------------------+
| System: Ubuntu 11.04 (natty)
| BSD main utils version: 8.2.2
+------------------------------------------------------------------------->
| Using test string "ABCD"
| Cycles: 1
| Executions per cycle: 1000
+------------------------------------------------------------------------->
Executing test 'echo'...
   :) stable
Executing test 'echo ... | hexdump'...
   :) stable
Executing test 'echo ... | hexdump -x'...
   :) stable
Executing test 'echo ... | hexdump -x -s 1'...
   :( 61 / 1000 executions failed
Executing test 'echo ... | sed ... | iconv ... | hexdump -x -s 2'...
   :( 70 / 1000 executions failed
Executing test 'echo ... | xxd -s 1'...
   :) stable
Executing test 'echo ... | od -x -j 1'...
   :) stable

...on the other hand an 11.10 installation with bsdmainutils 8.2.3 seems to be fine:

$ ./bin/testHexdump.sh "ABCD"
+-------------------------------------------------------------------------+
| HEXDUMP test script v 1.2 |
+-------------------------------------------------------------------------+
| System: Ubuntu 11.10 (oneiric)
| BSD main utils version: 8.2.3
+------------------------------------------------------------------------->
| Using test string "ABCD"
| Cycles: 1
| Executions per cycle: 1000
+------------------------------------------------------------------------->
Executing test 'echo'...
   :) stable
Executing test 'echo ... | hexdump'...
   :) stable
Executing test 'echo ... | hexdump -x'...
   :) stable
Executing test 'echo ... | hexdump -x -s 1'...
   :) stable
Executing test 'echo ... | sed ... | iconv ... | hexdump -x -s 2'...
   :) stable
Executing test 'echo ... | xxd -s 1'...
   :) stable
Executing test 'echo ... | od -x -j 1'...
   :) stable

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.