Good applications should expect short reads/write almost everywhere.
But actually, for example, when reading small number of bytes from filesystem or from pipe short reads just [almost] never occur and defects in it's handling can remain undetected.
How to test group of applications interconnected by pipes and sockets and reading and writing files for carefullness of handling of short reads/writes?
Expecting to see such tools at various levels:
- just filter thing:
./prog1 | short_tester | ./prog2
- library interceptor:
LD_PRELOAD=libshort_tester.so sh -c "./prog1 | ./prog2"
- kernel module:
modprobe short_tester; echo 1 > /proc/sys/fs/short_tester; ./prog1 | ./prog2;
If unmodified pipeline is prog1
writes "0123456789" and prog2
reads "0123456789" then modified pipe is like:
prog1
writes "0123"prog1
writes "4"prog2
reads "01"prog1
writes "567"prog2
reads "23456"prog2
reads "7"prog1
writes "89"prog2
reads "89"
Are there already tools for this?