xd(1) has problems when dumping with the -r option. It prints wrong address offsets and misses non-repeating data. Test with xd -r -c, diff of using unpatched vs patched with http://pcoutin.us.to/randomfs diff unpatched patched 15,17c15,17 < 0000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 U aa < 0000170 f0 ff ff ff 0f 00 00 00 00 00 00 00 00 00 00 00 < 0000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 --- > 00001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 U aa > 0000200 f0 ff ff ff 0f 00 00 00 00 00 00 00 00 00 00 00 > 0000210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19,20c19,20 < 0000a80 f0 ff ff ff 0f 00 00 00 00 00 00 00 00 00 00 00 < 0000a90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 --- > 0001400 f0 ff ff ff 0f 00 00 00 00 00 00 00 00 00 00 00 > 0001410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22,26c22,26 < 0001390 A n 00 o 00 t 00 a 00 f 00 0f 00 f8 i 00 < 00013a0 l 00 e 00 00 00 ff ff ff ff 00 00 ff ff ff ff < 00013b0 N O T A F I L E 00 00 00 00 00 < 00013c0 00 00 00 00 00 00 ac $ 03 E 02 00 \r 00 00 00 < 00013d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 --- > 0002600 A n 00 o 00 t 00 a 00 f 00 0f 00 f8 i 00 > 0002610 l 00 e 00 00 00 ff ff ff ff 00 00 ff ff ff ff > 0002620 N O T A F I L E 00 00 00 00 00 > 0002630 00 00 00 00 00 00 ac $ 03 E 02 00 \r 00 00 00 > 0002640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28,30c28,33 < 00b40b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9 < 00b40c0 < 00b40c0 --- > 0004200 h e l l o , w o r l d \n 00 00 00 > 0004210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > * > 0167ff0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9 > 0168000 > 0168000 Note that the 'hello, world' string only shows up with the patched xd's output. The unpatched one misses the first 16 bytes of data when it stops repeating. Reference: /n/sources/patch/xd-repeating-bugfix Date: Sun Aug 3 13:48:37 CES 2014 Signed-off-by: pcoutin@sdf.org --- /sys/src/cmd/xd.c Sun Aug 3 13:48:25 2014 +++ /sys/src/cmd/xd.c Sun Aug 3 13:48:22 2014 @@ -247,6 +247,10 @@ break; if(i == nsee){ addr += nsee; + if(nread>nsee){ + nleft = nread - nsee; + memmove(data, data + nsee, nleft); + } if(star == 0){ star++; xprint("*\n", 0);