Questions about behaviour of busybox `tee`

Harry Butterworth harry at hebutterworth.freeserve.co.uk
Thu May 18 15:26:13 UTC 2006


Hi folks,

    The Xen xm-test test suite is using busybox on a ramdisk and I was
trying to write a new test involving busybox tee.

    I am trying to do something like this:

    head -c <bytes> /dev/urandom | tee random_file | md5sum

    then

    md5sum random_file

    I was expecting that both md5sums would be the same.

    When tee is compiled without the CONFIG_FEATURE_TEE_USE_BLOCK_IO
flag set and <bytes> is large I find that the md5sums are different (I
happened to try <bytes> == 666 which worked and <bytes> == 182376 which
didn't).

    I also tried head -c <bytes> /dev/urandom | tee random_file_1 | tee
random_file2 | md5sum.

    In that case it was the final md5sum that was different from the
md5sums of the saved files (which were both the same) so to me it looks
like a problem with the interaction between busybox tee stdout and
busybox md5sum stdin.

    When tee is compiled with the CONFIG_FEATURE_TEE_USE_BLOCK_IO flag
set then it seems to work as I expect.

    I had a look at the code for tee but can't see what the problem is.
So my questions are:

1) Is this the expected behaviour of busybox tee or is it a bug in the
non CONFIG_FEATURE_TEE_USE_BLOCK_IO version.

2) What's the point of having two configurable versions of tee?  i.e.
what's the difference supposed to be between the
CONFIG_FEATURE_TEE_USE_BLOCK_IO version and the other version?

    The Busybox version I'm using is 1.1.2 and I was running the tests
under the latest xen-unstable hypervisor in an unprivileged domain
(hopefully running under Xen isn't significant).

    Thanks for any help.

Harry Butterworth





More information about the busybox mailing list