[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in od with "-j" option?
From: |
Eric Blake |
Subject: |
Re: Bug in od with "-j" option? |
Date: |
Thu, 16 Aug 2007 21:55:49 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Paul GHALEB on 8/13/2007 10:33 AM:
>
> IOW, when one tries to skip exactly the size of the file, od acts as if
> it ignored the "-j size" option.
[This mail assumes your sed obeys POSIX on this sequence:
$ seq 3 > foo
$ (sed -n q; cat) < foo
2
3
$
If this is not the case, replace 'sed -n q' with 'head -n1 > /dev/null']
While we're at it, od has another POSIX-compliance bug, when stdin is
seekable and starts life in the middle of the file:
$ seq 3 > blah
$ (sed -n q; od -tx1z -j 7) <blah # good
od: cannot skip past end of combined input
$ (sed -n q; od -tx1z -j 5) <blah
0000005
$ # seeking 5 puts us past the end; this should have
$ # errored just like -j7
Also, POSIX wasn't too clear on this point, but:
$ (sed -n q; od -tx1z -j 4) <blah
0000004
$ # file started at offset 2; should this report offset 6, not 4?
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGxRxF84KuGfSFAYARAk3/AKCl9e4RI+EYpKjG1igIfAsXfLVAtQCgy1YN
Sww8fEBmLT7P1pfmh/L79Nc=
=Wi5b
-----END PGP SIGNATURE-----