On Mon Mar 21 11:38:22 EDT 2011, quans...@quanstro.net wrote:
> this is drawterm on osx 10.6 to plan 9.
> 
> i don't have time to investigate right now, but here's the bug
> looks like sign extension.
> 
> minooka; cp /mnt/term/tmp/file.gz .
> cp: error reading /mnt/term/tmp/file.gz: negative i/o offset
> minooka; ls -l
> --rw-r--r-- M 1638 xxx xxx 2147483648 Mar 21 11:05 file.gz

it wasn't hard to get a reproducer:

        ; dd -iseek 2147483640 -count 10 -if /mnt/term/dev/zero -of fubar -bs 1
        read: negative i/o offset
        8+0 records in
        8+0 records out

this smelled like a sign extension bug, and sure enough, it was
in the first place i looked

hg diff include/fcall.h
diff -r 005885bfe3f2 include/fcall.h
--- a/include/fcall.h   Tue Dec 28 16:40:27 2010 -0500
+++ b/include/fcall.h   Tue Mar 22 10:28:00 2011 -0400
@@ -37,7 +37,7 @@
 #define        GBIT8(p)        ((p)[0])
 #define        GBIT16(p)       ((p)[0]|((p)[1]<<8))
 #define        GBIT32(p)       ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24))
-#define        GBIT64(p)       
((vlong)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\
+#define        GBIT64(p)       
((u32int)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\
                                
((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32))
 
 #define        PBIT8(p,v)      (p)[0]=(v)

hg is a pain, so the drawterm-fixes patch queue broke as
soon as russ pulled in some changes.  i'll try to work out
how to get this up while causing minimal chaos.

- erik

Reply via email to