On 18 September 2011 21:58, Alexander Gordeev <lasa...@lvk.cs.msu.su> wrote: >> >> > Well, then this is probably a bug in dd? Or uClibc? Or kernel? >> >> > Ok, I'll try to reproduce it. Can you please tell me what exactly is >> >> > happening? >> >> > >> >> >> >> Two different reads: >> >> root@OpenWrt:/# dd bs=1 skip=262148 count=6 if=/dev/mtd0 >> >> "u�������6+0 records in >> >> 6+0 records out >> >> root@OpenWrt:/# dd bs=1 skip=262148 count=6 if=/dev/mtd0 >> >> "u���6+0 records in >> >> 6+0 records out >> >> >> >> I don't think this is the bug in dd/kernel/uclibc - it would probably >> >> expose when writing to a file too. >> >> Maybe it's something with busybox. I'm not sure of cause. >> > >> > The bug is in maccalc. It does a single read() and expects to get >> > everything in one shot which doesn't happen sometimes. The patch is >> > attached. It fixes the problem according to my tests. >> > >> > I don't know whether Roman's change is necessary anymore. What do you >> > think, Roman? >> > >> >> I think how it can be that you can't read 6 bytes from stdin in one >> attempt but can do it from file? > > Quite easyly. BTW you shouldn't even expect to read() 6 bytes from file > at once. > > ... > And, well, please read 'man 2 read'.
:) now, after reading `man 2 read', can you explain how dd is giving different number of symbols to stdout? >> I think that there is something to do with terminal translating binary >> information into something unexpected. I forgot to mention that error >> occurs when there are _more_ symbols in stdout (see above). Also note >> that in both reads there are exactly 6 bytes reported by dd. > > I think, you'd rather do no conclusions from binary output to a > console. I did that: > that doesn't explain anything - see Gert's explanation >> I'll test your patch. > > Yes, please. maybe your solution is better but reading from temp file also works (didn't have any failure in 10k reads) Regards, Roman _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel