• Kirill Smelkov's avatar
    X readBlk: Fix thinko in aready case · 29c9f13d
    Kirill Smelkov authored
    We were checking for `loading.err != nil` as the indication for success
    and it should have been `err == nil`. The symphoms of the bug were that
    \0 instead of data were read sometimes:
    
    	wcfs: 2018/10/11 19:18:12 < 22: i7.READ {Fh 0 [2097152 +131072)  L 0 RDONLY,0x8000}                             <-- NOTE
    
    	I1011 19:18:12.556125    6330 wcfs.go:538] readBlk #1 dest[0:+2097152]
    	I1011 19:18:12.556361    6330 wcfs.go:538] readBlk #1 dest[0:+2097152]
    	wcfs: 2018/10/11 19:18:12 ZBlk0.PySetState #11
    	wcfs: 2018/10/11 19:18:12 ZBigFile.loadblk(1) -> 2097152B
    
    	wcfs: 2018/10/11 19:18:12 > 22:     OK,  131072B data "\x00\x00\x00\x00\x00\x00\x00\x00"...                     <-- XXX not "hello world"
    
    	wcfs: 2018/10/11 19:18:12 < 24: i7.READ {Fh 0 [2359296 +131072)  L 0 RDONLY,0x8000}
    	wcfs: 2018/10/11 19:18:12 > 23:     OK,  131072B data "\x00\x00\x00\x00\x00\x00\x00\x00"...
    	wcfs: 2018/10/11 19:18:12 > 0:     NOTIFY_STORE_CACHE, {i7 [2097152 +2097152)} 2097152B data "hello wo"...      <-- NOTE
    29c9f13d
wcfs.go 23.2 KB