Catching on on email on the plane back to Austin...

On 09/15/2013 04:23:09 AM, hhm wrote:
Found 2 bugs in `od`, not very familiar with the code so just reporting them:


1. -t <integer-type>0 does not work correctly (loops infinitely while
printing 0)

Confirmed. (Although "correctly" in this case is producing an error mesage.)

And the help text for this command is horrible. And it's accepting -c but not checking for it...

Hmmm, the help text mechanism isn't flexible enough to chop out mention of floating point from the help text when the config has disabled floating point. Yet another todo item, but I have no idea how to address that one. (Apply the C preprocessor to the file before chopping out help text? I guess comments aren't touched by the preprocessor. Still, that'd slow the build down even more...)

Worry about it later...

2. -J does not seem to have an effect (although it looks like there is
some code which does reference/use it)

Yeah, that's not working either. Hmmm...

For starters, the jump_bytes < pos test is backwards, it needs to do work when jump_bytes is > pos. Secondly, lskip() returns the amount of data _left_, not the amount consumed. And the implementation of lskip() is wrong. (The point is to make skipping -J through multiple files work like you catted files into stdin, so it has to accurately track how much it consumed from each file...)

Hmmm, tension between od currently being the only caller of lskip() and wanting to make lskip() generic (not assuming it's at the start of the file; in theory it doesn't need to check the current position, it should always be zero, but I don't want to assume it'll never be used elsewhere...)

What lskip() does is lseek() that falls back to read() in a loop to advance if lseek doesn't work (ala stdin when it's a pipe), but toybuf is already used and libbuf should only be used from library functions and I dowanna declare a 4k local variable on the stack. Besides, mke2fs would presumably use this... except on output, not input. Sigh.

Ok, fixed it up for now. I should add test suite entries for this at some point. (Upload to site happens when I get my netbook and laptop talking to each other again, probably tomorrow.)

Thanks,

Rob
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to