bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in od with "-j" option?


From: Paul GHALEB
Subject: Bug in od with "-j" option?
Date: Mon, 13 Aug 2007 18:33:52 +0200
User-agent: Thunderbird 2.0.0.4 (Windows/20070604)

Hi all,

Below is an execution trace using "od":
<TRACE>

sh-2.05b$ od --version
od (GNU coreutils) 6.7
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering.

sh-2.05b$ echo "1234567890123456789" >toto

sh-2.05b$ ls -l toto
-rw-r----- 1 ghalebp gnbst200 20 2007-07-10 09:53 toto

sh-2.05b$ od -t x1 -Ad -v toto
0000000 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36
0000016 37 38 39 0a
0000020

sh-2.05b$ od -t x1 -j 19 -Ad -v toto
0000019 0a
0000020

sh-2.05b$ od -t x1 -j 20 -Ad -v toto
0000020 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36
0000036 37 38 39 0a
0000040

sh-2.05b$ od -t x1 -j 21 -Ad -v toto
od: cannot skip past end of combined input

</TRACE>

IOW, when one tries to skip exactly the size of the file, od acts as if it ignored the "-j size" option.

I looked at the source code and found that the problem is most likely in src/od.c:skip() at line 1043:
              if ((uintmax_t) file_stats.st_size <= n_skip)
which should be:
              if ((uintmax_t) file_stats.st_size <  n_skip)

I did this change on a local build and tested it successfully. Am I the first one to come across this problem?

Kind regards,
--Paul






reply via email to

[Prev in Thread] Current Thread [Next in Thread]